Commit d48cf603 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Add clean_cmd to the testsuite, and use it in bug1465

parent 1da0248b
......@@ -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 = ''
......
......@@ -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))
......
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'])
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