Commit f7434a7c authored by Simon Marlow's avatar Simon Marlow
Browse files

Allow files-to-cleanup to be attached to a test using extra_clean(files)

This is better than a top-level clean() when using threads
parent 69d9ed0e
......@@ -138,10 +138,10 @@ class TestOptions:
self.extra_ways = []
# the result we normally expect for this test
self.expect = 'pass';
self.expect = 'pass'
# override the expected result for certain ways
self.expect_fail_for = [];
self.expect_fail_for = []
# the stdin file that this test will use (empty for <name>.stdin)
self.stdin = ''
......@@ -167,6 +167,9 @@ class TestOptions:
# should we clean up after ourselves?
self.cleanup = ''
# extra files to clean afterward
self.clean_files = []
# should we run this test alone, i.e. not run it in parallel with
# any other threads
self.alone = 0
......
......@@ -232,9 +232,17 @@ def extra_run_opts( val ):
def _extra_run_opts( opts, v ):
opts.extra_run_opts = v
# -----
def no_clean( opts ):
opts.cleanup = '';
def extra_clean( files ):
return lambda opts, v=files: _extra_clean(opts, v);
def _extra_clean( opts, v ):
opts.clean_files = v
# -----
def skip_if_no_ghci(opts):
......@@ -409,6 +417,8 @@ def test_common_work (name, opts, func, args):
'.hi', '.o', '.prof', '.exe.prof', '.hc', '_stub.h', '_stub.c',
'_stub.o', '.hp', '.exe.hp', '.ps', '.aux', '.hcr']))
clean(getTestOpts().clean_files)
def clean(names):
clean_full_paths(map (lambda name: in_testdir(name), names))
......
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