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

Add pre-command support to the testsuite, and fix annrun01 by using it

parent 5a035653
...@@ -202,6 +202,9 @@ class TestOptions: ...@@ -202,6 +202,9 @@ class TestOptions:
# Does this test use a .c file? # Does this test use a .c file?
self.c_src = 0 self.c_src = 0
# Command to run before the test
self.pre_cmd = None
# Prefix to put on the command before running it # Prefix to put on the command before running it
self.cmd_prefix = '' self.cmd_prefix = ''
......
...@@ -353,6 +353,14 @@ def c_src( opts ): ...@@ -353,6 +353,14 @@ def c_src( opts ):
# ---- # ----
def pre_cmd( cmd ):
return lambda opts, c=cmd: _pre_cmd(opts, cmd)
def _pre_cmd( opts, cmd ):
opts.pre_cmd = cmd
# ----
def cmd_prefix( prefix ): def cmd_prefix( prefix ):
return lambda opts, p=prefix: _cmd_prefix(opts, prefix) return lambda opts, p=prefix: _cmd_prefix(opts, prefix)
...@@ -537,6 +545,17 @@ def do_test(name, way, func, args): ...@@ -537,6 +545,17 @@ def do_test(name, way, func, args):
if config.use_threads: if config.use_threads:
t.lock.release() t.lock.release()
try:
preCmd = getTestOpts().pre_cmd
print preCmd
if preCmd != None:
result = runCmd('cd ' + getTestOpts().testdir + ' && ' + preCmd)
if result != 0:
framework_fail(name, way, 'pre-command failed: ' + str(result))
except e:
framework_fail(name, way, 'pre-command exception')
try: try:
result = apply(func, [name,way] + args) result = apply(func, [name,way] + args)
finally: finally:
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
# These tests are very slow due to their use of package GHC # These tests are very slow due to their use of package GHC
setTestOpts(compose(skip_if_fast, if_compiler_lt('ghc', '6.11', skip))); setTestOpts(compose(skip_if_fast, if_compiler_lt('ghc', '6.11', skip)));
runCmd('$MAKE -C ' + in_testdir('') + ' config')
# Annotations, like Template Haskell, require runtime evaluation. In # Annotations, like Template Haskell, require runtime evaluation. In
# order for this to work with profiling, we would have to build the # order for this to work with profiling, we would have to build the
# program twice and use -osuf p_o (see the TH_splitE5_prof test). For # program twice and use -osuf p_o (see the TH_splitE5_prof test). For
...@@ -11,6 +9,7 @@ runCmd('$MAKE -C ' + in_testdir('') + ' config') ...@@ -11,6 +9,7 @@ runCmd('$MAKE -C ' + in_testdir('') + ' config')
test('annrun01', test('annrun01',
[extra_clean(['Annrun01_Help.hi', 'Annrun01_Help.o', [extra_clean(['Annrun01_Help.hi', 'Annrun01_Help.o',
'annrun01.hi', 'annrun01.o']), 'annrun01.hi', 'annrun01.o']),
pre_cmd('$MAKE config'),
omit_ways(['profc','profasm','profthreaded'])], omit_ways(['profc','profasm','profthreaded'])],
multimod_compile_and_run, multimod_compile_and_run,
['annrun01', '-package ghc'] ['annrun01', '-package ghc']
......
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