From f320f3b2f2f421af41b8f7588529ed46bbe6ccf3 Mon Sep 17 00:00:00 2001 From: Vladislav Zavialov Date: Mon, 25 Feb 2019 01:23:42 +0300 Subject: Fix the ghci063 test on Darwin (Trac #16201) We use "touch -r" to set modification timestamps, which leads to precision loss on Darwin. For example, before: 2019-02-25 01:11:23.807627350 +0300 after: 2019-02-25 01:11:23.807627000 +0300 ^^^ This means we can't trick GHCi into thinking the file hasn't been changed by restoring its old timestamp, as we cannot faithfully restore all digits. The solution is to nullify the insignificant digits before the first :load --- testsuite/tests/ghci/scripts/all.T | 2 +- testsuite/tests/ghci/scripts/ghci063.script | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 575d9ebafc..946c6ef954 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -104,7 +104,7 @@ test('ghci061', normal, ghci_script, ['ghci061.script']) test('ghci062', [extra_files(['ghci062/', 'ghci062/Test.hs']), when(config.have_ext_interp, extra_ways(['ghci-ext']))], ghci_script, ['ghci062.script']) -test('ghci063', when(opsys('darwin'), expect_broken(16201)), ghci_script, ['ghci063.script']) +test('ghci063', normal, ghci_script, ['ghci063.script']) test('T2452', [extra_hc_opts("-fno-implicit-import-qualified")], ghci_script, ['T2452.script']) diff --git a/testsuite/tests/ghci/scripts/ghci063.script b/testsuite/tests/ghci/scripts/ghci063.script index 87a19baf48..377f65934c 100644 --- a/testsuite/tests/ghci/scripts/ghci063.script +++ b/testsuite/tests/ghci/scripts/ghci063.script @@ -1,6 +1,18 @@ :! echo module A where {} >A.hs :! echo module B where { import A } >B.hs +-- Workaround for Trac #16201. We use "touch -r" to set modification +-- timestamps, which leads to precision loss on Darwin. For example, +-- +-- before: 2019-02-25 01:11:23.807627350 +0300 +-- after: 2019-02-25 01:11:23.807627000 +0300 +-- ^^^ +-- This means we can't trick GHCi into thinking the file hasn't been changed +-- by restoring its old timestamp, as we cannot faithfully restore all digits. +-- +-- The solution is to nullify the insignificant digits before the first load. +:! touch -r B.hs B.hs + :load B -- We're going to replace B.hs with an invalid module but without -- cgit v1.2.1