[commit: ghc] wip/trac-16201: Fix the ghci063 test on Darwin (Trac #16201) (f320f3b)

git at git.haskell.org git at git.haskell.org
Mon Feb 25 22:05:47 UTC 2019


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/trac-16201
Link       : http://ghc.haskell.org/trac/ghc/changeset/f320f3b2f2f421af41b8f7588529ed46bbe6ccf3/ghc

>---------------------------------------------------------------

commit f320f3b2f2f421af41b8f7588529ed46bbe6ccf3
Author: Vladislav Zavialov <vlad.z.4096 at gmail.com>
Date:   Mon Feb 25 01:23:42 2019 +0300

    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


>---------------------------------------------------------------

f320f3b2f2f421af41b8f7588529ed46bbe6ccf3
 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 575d9eb..946c6ef 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 87a19ba..377f659 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



More information about the ghc-commits mailing list