diff options
author | Ian Lynagh <igloo@earth.li> | 2009-12-19 16:47:08 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2009-12-19 16:47:08 +0000 |
commit | d48cf60320cfc7547d8d611681cd219e834ce686 (patch) | |
tree | 78fa60cc2a31712498884b8b669e60825f033777 /testsuite | |
parent | 1da0248b38e41c7a663e38e04354b1eac3e7fee4 (diff) | |
download | haskell-d48cf60320cfc7547d8d611681cd219e834ce686.tar.gz |
Add clean_cmd to the testsuite, and use it in bug1465
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/driver/testglobals.py | 3 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 17 | ||||
-rw-r--r-- | testsuite/tests/ghc-regress/typecheck/bug1465/all.T | 7 |
3 files changed, 24 insertions, 3 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 0644bd3671..14fc2b5120 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -205,6 +205,9 @@ class TestOptions: # Command to run before the test self.pre_cmd = None + # Command to run for extra cleaning + self.clean_cmd = None + # Prefix to put on the command before running it self.cmd_prefix = '' diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 2630743df3..64f9f4b027 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -361,6 +361,14 @@ def _pre_cmd( opts, cmd ): # ---- +def clean_cmd( cmd ): + return lambda opts, c=cmd: _clean_cmd(opts, cmd) + +def _clean_cmd( opts, cmd ): + opts.clean_cmd = cmd + +# ---- + def cmd_prefix( prefix ): return lambda opts, p=prefix: _cmd_prefix(opts, prefix) @@ -510,6 +518,15 @@ def test_common_work (name, opts, func, args): '_stub.o', '.hp', '.exe.hp', '.ps', '.aux', '.hcr', '.eventlog'])) clean(getTestOpts().clean_files) + if getTestOpts().cleanup != '': + try: + cleanCmd = getTestOpts().clean_cmd + if cleanCmd != None: + result = runCmd('cd ' + getTestOpts().testdir + ' && ' + cleanCmd) + if result != 0: + framework_fail(name, 'cleaning', 'clean-command failed: ' + str(result)) + except e: + framework_fail(name, way, 'clean-command exception') def clean(names): clean_full_paths(map (lambda name: in_testdir(name), names)) diff --git a/testsuite/tests/ghc-regress/typecheck/bug1465/all.T b/testsuite/tests/ghc-regress/typecheck/bug1465/all.T index c772f6eba9..3847d684d8 100644 --- a/testsuite/tests/ghc-regress/typecheck/bug1465/all.T +++ b/testsuite/tests/ghc-regress/typecheck/bug1465/all.T @@ -1,3 +1,4 @@ -test('bug1465', normal, run_command, ['$MAKE -s --no-print-directory bug1465']) -if default_testopts.cleanup != '': - runCmd('$MAKE -C ' + in_testdir('') + ' clean') +test('bug1465', + clean_cmd('$MAKE -s clean'), + run_command, + ['$MAKE -s --no-print-directory bug1465']) |