diff options
author | Vladislav Zavialov <vlad.z.4096@gmail.com> | 2019-02-25 01:23:42 +0300 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2019-06-24 23:28:47 -0400 |
commit | f9da172cde69071121dc8698bc1488b454ab32b2 (patch) | |
tree | 9cf1dc1ecb15fff0655052eada535b40a9f4fc77 | |
parent | 4bc90b32b2a334f23f8a7c2081df93082ff9ee89 (diff) | |
download | haskell-f9da172cde69071121dc8698bc1488b454ab32b2.tar.gz |
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
(cherry picked from commit f320f3b2f2f421af41b8f7588529ed46bbe6ccf3)
-rwxr-xr-x | testsuite/tests/ghci/scripts/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci063.script | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index de8716d935..5162a3c220 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -106,7 +106,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 |