diff options
author | Thomas Miedema <thomasmiedema@gmail.com> | 2016-06-18 18:58:02 +0200 |
---|---|---|
committer | Thomas Miedema <thomasmiedema@gmail.com> | 2016-06-20 16:22:07 +0200 |
commit | ebaf26b75c6ab3185b6e098e9caf575c03085f82 (patch) | |
tree | 674029f4f51abddc1ca3ca4d9c58a70705ea26bc | |
parent | 135fc86c54626e8fc843eca0a437bee878315949 (diff) | |
download | haskell-ebaf26b75c6ab3185b6e098e9caf575c03085f82.tar.gz |
Testsuite: delete dead code + cleanup
* Set config settings directly in mk/test.mk, instead of indirectly in
config/ghc
* passing --hpcdir for WAY=hpc is unnecessary
-rw-r--r-- | libraries/base/tests/IO/T12010/test.T | 2 | ||||
-rw-r--r-- | testsuite/config/ghc | 64 | ||||
-rw-r--r-- | testsuite/driver/testglobals.py | 7 | ||||
-rw-r--r-- | testsuite/driver/testlib.py | 29 | ||||
-rw-r--r-- | testsuite/driver/testutil.py | 18 | ||||
-rw-r--r-- | testsuite/mk/test.mk | 38 | ||||
-rw-r--r-- | testsuite/tests/ffi/should_run/all.T | 15 | ||||
-rw-r--r-- | testsuite/tests/ghci/scripts/ghci024.stdout | 1 | ||||
-rw-r--r-- | testsuite/tests/hpc/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/numeric/should_run/all.T | 16 | ||||
-rw-r--r-- | testsuite/tests/plugins/all.T | 6 | ||||
-rw-r--r-- | testsuite/tests/th/all.T | 4 |
12 files changed, 55 insertions, 147 deletions
diff --git a/libraries/base/tests/IO/T12010/test.T b/libraries/base/tests/IO/T12010/test.T index b7b64c770c..73dac44c47 100644 --- a/libraries/base/tests/IO/T12010/test.T +++ b/libraries/base/tests/IO/T12010/test.T @@ -3,6 +3,6 @@ test('T12010', extra_files(['cbits/']), only_ways(['threaded1']), extra_ways(['threaded1']), - cmd_prefix('WAY_FLAGS="' + ' '.join(config.way_flags('T12010')['threaded1']) + '"')], + cmd_prefix('WAY_FLAGS="' + ' '.join(config.way_flags['threaded1']) + '"')], run_command, ['$MAKE -s --no-print-directory T12010']) diff --git a/testsuite/config/ghc b/testsuite/config/ghc index cf9a7ba50f..aa6b047f3b 100644 --- a/testsuite/config/ghc +++ b/testsuite/config/ghc @@ -1,5 +1,4 @@ import re -import subprocess # Testsuite configuration setup for GHC # @@ -36,25 +35,13 @@ if (ghc_with_native_codegen == 1): config.compile_ways.append('optasm') config.run_ways.append('optasm') -config.compiler_debugged = ghc_debugged - -if (ghc_with_vanilla == 1): - config.have_vanilla = True - -if (ghc_with_dynamic == 1): - config.have_dynamic = True - -if (ghc_with_profiling == 1): - config.have_profiling = True +if config.have_profiling: config.compile_ways.append('profasm') config.run_ways.append('profasm') -if (ghc_with_interpreter == 1): - config.have_interp = True +if config.have_interp: config.run_ways.append('ghci') -config.unregisterised = (ghc_unregisterised == 1) - if (ghc_with_threaded_rts == 1): config.run_ways.append('threaded1') if (ghc_with_smp == 1): @@ -64,25 +51,20 @@ if (ghc_with_threaded_rts == 1): if (ghc_with_dynamic_rts == 1): config.have_shared_libs = True -config.ghc_dynamic_by_default = ghc_dynamic_by_default -if ghc_dynamic_by_default and ghc_with_vanilla == 1: +if config.ghc_dynamic_by_default and config.have_vanilla == 1: config.run_ways.append('static') else: if (ghc_with_dynamic_rts == 1): config.run_ways.append('dyn') -config.ghc_dynamic = ghc_dynamic - -if (ghc_with_profiling == 1 and ghc_with_threaded_rts == 1): +if (config.have_profiling and ghc_with_threaded_rts == 1): config.run_ways.append('profthreaded') if (ghc_with_llvm == 1): config.compile_ways.append('optllvm') config.run_ways.append('optllvm') -config.in_tree_compiler = in_tree_compiler - -config.way_flags = lambda name : { +config.way_flags = { 'normal' : [], 'normal_h' : [], 'g1' : [], @@ -95,12 +77,12 @@ config.way_flags = lambda name : { 'prof' : ['-prof', '-static', '-fprof-auto', '-fasm'], 'profasm' : ['-O', '-prof', '-static', '-fprof-auto'], 'profthreaded' : ['-O', '-prof', '-static', '-fprof-auto', '-threaded'], - 'ghci' : ['--interactive', '-v0', '-ignore-dot-ghci', '+RTS', '-I0.1', '-RTS'], + 'ghci' : ['--interactive', '-v0', '-ignore-dot-ghci', '-fno-ghci-history', '+RTS', '-I0.1', '-RTS'], 'threaded1' : ['-threaded', '-debug'], 'threaded1_ls' : ['-threaded', '-debug'], 'threaded2' : ['-O', '-threaded', '-eventlog'], 'threaded2_hT' : ['-O', '-threaded'], - 'hpc' : ['-O', '-fhpc', '-hpcdir', '.hpc.' + name ], + 'hpc' : ['-O', '-fhpc'], 'prof_hc_hb' : ['-O', '-prof', '-static', '-fprof-auto'], 'prof_hb' : ['-O', '-prof', '-static', '-fprof-auto'], 'prof_hd' : ['-O', '-prof', '-static', '-fprof-auto'], @@ -113,7 +95,7 @@ config.way_flags = lambda name : { 'profllvm' : ['-prof', '-static', '-fprof-auto', '-fllvm'], 'profoptllvm' : ['-O', '-prof', '-static', '-fprof-auto', '-fllvm'], 'profthreadedllvm' : ['-O', '-prof', '-static', '-fprof-auto', '-threaded', '-fllvm'], - 'ghci-ext' : ['--interactive', '-v0', '-ignore-dot-ghci', '-fexternal-interpreter', '+RTS', '-I0.1', '-RTS'], + 'ghci-ext' : ['--interactive', '-v0', '-ignore-dot-ghci', '-fno-ghci-history', '-fexternal-interpreter', '+RTS', '-I0.1', '-RTS'], } config.way_rts_flags = { @@ -153,16 +135,16 @@ config.way_rts_flags = { # Useful classes of ways that can be used with only_ways(), omit_ways() and # expect_broken_for(). -prof_ways = [x[0] for x in config.way_flags('dummy_name').items() +prof_ways = [x[0] for x in config.way_flags.items() if '-prof' in x[1]] -threaded_ways = [x[0] for x in config.way_flags('dummy_name').items() +threaded_ways = [x[0] for x in config.way_flags.items() if '-threaded' in x[1] or 'ghci' == x[0]] -opt_ways = [x[0] for x in config.way_flags('dummy_name').items() +opt_ways = [x[0] for x in config.way_flags.items() if '-O' in x[1]] -llvm_ways = [x[0] for x in config.way_flags('dummy_name').items() +llvm_ways = [x[0] for x in config.way_flags.items() if '-fflvm' in x[1]] def get_compiler_info(): @@ -176,15 +158,6 @@ def get_compiler_info(): # See Note [Replacing backward slashes in config.libdir]. config.libdir = compilerInfoDict['LibDir'].replace('\\', '/') - v = compilerInfoDict["Project version"] - config.compiler_version = v - config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v) - - # -fno-ghci-history was added in 7.3 - if version_ge(config.compiler_version, '7.3'): - config.compiler_always_flags = \ - config.compiler_always_flags + ['-fno-ghci-history'] - if re.match(".*_p(_.*|$)", rtsInfoDict["RTS way"]): config.compiler_profiled = True else: @@ -195,19 +168,8 @@ def get_compiler_info(): except: config.package_conf_cache_file = '' - try: - if compilerInfoDict["GHC Dynamic"] == "YES": - ghcDynamic = True - elif compilerInfoDict["GHC Dynamic"] == "NO": - ghcDynamic = False - else: - raise 'Bad value for "GHC Dynamic"' - except KeyError: - # GHC < 7.7 doesn't have a "GHC Dynamic" field - ghcDynamic = False - # See Note [WayFlags] - if ghcDynamic: + if config.ghc_dynamic: config.ghc_th_way_flags = "-dynamic" config.ghci_way_flags = "-dynamic" config.plugin_way_flags = "-dynamic" diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index fbe030a07a..23fd2f5d54 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -68,10 +68,6 @@ class TestConfig: # Is self.compiler a stage 1, 2 or 3 compiler? self.stage = 2 - # Compiler version info - self.compiler_version = '' - self.compiler_maj_version = '' - # Flags we always give to this compiler self.compiler_always_flags = [] @@ -190,9 +186,6 @@ class TestOptions: # don't give anything as stdin self.no_stdin = 0 - # compile this test to .hc only - 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. diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index c97ff8a147..4f18c0151f 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -7,7 +7,6 @@ from __future__ import print_function import io import shutil -import sys import os import errno import string @@ -675,7 +674,6 @@ def get_package_cache_timestamp(): except: return 0.0 - def test_common_work (name, opts, func, args): try: t.total_tests = t.total_tests+1 @@ -745,9 +743,12 @@ def test_common_work (name, opts, func, args): files.update((os.path.relpath(f, opts.srcdir) for f in glob.iglob(in_srcdir(filename)))) - else: + elif filename: files.add(filename) + else: + framework_fail(name, 'whole-test', 'extra_file is empty string') + # Run the required tests... for way in do_ways: if stopping(): @@ -766,16 +767,6 @@ def test_common_work (name, opts, func, args): if package_conf_cache_file_start_timestamp != package_conf_cache_file_end_timestamp: framework_fail(name, 'whole-test', 'Package cache timestamps do not match: ' + str(package_conf_cache_file_start_timestamp) + ' ' + str(package_conf_cache_file_end_timestamp)) - try: - for f in files_written[name]: - if os.path.exists(f): - try: - if not f in files_written_not_removed[name]: - files_written_not_removed[name].append(f) - except: - files_written_not_removed[name] = [f] - except: - pass except Exception as e: framework_fail(name, 'runTest', 'Unhandled exception: ' + str(e)) @@ -1009,7 +1000,7 @@ def run_command( name, way, cmd ): def ghci_script( name, way, script): flags = ' '.join(get_compiler_flags()) - way_flags = ' '.join(config.way_flags(name)[way]) + way_flags = ' '.join(config.way_flags[way]) # We pass HC and HC_OPTS as environment variables, so that the # script can invoke the correct compiler by using ':! $HC $HC_OPTS' @@ -1202,21 +1193,17 @@ def simple_build(name, way, extra_hc_opts, should_fail, top_mod, link, addsuf): if top_mod != '': srcname = top_mod - base, suf = os.path.splitext(top_mod) elif addsuf: srcname = add_hs_lhs_suffix(name) else: srcname = name - to_do = '' if top_mod != '': to_do = '--make ' if link: to_do = to_do + '-o ' + name elif link: to_do = '-o ' + name - elif opts.compile_to_hc: - to_do = '-C' else: to_do = '-c' # just compile @@ -1236,7 +1223,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() + config.way_flags(name)[way]) + flags = ' '.join(get_compiler_flags() + config.way_flags[way]) cmd = ('cd "{opts.testdir}" && {cmd_prefix} ' '{{compiler}} {to_do} {srcname} {flags} {extra_hc_opts} ' @@ -1410,7 +1397,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() + config.way_flags(name)[way]) + flags = ' '.join(get_compiler_flags() + config.way_flags[way]) if getTestOpts().combined_output: redirection = ' > {0} 2>&1'.format(outname) @@ -1456,7 +1443,6 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ): else: return failBecause('bad stdout or stderr') - def split_file(in_fn, delimiter, out1_fn, out2_fn): # See Note [Universal newlines]. infile = io.open(in_fn, 'r', encoding='utf8', errors='replace', newline=None) @@ -1998,7 +1984,6 @@ def find_expected_file(name, suff): def cleanup(): shutil.rmtree(getTestOpts().testdir, ignore_errors=True) - # ----------------------------------------------------------------------------- # Return a list of all the files ending in '.T' below directories roots. diff --git a/testsuite/driver/testutil.py b/testsuite/driver/testutil.py index 563ba3646c..2862a44305 100644 --- a/testsuite/driver/testutil.py +++ b/testsuite/driver/testutil.py @@ -1,26 +1,8 @@ -# ----------------------------------------------------------------------------- -# Utils - import errno import os import subprocess import shutil -def version_to_ints(v): - return [ int(x) for x in v.split('.') ] - -def version_lt(x, y): - return version_to_ints(x) < version_to_ints(y) - -def version_le(x, y): - return version_to_ints(x) <= version_to_ints(y) - -def version_gt(x, y): - return version_to_ints(x) > version_to_ints(y) - -def version_ge(x, y): - return version_to_ints(x) >= version_to_ints(y) - def strip_quotes(s): # Don't wrap commands to subprocess.call/Popen in quotes. return s.strip('\'"') diff --git a/testsuite/mk/test.mk b/testsuite/mk/test.mk index 75944eb27b..7defc68372 100644 --- a/testsuite/mk/test.mk +++ b/testsuite/mk/test.mk @@ -36,7 +36,7 @@ endif # in nested Makefiles 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 +TEST_HC_OPTS_INTERACTIVE = $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci -fno-ghci-history ifeq "$(MinGhcVersion711)" "YES" # Don't warn about missing specialisations. They can only occur with `-O`, but @@ -63,7 +63,7 @@ endif RUNTEST_OPTS += -e ghc_compiler_always_flags="'$(TEST_HC_OPTS)'" -RUNTEST_OPTS += -e ghc_debugged=$(GhcDebugged) +RUNTEST_OPTS += -e config.compiler_debugged=$(GhcDebugged) ifeq "$(GhcWithNativeCodeGen)" "YES" RUNTEST_OPTS += -e ghc_with_native_codegen=1 @@ -77,21 +77,21 @@ HAVE_DYNAMIC := $(shell if [ -f $(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappe HAVE_PROFILING := $(shell if [ -f $(subst \,/,$(GHC_PRIM_LIBDIR))/GHC/PrimopWrappers.p_hi ]; then echo YES; else echo NO; fi) ifeq "$(HAVE_VANILLA)" "YES" -RUNTEST_OPTS += -e ghc_with_vanilla=1 +RUNTEST_OPTS += -e config.have_vanilla=True else -RUNTEST_OPTS += -e ghc_with_vanilla=0 +RUNTEST_OPTS += -e config.have_vanilla=False endif ifeq "$(HAVE_DYNAMIC)" "YES" -RUNTEST_OPTS += -e ghc_with_dynamic=1 +RUNTEST_OPTS += -e config.have_dynamic=True else -RUNTEST_OPTS += -e ghc_with_dynamic=0 +RUNTEST_OPTS += -e config.have_dynamic=False endif ifeq "$(HAVE_PROFILING)" "YES" -RUNTEST_OPTS += -e ghc_with_profiling=1 +RUNTEST_OPTS += -e config.have_profiling=True else -RUNTEST_OPTS += -e ghc_with_profiling=0 +RUNTEST_OPTS += -e config.have_profiling=False endif ifeq "$(filter thr, $(GhcRTSWays))" "thr" @@ -107,32 +107,32 @@ RUNTEST_OPTS += -e ghc_with_dynamic_rts=0 endif ifeq "$(GhcWithInterpreter)" "NO" -RUNTEST_OPTS += -e ghc_with_interpreter=0 +RUNTEST_OPTS += -e config.have_interp=False else ifeq "$(GhcStage)" "1" -RUNTEST_OPTS += -e ghc_with_interpreter=0 +RUNTEST_OPTS += -e config.have_interp=False else -RUNTEST_OPTS += -e ghc_with_interpreter=1 +RUNTEST_OPTS += -e config.have_interp=True endif ifeq "$(GhcUnregisterised)" "YES" -RUNTEST_OPTS += -e ghc_unregisterised=1 +RUNTEST_OPTS += -e config.unregisterised=True else -RUNTEST_OPTS += -e ghc_unregisterised=0 +RUNTEST_OPTS += -e config.unregisterised=False endif ifeq "$(GhcDynamicByDefault)" "YES" -RUNTEST_OPTS += -e ghc_dynamic_by_default=True +RUNTEST_OPTS += -e config.ghc_dynamic_by_default=True CABAL_MINIMAL_BUILD = --enable-shared --disable-library-vanilla else -RUNTEST_OPTS += -e ghc_dynamic_by_default=False +RUNTEST_OPTS += -e config.ghc_dynamic_by_default=False CABAL_MINIMAL_BUILD = --enable-library-vanilla --disable-shared endif ifeq "$(GhcDynamic)" "YES" -RUNTEST_OPTS += -e ghc_dynamic=True +RUNTEST_OPTS += -e config.ghc_dynamic=True CABAL_PLUGIN_BUILD = --enable-shared --disable-library-vanilla else -RUNTEST_OPTS += -e ghc_dynamic=False +RUNTEST_OPTS += -e config.ghc_dynamic=False CABAL_PLUGIN_BUILD = --enable-library-vanilla --disable-shared endif @@ -166,9 +166,9 @@ RUNTEST_OPTS += -e darwin=False endif ifeq "$(IN_TREE_COMPILER)" "YES" -RUNTEST_OPTS += -e in_tree_compiler=True +RUNTEST_OPTS += -e config.in_tree_compiler=True else -RUNTEST_OPTS += -e in_tree_compiler=False +RUNTEST_OPTS += -e config.in_tree_compiler=False endif ifneq "$(THREADS)" "" diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T index bf9fefdcba..2b35a0fa63 100644 --- a/testsuite/tests/ffi/should_run/all.T +++ b/testsuite/tests/ffi/should_run/all.T @@ -47,17 +47,12 @@ test('ffi007', omit_ways(['ghci']), compile_and_run, ['']) test('ffi008', [exit_code(1), omit_ways(['ghci'])], compile_and_run, ['']) # On i386, we need -msse2 to get reliable floating point results -maybe_skip = normal -opts = '' if config.platform.startswith('i386-'): - if version_ge(config.compiler_version, '6.13'): - opts = '-msse2' - else: - maybe_skip = only_ways(['ghci']) - -test('ffi009', [when(fast(), skip), - reqlib('random'), - maybe_skip] ,compile_and_run, [opts]) + opts = '-msse2' +else: + opts = '' + +test('ffi009', [when(fast(), skip), reqlib('random')], compile_and_run, [opts]) test('ffi010', normal, compile_and_run, ['']) test('ffi011', normal, compile_and_run, ['']) diff --git a/testsuite/tests/ghci/scripts/ghci024.stdout b/testsuite/tests/ghci/scripts/ghci024.stdout index 4bbb556536..e224d806c7 100644 --- a/testsuite/tests/ghci/scripts/ghci024.stdout +++ b/testsuite/tests/ghci/scripts/ghci024.stdout @@ -6,6 +6,7 @@ with the following modifiers: -XNondecreasingIndentation GHCi-specific dynamic flag settings: other dynamic, non-language, flag settings: + -fno-ghci-history -fimplicit-import-qualified -fshow-warning-groups warning settings: diff --git a/testsuite/tests/hpc/all.T b/testsuite/tests/hpc/all.T index 6757338274..5653fe49eb 100644 --- a/testsuite/tests/hpc/all.T +++ b/testsuite/tests/hpc/all.T @@ -13,7 +13,7 @@ setTestOpts(only_ways(['hpc'])) def T2991(cmd): # The .mix file for the literate module should have non-zero entries. # The `grep` should exit with exit code 0. - return(cmd + " && grep -q cover_me .hpc.T2991/T2991LiterateModule.mix") + return(cmd + " && grep -q cover_me .hpc/T2991LiterateModule.mix") test('T2991', [cmd_wrapper(T2991), extra_clean(['T2991LiterateModule.hi', 'T2991LiterateModule.o'])], # Run with 'ghc --main'. Do not list other modules explicitly. diff --git a/testsuite/tests/numeric/should_run/all.T b/testsuite/tests/numeric/should_run/all.T index d1f05fd220..a7c7c84d1c 100644 --- a/testsuite/tests/numeric/should_run/all.T +++ b/testsuite/tests/numeric/should_run/all.T @@ -12,21 +12,17 @@ test('arith006', normal, compile_and_run, ['']) test('arith007', normal, compile_and_run, ['']) # On i386, we need -msse2 to get reliable floating point results -ways = normal -opts = '' -if config.platform.startswith('i386-'): - if version_ge(config.compiler_version, '6.13'): - opts = '-msse2' - else: - ways = expect_fail_for(['optasm','threaded2','hpc','dyn','profasm']) - -test('arith008', ways, compile_and_run, [opts]) +if config.arch == 'i386': + opts = '-msse2' +else: + opts = '' +test('arith008', normal, compile_and_run, [opts]) test('arith009', normal, compile_and_run, ['']) test('arith010', normal, compile_and_run, ['']) test('arith011', normal, compile_and_run, ['']) -test('arith012', ways, compile_and_run, [opts]) +test('arith012', normal, compile_and_run, [opts]) test('arith013', normal, compile_and_run, ['']) test('arith014', normal, compile_and_run, ['']) diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T index caa831efc6..f165c4a402 100644 --- a/testsuite/tests/plugins/all.T +++ b/testsuite/tests/plugins/all.T @@ -1,8 +1,4 @@ -def f(name, opts): - if (ghc_with_interpreter == 0): - opts.skip = 1 - -setTestOpts(f) +setTestOpts(req_interp) test('plugins01', [pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins01 TOP={top}'), diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index bd59c4ee30..aa87241443 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -6,10 +6,8 @@ def f(name, opts): opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell' - if (ghc_with_interpreter == 0): - opts.skip = 1 - setTestOpts(f) +setTestOpts(req_interp) setTestOpts(only_ways(['normal','ghci'])) test('TH_mkName', normal, compile, ['-v0']) |