Commit 3b49f8fa authored by thomie's avatar thomie
Browse files

Testsuite: remove `-fforce-recomp` from default flags (#11980)

There is no need for this flag anymore, since each test runs in a
newly created directory. Removing it cleans up testlib.py a bit.

There is a small risk that this renders some tests useless. It's hard to
know. Those tests should have specified -fforce-recomp` explicitly
anyway, so I'm not going to worry about it. I've fixed the ones that
failed without -fforce-recomp.

Reviewed by: bgamari

Differential Revision: https://phabricator.haskell.org/D2346
parent 1d938aa3
......@@ -1007,9 +1007,7 @@ def run_command( name, way, cmd ):
# GHCi tests
def ghci_script( name, way, script, override_flags = None ):
# filter out -fforce-recomp from compiler_always_flags, because we're
# actually testing the recompilation behaviour in the GHCi tests.
flags = ' '.join(get_compiler_flags(override_flags, noforce=True))
flags = ' '.join(get_compiler_flags(override_flags))
way_flags = ' '.join(config.way_flags(name)[way])
......@@ -1076,10 +1074,7 @@ def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts, over
return result
extra_hc_opts = result['hc_opts']
force = 0
if extra_mods:
force = 1
result = simple_build( name, way, extra_hc_opts, should_fail, top_mod, 0, 1, force, override_flags )
result = simple_build(name, way, extra_hc_opts, should_fail, top_mod, 0, 1, override_flags)
if badResult(result):
return result
......@@ -1103,7 +1098,7 @@ def do_compile( name, way, should_fail, top_mod, extra_mods, extra_hc_opts, over
def compile_cmp_asm( name, way, extra_hc_opts ):
print('Compile only, extra args = ', extra_hc_opts)
result = simple_build( name + '.cmm', way, '-keep-s-files -O ' + extra_hc_opts, 0, '', 0, 0, 0)
result = simple_build(name + '.cmm', way, '-keep-s-files -O ' + extra_hc_opts, 0, '', 0, 0)
if badResult(result):
return result
......@@ -1137,11 +1132,7 @@ def compile_and_run__( name, way, top_mod, extra_mods, extra_hc_opts ):
if way.startswith('ghci'): # interpreted...
return interpreter_run( name, way, extra_hc_opts, 0, top_mod )
else: # compiled...
force = 0
if extra_mods:
force = 1
result = simple_build( name, way, extra_hc_opts, 0, top_mod, 1, 1, force)
result = simple_build(name, way, extra_hc_opts, 0, top_mod, 1, 1)
if badResult(result):
return result
......@@ -1222,9 +1213,8 @@ def checkStats(name, way, stats_file, range_fields):
# Build a single-module program
def extras_build( way, extra_mods, extra_hc_opts ):
for modopts in extra_mods:
mod, opts = modopts
result = simple_build( mod, way, opts + ' ' + extra_hc_opts, 0, '', 0, 0, 0)
for mod, opts in extra_mods:
result = simple_build(mod, way, opts + ' ' + extra_hc_opts, 0, '', 0, 0)
if not (mod.endswith('.hs') or mod.endswith('.lhs')):
extra_hc_opts += ' ' + replace_suffix(mod, 'o')
if badResult(result):
......@@ -1232,8 +1222,7 @@ def extras_build( way, extra_mods, extra_hc_opts ):
return {'passFail' : 'pass', 'hc_opts' : extra_hc_opts}
def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, noforce, override_flags = None ):
def simple_build(name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, override_flags=None):
opts = getTestOpts()
errname = add_suffix(name, 'comp.stderr')
......@@ -1273,7 +1262,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf,
else:
cmd_prefix = getTestOpts().compile_cmd_prefix + ' '
flags = ' '.join(get_compiler_flags(override_flags, noforce) +
flags = ' '.join(get_compiler_flags(override_flags) +
config.way_flags(name)[way])
cmd = ('cd "{opts.testdir}" && {cmd_prefix} '
......@@ -1448,7 +1437,7 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ):
if os.path.exists(stdin_file):
os.system('cat "{0}" >> "{1}"'.format(stdin_file, qscriptname))
flags = ' '.join(get_compiler_flags(override_flags=None, noforce=False) +
flags = ' '.join(get_compiler_flags() +
config.way_flags(name)[way])
if getTestOpts().combined_output:
......@@ -1516,7 +1505,7 @@ def split_file(in_fn, delimiter, out1_fn, out2_fn):
# -----------------------------------------------------------------------------
# Utils
def get_compiler_flags(override_flags, noforce):
def get_compiler_flags(override_flags=None):
opts = getTestOpts()
if override_flags is not None:
......@@ -1524,9 +1513,6 @@ def get_compiler_flags(override_flags, noforce):
else:
flags = copy.copy(opts.compiler_always_flags)
if noforce:
flags = [f for f in flags if f != '-fforce-recomp']
flags.append(opts.extra_hc_opts)
if opts.outputdir != None:
......
......@@ -34,7 +34,7 @@ endif
# TEST_HC_OPTS is passed to every invocation of TEST_HC
# in nested Makefiles
TEST_HC_OPTS = -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-$(GhcPackageDbFlag) -rtsopts $(EXTRA_HC_OPTS)
TEST_HC_OPTS = -dcore-lint -dcmm-lint -dno-debug-output -no-user-$(GhcPackageDbFlag) -rtsopts $(EXTRA_HC_OPTS)
TEST_HC_OPTS_INTERACTIVE = $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci
......
......@@ -22,7 +22,7 @@ cabal08: clean
cd p2 && $(SETUP) register
'$(TEST_HC)' $(TEST_HC_OPTS) -package-db tmp1.d -package-db tmp2.d Main.hs
./Main
'$(TEST_HC)' $(TEST_HC_OPTS) -package-db tmp1.d -package-db tmp2.d -hide-all-packages -package base -package p Main.hs
'$(TEST_HC)' $(TEST_HC_OPTS) -fforce-recomp -package-db tmp1.d -package-db tmp2.d -hide-all-packages -package base -package p Main.hs
./Main
ifneq "$(CLEANUP)" ""
$(MAKE) -s --no-print-directory clean
......
......@@ -619,7 +619,7 @@ T10320:
$(RM) -rf T10320 T10320.dump-rule-rewrites T10320.hi T10320.o
"$(TEST_HC)" $(TEST_HC_OPTS) -ddump-to-file -ddump-rule-rewrites -fenable-rewrite-rules T10320.hs
[ -s T10320.dump-rule-rewrites ]
"$(TEST_HC)" $(TEST_HC_OPTS) -ddump-to-file -ddump-rule-rewrites T10320.hs
"$(TEST_HC)" $(TEST_HC_OPTS) -fforce-recomp -ddump-to-file -ddump-rule-rewrites T10320.hs
[ -f T10320.dump-rule-rewrites ] && [ ! -s T10320.dump-rule-rewrites ]
.PHONY: T12135
......
......@@ -418,9 +418,8 @@ test('T8101', expect_broken(10600), compile, ['-Wall -fno-code'])
test('T8101b', expect_broken(10600), multimod_compile,
['T8101b', '-Wall -fno-code'])
def build_T9050(name, way):
return simple_build(name + '.cmm', way, '-outputdir=. ', 0, '', 0, 0, 0)
test('T9050', normal, build_T9050, [])
# Should not panic when compiling cmm file together with -outputdir.
test('T9050', cmm_src, compile, ['-outputdir=.'])
test('write_interface_oneshot',
extra_clean(['write_interface_oneshot_hidir/*']),
......
......@@ -6,7 +6,6 @@ with the following modifiers:
-XNondecreasingIndentation
GHCi-specific dynamic flag settings:
other dynamic, non-language, flag settings:
-fforce-recomp
-fimplicit-import-qualified
-fshow-warning-groups
warning settings:
......
......@@ -9,6 +9,6 @@ clean:
base01:
rm -f GHC/*.o
rm -f GHC/*.hi
'$(TEST_HC)' $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) -XNoImplicitPrelude -this-unit-id base -c GHC/Base.hs
'$(TEST_HC)' $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) -XNoImplicitPrelude -this-unit-id base --make GHC.Foo
'$(TEST_HC)' $(TEST_HC_OPTS) -XNoImplicitPrelude -this-unit-id base -c GHC/Base.hs
'$(TEST_HC)' $(TEST_HC_OPTS) -XNoImplicitPrelude -this-unit-id base --make GHC.Foo
......@@ -20,9 +20,9 @@ T2412:
tc245:
$(RM) -f Tc245_A.hi Tc245_A.o tc245.hi tc245.o
'$(TEST_HC)' $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) --make tc245
'$(TEST_HC)' $(TEST_HC_OPTS) --make tc245
$(RM) -f tc245.hi tc245.o
'$(TEST_HC)' $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) --make tc245
'$(TEST_HC)' $(TEST_HC_OPTS) --make tc245
# Trac #5792 gave an error on the second compilation,
# presumably because of the .hi file
......
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