Commit e340f6ec authored by thomie's avatar thomie

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.
parent d0063e89
......@@ -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)
......
......@@ -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:
......
......@@ -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'])
......
[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’:
......
......@@ -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'])
......
......@@ -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,
......
......@@ -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'])
......
......@@ -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, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment