Commit d9c82214 authored by Simon Marlow's avatar Simon Marlow

remove the _with_prefix forms of compile_and_run, add cmd_prefix() config instead

parent d1270a0b
......@@ -184,6 +184,9 @@ class TestOptions:
# Does this test use a .c file?
self.c_src = 0
# Prefix to put on the command before running it
self.cmd_prefix = ''
# The default set of options
global default_testopts
default_testopts = TestOptions()
......
......@@ -376,6 +376,14 @@ def literate( opts ):
def c_src( opts ):
opts.c_src = 1;
# ----
def cmd_prefix( prefix ):
return lambda opts, p=prefix: _cmd_prefix(opts, prefix)
def _cmd_prefix( opts, prefix ):
opts.cmd_prefix = prefix
# ----
# Function for composing two opt-fns together
......@@ -451,9 +459,7 @@ def test_common_work (name, opts, func, args):
# All the ways we might run this test
if func == compile or func == multimod_compile:
all_ways = config.compile_ways
elif func == compile_and_run or func == multimod_compile_and_run \
or func == multimod_compile_and_run_with_prefix \
or func == compile_and_run_with_prefix:
elif func == compile_and_run or func == multimod_compile_and_run:
all_ways = config.run_ways
elif func == ghci_script:
if 'ghci' in config.run_ways:
......@@ -669,7 +675,7 @@ def do_compile( name, way, should_fail, top_mod, extra_hc_opts ):
# -----------------------------------------------------------------------------
# Compile-and-run tests
def compile_and_run__( name, way, extra_hc_opts, top_mod, prefix_cmd ):
def compile_and_run__( name, way, extra_hc_opts, top_mod ):
# print 'Compile and run, extra args = ', extra_hc_opts
pretest_cleanup(name)
......@@ -684,23 +690,17 @@ def compile_and_run__( name, way, extra_hc_opts, top_mod, prefix_cmd ):
return 'fail'
cmd = './' + name;
if prefix_cmd != '':
cmd = prefix_cmd + ' ' + cmd;
if getTestOpts().cmd_prefix != '':
cmd = getTestOpts().cmd_prefix + ' ' + cmd;
# we don't check the compiler's stderr for a compile-and-run test
return simple_run( name, way, cmd, getTestOpts().extra_run_opts )
def compile_and_run( name, way, extra_hc_opts):
return compile_and_run__( name, way, extra_hc_opts, '' , '')
def compile_and_run_with_prefix( name, way, prefix, extra_hc_opts):
return compile_and_run__( name, way, extra_hc_opts, '' , prefix )
def compile_and_run( name, way, extra_hc_opts ):
return compile_and_run__( name, way, extra_hc_opts, '')
def multimod_compile_and_run( name, way, top_mod, extra_hc_opts ):
return compile_and_run__( name, way, extra_hc_opts, top_mod, '' )
def multimod_compile_and_run_with_prefix( name, way, prefix, top_mod, extra_hc_opts ):
return compile_and_run__( name, way, extra_hc_opts, top_mod, prefix )
return compile_and_run__( name, way, extra_hc_opts, top_mod)
# -----------------------------------------------------------------------------
# Build a single-module program
......
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