summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-12-19 15:45:02 +0000
committerIan Lynagh <igloo@earth.li>2009-12-19 15:45:02 +0000
commite7841b8597a22cb0649b011463a92dba44ec6ecd (patch)
tree1574fc8315618cc563e800f0b10602a03131901f /testsuite
parent5a0356538a71656c5fc86e12f954a7c12d924f11 (diff)
downloadhaskell-e7841b8597a22cb0649b011463a92dba44ec6ecd.tar.gz
Add pre-command support to the testsuite, and fix annrun01 by using it
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/driver/testglobals.py3
-rw-r--r--testsuite/driver/testlib.py19
-rw-r--r--testsuite/tests/ghc-regress/annotations/should_run/all.T3
3 files changed, 23 insertions, 2 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index 79fc136aba..0644bd3671 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -202,6 +202,9 @@ class TestOptions:
# Does this test use a .c file?
self.c_src = 0
+ # Command to run before the test
+ self.pre_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 e1bb411562..5af562a342 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -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 ):
return lambda opts, p=prefix: _cmd_prefix(opts, prefix)
@@ -537,6 +545,17 @@ def do_test(name, way, func, args):
if config.use_threads:
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:
result = apply(func, [name,way] + args)
finally:
diff --git a/testsuite/tests/ghc-regress/annotations/should_run/all.T b/testsuite/tests/ghc-regress/annotations/should_run/all.T
index 8dd4cdd9f3..5c623ba049 100644
--- a/testsuite/tests/ghc-regress/annotations/should_run/all.T
+++ b/testsuite/tests/ghc-regress/annotations/should_run/all.T
@@ -2,8 +2,6 @@
# These tests are very slow due to their use of package GHC
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
# 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
@@ -11,6 +9,7 @@ runCmd('$MAKE -C ' + in_testdir('') + ' config')
test('annrun01',
[extra_clean(['Annrun01_Help.hi', 'Annrun01_Help.o',
'annrun01.hi', 'annrun01.o']),
+ pre_cmd('$MAKE config'),
omit_ways(['profc','profasm','profthreaded'])],
multimod_compile_and_run,
['annrun01', '-package ghc']