Commit eb7aacb6 authored by Simon Marlow's avatar Simon Marlow
Browse files

Make the compiler_always_flags modifiable on a per-test basis

Motivation: we wanted to disable -dcore-lint for the perf tests
parent ab592001
...@@ -176,6 +176,11 @@ class TestOptions: ...@@ -176,6 +176,11 @@ class TestOptions:
# compile this test to .hc only # compile this test to .hc only
self.compile_to_hc = 0 self.compile_to_hc = 0
# We sometimes want to modify the compiler_always_flags, so
# they are copied from config.compiler_always_flags when we
# make a new instance of TestOptions.
self.compiler_always_flags = []
# extra compiler opts for this test # extra compiler opts for this test
self.extra_hc_opts = '' self.extra_hc_opts = ''
......
...@@ -494,6 +494,7 @@ def newTestDir( dir ): ...@@ -494,6 +494,7 @@ def newTestDir( dir ):
# reset the options for this test directory # reset the options for this test directory
thisdir_testopts = copy.copy(default_testopts) thisdir_testopts = copy.copy(default_testopts)
thisdir_testopts.testdir = dir thisdir_testopts.testdir = dir
thisdir_testopts.compiler_always_flags = config.compiler_always_flags
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Actually doing tests # Actually doing tests
...@@ -834,7 +835,7 @@ def run_command( name, way, cmd ): ...@@ -834,7 +835,7 @@ def run_command( name, way, cmd ):
def ghci_script( name, way, script ): def ghci_script( name, way, script ):
# filter out -fforce-recomp from compiler_always_flags, because we're # filter out -fforce-recomp from compiler_always_flags, because we're
# actually testing the recompilation behaviour in the GHCi tests. # actually testing the recompilation behaviour in the GHCi tests.
flags = filter(lambda f: f != '-fforce-recomp', config.compiler_always_flags) flags = filter(lambda f: f != '-fforce-recomp', getTestOpts().compiler_always_flags)
flags.append(getTestOpts().extra_hc_opts) flags.append(getTestOpts().extra_hc_opts)
# We pass HC and HC_OPTS as environment variables, so that the # We pass HC and HC_OPTS as environment variables, so that the
...@@ -1035,7 +1036,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, ...@@ -1035,7 +1036,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf,
else: else:
cmd_prefix = getTestOpts().compile_cmd_prefix + ' ' cmd_prefix = getTestOpts().compile_cmd_prefix + ' '
comp_flags = config.compiler_always_flags comp_flags = getTestOpts().compiler_always_flags
if noforce: if noforce:
comp_flags = filter(lambda f: f != '-fforce-recomp', comp_flags) comp_flags = filter(lambda f: f != '-fforce-recomp', comp_flags)
...@@ -1212,7 +1213,7 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ): ...@@ -1212,7 +1213,7 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ):
script.close() script.close()
cmd = "'" + config.compiler + "' " \ cmd = "'" + config.compiler + "' " \
+ join(config.compiler_always_flags,' ') + ' ' \ + join(getTestOpts().compiler_always_flags,' ') + ' ' \
+ srcname + ' ' \ + srcname + ' ' \
+ join(config.way_flags[way],' ') + ' ' \ + join(config.way_flags[way],' ') + ' ' \
+ extra_hc_opts + ' ' \ + extra_hc_opts + ' ' \
...@@ -1306,7 +1307,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ): ...@@ -1306,7 +1307,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ):
cmd = 'cd ' + getTestOpts().testdir + " && '" \ cmd = 'cd ' + getTestOpts().testdir + " && '" \
+ config.compiler + "' " \ + config.compiler + "' " \
+ join(config.compiler_always_flags,' ') + ' ' \ + join(getTestOpts().compiler_always_flags,' ') + ' ' \
+ join(config.way_flags[way],' ') + ' ' \ + join(config.way_flags[way],' ') + ' ' \
+ extra_hc_opts + ' ' \ + extra_hc_opts + ' ' \
+ getTestOpts().extra_hc_opts \ + getTestOpts().extra_hc_opts \
...@@ -1336,7 +1337,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ): ...@@ -1336,7 +1337,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ):
cmd = 'cd ' + getTestOpts().testdir + " && '" \ cmd = 'cd ' + getTestOpts().testdir + " && '" \
+ config.compiler + "' " \ + config.compiler + "' " \
+ join(config.compiler_always_flags,' ') + ' ' \ + join(getTestOpts().compiler_always_flags,' ') + ' ' \
+ to_compile + ' ' \ + to_compile + ' ' \
+ extra_hc_opts + ' ' \ + extra_hc_opts + ' ' \
+ getTestOpts().extra_hc_opts + ' ' \ + getTestOpts().extra_hc_opts + ' ' \
......
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