[commit: ghc] master: Testsuite: add/fix cleanup for certain tests (e340f6e)

git at git.haskell.org git at git.haskell.org
Thu Jun 4 22:01:09 UTC 2015


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

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/e340f6eccc9d6d8f0a11c56c312570060c245946/ghc

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

commit e340f6eccc9d6d8f0a11c56c312570060c245946
Author: Thomas Miedema <thomasmiedema at gmail.com>
Date:   Thu May 28 22:00:00 2015 +0200

    Testsuite: add/fix cleanup for certain tests
    
    * extra_clean argument should be a list
      Add an assert to prevent regressions.
    
    * properly clean package conf direcories
      They are directories now, which was causing problems.
    
    * properly clean write_interface_* tests
      We were getting these errors:
    
      [Errno 21] Is a directory: './driver/write_interface_oneshot'
      [Errno 39] Directory not empty: './driver/write_interface_oneshot'
      [Errno 21] Is a directory: './driver/write_interface_make'
      [Errno 39] Directory not empty: './driver/write_interface_make'
    
    * outputdir() is better than -outputdir, as it knows how to (pre)clean
      itself.


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

e340f6eccc9d6d8f0a11c56c312570060c245946
 testsuite/driver/testlib.py              |  6 ++++++
 testsuite/tests/driver/Makefile          |  8 ++++----
 testsuite/tests/driver/all.T             | 11 +++++++++--
 testsuite/tests/generics/T5462No1.stderr |  4 ++--
 testsuite/tests/generics/all.T           | 12 ++++++------
 testsuite/tests/ghci/linking/all.T       | 11 +++++++----
 testsuite/tests/ghci/scripts/all.T       |  4 ++--
 testsuite/tests/parser/unicode/all.T     |  2 +-
 8 files changed, 37 insertions(+), 21 deletions(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index fe9125b..dbae8d7 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -264,6 +264,7 @@ def _extra_hc_opts( name, opts, v ):
 # -----
 
 def extra_clean( files ):
+    assert not isinstance(files, str), files
     return lambda name, opts, v=files: _extra_clean(name, opts, v);
 
 def _extra_clean( name, opts, v ):
@@ -751,6 +752,11 @@ def test_common_work (name, opts, func, args):
 
 def clean(strs):
     for str in strs:
+        if (str.endswith('.package.conf') or
+            str.startswith('package.conf.') and not str.endswith('/*')):
+            # Package confs are directories now.
+            str += '/*'
+
         for name in glob.glob(in_testdir(str)):
             clean_full_path(name)
 
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index dafb76e..d463ebf 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -578,14 +578,14 @@ T2182:
 .PHONY: write_interface_oneshot
 write_interface_oneshot:
 	$(RM) -rf write_interface_oneshot/A011.hi
-	"$(TEST_HC)" $(TEST_HC_OPTS) -hidir write_interface_oneshot -fno-code -fwrite-interface -c A011.hs
-	test -f write_interface_oneshot/A011.hi
+	"$(TEST_HC)" $(TEST_HC_OPTS) -hidir write_interface_oneshot_hidir -fno-code -fwrite-interface -c A011.hs
+	test -f write_interface_oneshot_hidir/A011.hi
 
 .PHONY: write_interface_make
 write_interface_make:
 	$(RM) -rf write_interface_make/A011.hi
-	"$(TEST_HC)" $(TEST_HC_OPTS) -hidir write_interface_make -fno-code -fwrite-interface --make A011.hs
-	test -f write_interface_make/A011.hi
+	"$(TEST_HC)" $(TEST_HC_OPTS) -hidir write_interface_make_hidir -fno-code -fwrite-interface --make A011.hs
+	test -f write_interface_make_hidir/A011.hi
 
 .PHONY: T9938
 T9938:
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 8d4fcf5..5d936d7 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -405,8 +405,15 @@ def build_T9050(name, way):
      return simple_build(name + '.cmm', way, '-outputdir=. ', 0, '', 0, 0, 0)
 test('T9050', normal, build_T9050, [])
 
-test('write_interface_oneshot', normal, run_command, ['$MAKE -s --no-print-directory write_interface_oneshot'])
-test('write_interface_make', normal, run_command, ['$MAKE -s --no-print-directory write_interface_make'])
+test('write_interface_oneshot',
+     extra_clean(['write_interface_oneshot_hidir/*']),
+     run_command,
+     ['$MAKE -s --no-print-directory write_interface_oneshot'])
+
+test('write_interface_make',
+     extra_clean(['write_interface_make_hidir/*']),
+     run_command,
+     ['$MAKE -s --no-print-directory write_interface_make'])
 
 test('T9776', normal, compile_fail, ['-frule-check'])
 
diff --git a/testsuite/tests/generics/T5462No1.stderr b/testsuite/tests/generics/T5462No1.stderr
index 9a4418a..87ef888 100644
--- a/testsuite/tests/generics/T5462No1.stderr
+++ b/testsuite/tests/generics/T5462No1.stderr
@@ -1,5 +1,5 @@
-[1 of 2] Compiling GFunctor         ( GFunctor/GFunctor.hs, T5462No1/GFunctor.o )
-[2 of 2] Compiling T5462No1         ( T5462No1.hs, T5462No1/T5462No1.o )
+[1 of 2] Compiling GFunctor         ( GFunctor/GFunctor.hs, out_T5462No1/GFunctor.o )
+[2 of 2] Compiling T5462No1         ( T5462No1.hs, out_T5462No1/T5462No1.o )
 
 T5462No1.hs:24:42:
     Can't make a derived instance of ‘GFunctor F’:
diff --git a/testsuite/tests/generics/all.T b/testsuite/tests/generics/all.T
index 98116ec..9a2103f 100644
--- a/testsuite/tests/generics/all.T
+++ b/testsuite/tests/generics/all.T
@@ -19,12 +19,12 @@ test('GenCannotDoRep1_6', normal, compile_fail, [''])
 test('GenCannotDoRep1_7', normal, compile_fail, [''])
 test('GenCannotDoRep1_8', normal, compile_fail, [''])
 
-test('T5462Yes1', extra_clean(['T5462Yes1/GFunctor.hi'])
-    , multimod_compile_and_run, ['T5462Yes1', '-iGEq -iGEnum -iGFunctor -outputdir=out_T5462Yes1'])
-test('T5462Yes2', extra_clean(['T5462Yes2/GFunctor.hi'])
-    , multimod_compile_and_run, ['T5462Yes2', '-iGFunctor -outputdir=out_T5462Yes2'])
-test('T5462No1', extra_clean(['T5462No1/GFunctor.hi'])
-     , multimod_compile_fail, ['T5462No1', '-iGFunctor -outputdir=T5462No1'])
+test('T5462Yes1', outputdir('out_T5462Yes1')
+    , multimod_compile_and_run, ['T5462Yes1', '-iGEq -iGEnum -iGFunctor'])
+test('T5462Yes2', outputdir('out_T5462Yes2')
+    , multimod_compile_and_run, ['T5462Yes2', '-iGFunctor'])
+test('T5462No1', outputdir('out_T5462No1')
+    , multimod_compile_fail, ['T5462No1', '-iGFunctor'])
 
 test('T5884',      extra_clean(['T5884Other.o', 'T5884Other.hi'])
     , multimod_compile, ['T5884Other', '-v0'])
diff --git a/testsuite/tests/ghci/linking/all.T b/testsuite/tests/ghci/linking/all.T
index 6675a53..c7ce1c3 100644
--- a/testsuite/tests/ghci/linking/all.T
+++ b/testsuite/tests/ghci/linking/all.T
@@ -22,12 +22,15 @@ test('ghcilink003',
 
 test('ghcilink004',
      [unless(doing_ghci, skip),
-      extra_clean(['dir004/*','dir004'])],
+      extra_clean(['dir004/local.package.conf/*', 'dir004/*', 'dir004'])
+     ],
      run_command,
      ['$MAKE -s --no-print-directory ghcilink004'])
 
 test('ghcilink005',
-     [unless(doing_ghci, skip), extra_clean(['dir005/*','dir005'])],
+     [unless(doing_ghci, skip),
+      extra_clean(['dir005/ghcilink005.package.conf/*', 'dir005/*','dir005'])
+     ],
      run_command,
      ['$MAKE -s --no-print-directory ghcilink005'])
 
@@ -36,13 +39,13 @@ test('ghcilink006',
        # still cannot load libstdc++ on Windows.  See also #4468.
        when(opsys('mingw32'), expect_broken(5289)),
        unless(doing_ghci, skip),
-       extra_clean(['dir006/*','dir006'])
+       extra_clean(['dir006/ghcilink006.package.conf/*', 'dir006/*','dir006'])
      ],
      run_command,
      ['$MAKE -s --no-print-directory ghcilink006'])
 
 test('T3333',
-     [extra_clean('T3333.o'),
+     [extra_clean(['T3333.o']),
      unless(doing_ghci, skip),
      unless(opsys('linux') or ghci_dynamic(), expect_broken(3333))],
      run_command,
diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T
index 212b0e5..a366c1f 100755
--- a/testsuite/tests/ghci/scripts/all.T
+++ b/testsuite/tests/ghci/scripts/all.T
@@ -130,11 +130,11 @@ test('T5979',
     ghci_script, ['T5979.script'])
 test('T5975a',
      [pre_cmd('touch föøbàr1.hs'),
-      clean_cmd('rm föøbàr1.hs')],
+      clean_cmd('rm -f föøbàr1.hs')],
      ghci_script, ['T5975a.script'])
 test('T5975b',
      [pre_cmd('touch föøbàr2.hs'),
-      clean_cmd('rm föøbàr2.hs'),
+      clean_cmd('rm -f föøbàr2.hs'),
       extra_hc_opts('föøbàr2.hs')],
      ghci_script, ['T5975b.script'])
 test('T6027ghci', normal, ghci_script, ['T6027ghci.script'])
diff --git a/testsuite/tests/parser/unicode/all.T b/testsuite/tests/parser/unicode/all.T
index 2ff7edf..ec08ae5 100644
--- a/testsuite/tests/parser/unicode/all.T
+++ b/testsuite/tests/parser/unicode/all.T
@@ -20,5 +20,5 @@ test('T1744', normal, compile_and_run, [''])
 test('T1103', normal, compile, [''])
 test('T2302', only_ways(['normal']), compile_fail, [''])
 test('T4373', normal, compile, [''])
-test('T6016', extra_clean('T6016-twoBOMs'), compile_and_run, ['-package ghc'])
+test('T6016', extra_clean(['T6016-twoBOMs']), compile_and_run, ['-package ghc'])
 test('T7671', normal, compile, [''])



More information about the ghc-commits mailing list