summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Zavialov <vlad.z.4096@gmail.com>2019-02-25 01:23:42 +0300
committerVladislav Zavialov <vlad.z.4096@gmail.com>2019-02-25 19:19:24 +0300
commitf320f3b2f2f421af41b8f7588529ed46bbe6ccf3 (patch)
tree8f3b737bb9266260772ee031925ea12ad01711ad
parent14586f5d737ec5dc828633267b50dcf0d47e1696 (diff)
downloadhaskell-f320f3b2f2f421af41b8f7588529ed46bbe6ccf3.tar.gz
Fix the ghci063 test on Darwin (Trac #16201)wip/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
-rwxr-xr-xtestsuite/tests/ghci/scripts/all.T2
-rw-r--r--testsuite/tests/ghci/scripts/ghci063.script12
2 files changed, 13 insertions, 1 deletions
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