diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2013-02-08 12:34:14 +0000 |
---|---|---|
committer | Simon Peyton Jones <simonpj@microsoft.com> | 2013-02-08 12:34:14 +0000 |
commit | 65b9cf744afb4e4d0020a177d87c9cd96162cc54 (patch) | |
tree | c2aec3e0bba44bbdd3d900eabea18b960a6f8633 /testsuite | |
parent | 512af3bf6f0b95c85c7558926a1e67bf2416ef7a (diff) | |
parent | d34f3e856b90de8e9ebbe14828c26ceb3c80ebdb (diff) | |
download | haskell-65b9cf744afb4e4d0020a177d87c9cd96162cc54.tar.gz |
Merge branch 'master' of http://darcs.haskell.org/testsuite
Diffstat (limited to 'testsuite')
67 files changed, 639 insertions, 536 deletions
diff --git a/testsuite/driver/runtests.py b/testsuite/driver/runtests.py index 66e3bf4d5e..04d69b734a 100644 --- a/testsuite/driver/runtests.py +++ b/testsuite/driver/runtests.py @@ -207,9 +207,6 @@ if windows or darwin: global testopts_local testopts_local.x = TestOptions() -global thisdir_testopts -thisdir_testopts = getThisDirTestOpts() - if config.use_threads: t.lock = threading.Lock() t.thread_pool = threading.Condition(t.lock) @@ -261,6 +258,8 @@ for file in t_files: if config.use_threads: t.running_threads=0 for oneTest in parallelTests: + if stopping(): + break oneTest() if config.use_threads: t.thread_pool.acquire() @@ -269,6 +268,8 @@ if config.use_threads: t.thread_pool.release() config.use_threads = False for oneTest in aloneTests: + if stopping(): + break oneTest() summary(t, sys.stdout) diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py index 500e7f4014..db99ef1b2e 100644 --- a/testsuite/driver/testglobals.py +++ b/testsuite/driver/testglobals.py @@ -214,17 +214,6 @@ class TestOptions: self.compiler_stats_range_fields = {} self.stats_range_fields = {} - # TODO: deprecate this in favour of compiler_stats_range_fields - # - # which -t numeric fields do we want to look at, and what bounds must - # they fall within? - # Elements of these lists should be things like - # ('bytes allocated', - # 9300000000, - # 9400000000) - self.compiler_stats_num_fields = {} - self.stats_num_fields = {} - # should we run this test alone, i.e. not run it in parallel with # any other threads self.alone = False diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py index 40ecf86d67..4c9b2c269e 100644 --- a/testsuite/driver/testlib.py +++ b/testsuite/driver/testlib.py @@ -15,7 +15,7 @@ import traceback import copy import glob import types -import math +from math import ceil, trunc have_subprocess = False try: @@ -32,15 +32,13 @@ if config.use_threads: import threading import thread -# Options valid for all the tests in the current "directory". After -# each test, we reset the options to these. To change the options for -# multiple tests, the function setTestOpts() below can be used to alter -# these options. -global thisdir_testopts -thisdir_testopts = TestOptions() - -def getThisDirTestOpts(): - return thisdir_testopts +global wantToStop +wantToStop = False +def stopNow(): + global wantToStop + wantToStop = True +def stopping(): + return wantToStop # Options valid for the current test only (these get reset to # testdir_testopts after each test). @@ -63,7 +61,8 @@ def setLocalTestOpts(opts): # This can be called at the top of a file of tests, to set default test options # for the following tests. def setTestOpts( f ): - f( thisdir_testopts ); + global thisdir_settings + thisdir_settings = compose(thisdir_settings, f) # ----------------------------------------------------------------------------- # Canned setup functions for common cases. eg. for a test you might say @@ -76,23 +75,23 @@ def setTestOpts( f ): # # to expect failure for this test. -def normal( opts ): +def normal( name, opts ): return; -def skip( opts ): +def skip( name, opts ): opts.skip = 1 -def expect_fail( opts ): +def expect_fail( name, opts ): opts.expect = 'fail'; def reqlib( lib ): - return lambda opts, l=lib: _reqlib (opts, l ) + return lambda name, opts, l=lib: _reqlib (name, opts, l ) # Cache the results of looking to see if we have a library or not. # This makes quite a difference, especially on Windows. have_lib = {} -def _reqlib( opts, lib ): +def _reqlib( name, opts, lib ): if have_lib.has_key(lib): got_it = have_lib[lib] else: @@ -115,191 +114,204 @@ def _reqlib( opts, lib ): if not got_it: opts.expect = 'missing-lib' -def req_profiling( opts ): +def req_profiling( name, opts ): if not config.have_profiling: opts.expect = 'fail' -def req_shared_libs( opts ): +def req_shared_libs( name, opts ): if not config.have_shared_libs: opts.expect = 'fail' -def req_interp( opts ): +def req_interp( name, opts ): if not config.have_interp: opts.expect = 'fail' -def req_smp( opts ): +def req_smp( name, opts ): if not config.have_smp: opts.expect = 'fail' def expect_broken( bug ): - return lambda opts, b=bug: _expect_broken (opts, b ) + return lambda name, opts, b=bug: _expect_broken (name, opts, b ) -def _expect_broken( opts, bug ): +def _expect_broken( name, opts, bug ): opts.expect = 'fail'; -def ignore_output( opts ): +def ignore_output( name, opts ): opts.ignore_output = 1 -def no_stdin( opts ): +def no_stdin( name, opts ): opts.no_stdin = 1 -def combined_output( opts ): +def combined_output( name, opts ): opts.combined_output = True # ----- def expect_fail_for( ways ): - return lambda opts, w=ways: _expect_fail_for( opts, w ) + return lambda name, opts, w=ways: _expect_fail_for( name, opts, w ) -def _expect_fail_for( opts, ways ): +def _expect_fail_for( name, opts, ways ): opts.expect_fail_for = ways def expect_broken_for( bug, ways ): - return lambda opts, b=bug, w=ways: _expect_broken_for( opts, b, w ) + return lambda name, opts, b=bug, w=ways: _expect_broken_for( name, opts, b, w ) -def _expect_broken_for( opts, bug, ways ): +def _expect_broken_for( name, opts, bug, ways ): opts.expect_fail_for = ways # ----- def omit_ways( ways ): - return lambda opts, w=ways: _omit_ways( opts, w ) + return lambda name, opts, w=ways: _omit_ways( name, opts, w ) -def _omit_ways( opts, ways ): +def _omit_ways( name, opts, ways ): opts.omit_ways = ways # ----- def only_ways( ways ): - return lambda opts, w=ways: _only_ways( opts, w ) + return lambda name, opts, w=ways: _only_ways( name, opts, w ) -def _only_ways( opts, ways ): +def _only_ways( name, opts, ways ): opts.only_ways = ways # ----- def extra_ways( ways ): - return lambda opts, w=ways: _extra_ways( opts, w ) + return lambda name, opts, w=ways: _extra_ways( name, opts, w ) -def _extra_ways( opts, ways ): +def _extra_ways( name, opts, ways ): opts.extra_ways = ways # ----- def omit_compiler_types( compiler_types ): - return lambda opts, c=compiler_types: _omit_compiler_types(opts, c) + return lambda name, opts, c=compiler_types: _omit_compiler_types(name, opts, c) -def _omit_compiler_types( opts, compiler_types ): +def _omit_compiler_types( name, opts, compiler_types ): if config.compiler_type in compiler_types: opts.skip = 1 # ----- def only_compiler_types( compiler_types ): - return lambda opts, c=compiler_types: _only_compiler_types(opts, c) + return lambda name, opts, c=compiler_types: _only_compiler_types(name, opts, c) -def _only_compiler_types( opts, compiler_types ): +def _only_compiler_types( name, opts, compiler_types ): if config.compiler_type not in compiler_types: opts.skip = 1 # ----- def set_stdin( file ): - return lambda opts, f=file: _set_stdin(opts, f); + return lambda name, opts, f=file: _set_stdin(name, opts, f); -def _set_stdin( opts, f ): +def _set_stdin( name, opts, f ): opts.stdin = f # ----- def exit_code( val ): - return lambda opts, v=val: _exit_code(opts, v); + return lambda name, opts, v=val: _exit_code(name, opts, v); -def _exit_code( opts, v ): +def _exit_code( name, opts, v ): opts.exit_code = v # ----- def timeout_multiplier( val ): - return lambda opts, v=val: _timeout_multiplier(opts, v) + return lambda name, opts, v=val: _timeout_multiplier(name, opts, v) -def _timeout_multiplier( opts, v ): +def _timeout_multiplier( name, opts, v ): opts.timeout_multiplier = v # ----- def extra_run_opts( val ): - return lambda opts, v=val: _extra_run_opts(opts, v); + return lambda name, opts, v=val: _extra_run_opts(name, opts, v); -def _extra_run_opts( opts, v ): +def _extra_run_opts( name, opts, v ): opts.extra_run_opts = v # ----- def extra_hc_opts( val ): - return lambda opts, v=val: _extra_hc_opts(opts, v); + return lambda name, opts, v=val: _extra_hc_opts(name, opts, v); -def _extra_hc_opts( opts, v ): +def _extra_hc_opts( name, opts, v ): opts.extra_hc_opts = v # ----- def extra_clean( files ): - return lambda opts, v=files: _extra_clean(opts, v); + return lambda name, opts, v=files: _extra_clean(name, opts, v); -def _extra_clean( opts, v ): +def _extra_clean( name, opts, v ): opts.clean_files = v # ----- -def stats_num_field( field, min, max ): - return lambda opts, f=field, x=min, y=max: _stats_num_field(opts, f, x, y); +def stats_num_field( field, expecteds ): + return lambda name, opts, f=field, e=expecteds: _stats_num_field(name, opts, f, e); + +def _stats_num_field( name, opts, field, expecteds ): + if field in opts.stats_range_fields: + framework_fail(name, 'duplicate-numfield', 'Duplicate ' + field + ' num_field check') -def _stats_num_field( opts, f, x, y ): - # copy the dictionary, as the config gets shared between all tests - opts.stats_num_fields = opts.stats_num_fields.copy() - opts.stats_num_fields[f] = (x, y) + if type(expecteds) is types.ListType: + for (b, expected, dev) in expecteds: + if b: + opts.stats_range_fields[field] = (expected, dev) + return + framework_fail(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') -def compiler_stats_num_field( field, min, max ): - return lambda opts, f=field, x=min, y=max: _compiler_stats_num_field(opts, f, x, y); + else: + (expected, dev) = expecteds + opts.stats_range_fields[field] = (expected, dev) -def _compiler_stats_num_field( opts, f, x, y ): - # copy the dictionary, as the config gets shared between all tests - opts.compiler_stats_num_fields = opts.compiler_stats_num_fields.copy() - opts.compiler_stats_num_fields[f] = (x, y) +def stats_range_field( field, expected, dev ): + return stats_num_field( field, [(True, expected, dev)] ) -# ----- +def compiler_stats_num_field( field, expecteds ): + return lambda name, opts, f=field, e=expecteds: _compiler_stats_num_field(name, opts, f, e); -def stats_range_field( field, min, max ): - return lambda opts, f=field, x=min, y=max: _stats_range_field(opts, f, x, y); +def _compiler_stats_num_field( name, opts, field, expecteds ): + if field in opts.compiler_stats_range_fields: + framework_fail(name, 'duplicate-numfield', 'Duplicate ' + field + ' num_field check') -def _stats_range_field( opts, f, x, y ): - # copy the dictionary, as the config gets shared between all tests - opts.stats_range_fields = opts.stats_range_fields.copy() - opts.stats_range_fields[f] = (x, y) + for (b, expected, dev) in expecteds: + if b: + opts.compiler_stats_range_fields[field] = (expected, dev) + return -def compiler_stats_range_field( field, min, max ): - return lambda opts, f=field, x=min, y=max: _compiler_stats_range_field(opts, f, x, y); + framework_fail(name, 'numfield-no-expected', 'No expected value found for ' + field + ' in num_field check') -def _compiler_stats_range_field( opts, f, x, y ): - # copy the dictionary, as the config gets shared between all tests - opts.compiler_stats_range_fields = opts.compiler_stats_range_fields.copy() - opts.compiler_stats_range_fields[f] = (x, y) +def compiler_stats_range_field( field, expected, dev ): + return compiler_stats_num_field( field, [(True, expected, dev)] ) # ----- -def skip_if_no_ghci(opts): +def skip_if_no_ghci(name, opts): if not ('ghci' in config.run_ways): opts.skip = 1 # ---- -def skip_if_fast(opts): +def skip_if_fast(name, opts): if config.fast: opts.skip = 1 # ----- +def when(b, f): + if b: + return f + else: + return normal + +def unless(b, f): + return when(not b, f) + def if_platform( plat, f ): if config.platform == plat: return f @@ -336,17 +348,8 @@ def unless_arch( arch, f ): else: return f -def if_wordsize( ws, f ): - if config.wordsize == str(ws): - return f - else: - return normal - -def unless_wordsize( ws, f ): - if config.wordsize == str(ws): - return normal - else: - return f +def wordsize( ws ): + return config.wordsize == str(ws) def if_unregisterised( f ): if config.unregisterised: @@ -501,89 +504,89 @@ def unless_tag( tag, f ): return normal # --- -def high_memory_usage(opts): +def high_memory_usage(name, opts): opts.alone = True # --- -def literate( opts ): +def literate( name, opts ): opts.literate = 1; -def c_src( opts ): +def c_src( name, opts ): opts.c_src = 1; -def objc_src( opts ): +def objc_src( name, opts ): opts.objc_src = 1; -def objcpp_src( opts ): +def objcpp_src( name, opts ): opts.objcpp_src = 1; -def cmm_src( opts ): +def cmm_src( name, opts ): opts.cmm_src = 1; def outputdir( odir ): - return lambda opts, d=odir: _outputdir(opts, d) + return lambda name, opts, d=odir: _outputdir(name, opts, d) -def _outputdir( opts, odir ): +def _outputdir( name, opts, odir ): opts.outputdir = odir; # ---- def pre_cmd( cmd ): - return lambda opts, c=cmd: _pre_cmd(opts, cmd) + return lambda name, opts, c=cmd: _pre_cmd(name, opts, cmd) -def _pre_cmd( opts, cmd ): +def _pre_cmd( name, opts, cmd ): opts.pre_cmd = cmd # ---- def clean_cmd( cmd ): - return lambda opts, c=cmd: _clean_cmd(opts, cmd) + return lambda name, opts, c=cmd: _clean_cmd(name, opts, cmd) -def _clean_cmd( opts, cmd ): +def _clean_cmd( name, opts, cmd ): opts.clean_cmd = cmd # ---- def cmd_prefix( prefix ): - return lambda opts, p=prefix: _cmd_prefix(opts, prefix) + return lambda name, opts, p=prefix: _cmd_prefix(name, opts, prefix) -def _cmd_prefix( opts, prefix ): +def _cmd_prefix( name, opts, prefix ): opts.cmd_wrapper = lambda cmd, p=prefix: p + ' ' + cmd; # ---- def cmd_wrapper( fun ): - return lambda opts, f=fun: _cmd_wrapper(opts, fun) + return lambda name, opts, f=fun: _cmd_wrapper(name, opts, fun) -def _cmd_wrapper( opts, fun ): +def _cmd_wrapper( name, opts, fun ): opts.cmd_wrapper = fun # ---- def compile_cmd_prefix( prefix ): - return lambda opts, p=prefix: _compile_cmd_prefix(opts, prefix) + return lambda name, opts, p=prefix: _compile_cmd_prefix(name, opts, prefix) -def _compile_cmd_prefix( opts, prefix ): +def _compile_cmd_prefix( name, opts, prefix ): opts.compile_cmd_prefix = prefix # ---- -def normalise_slashes( opts ): +def normalise_slashes( name, opts ): opts.extra_normaliser = normalise_slashes_ -def normalise_exe( opts ): +def normalise_exe( name, opts ): opts.extra_normaliser = normalise_exe_ def normalise_fun( fun ): - return lambda opts, f=fun: _normalise_fun(opts, f) + return lambda name, opts, f=fun: _normalise_fun(name, opts, f) -def _normalise_fun( opts, f ): +def _normalise_fun( name, opts, f ): opts.extra_normaliser = f def normalise_errmsg_fun( fun ): - return lambda opts, f=fun: _normalise_errmsg_fun(opts, f) + return lambda name, opts, f=fun: _normalise_errmsg_fun(name, opts, f) -def _normalise_errmsg_fun( opts, f ): +def _normalise_errmsg_fun( name, opts, f ): opts.extra_errmsg_normaliser = f def two_normalisers(f, g): @@ -596,21 +599,23 @@ def composes( fs ): return reduce(lambda f, g: compose(f, g), fs) def compose( f, g ): - return lambda opts, f=f, g=g: _compose(opts,f,g) + return lambda name, opts, f=f, g=g: _compose(name, opts, f, g) -def _compose( opts, f, g ): - f(opts) - g(opts) +def _compose( name, opts, f, g ): + f(name, opts) + g(name, opts) # ----------------------------------------------------------------------------- # The current directory of tests def newTestDir( dir ): - global thisdir_testopts + global thisdir_settings # reset the options for this test directory - thisdir_testopts = copy.copy(default_testopts) - thisdir_testopts.testdir = dir - thisdir_testopts.compiler_always_flags = config.compiler_always_flags + thisdir_settings = lambda name, opts, dir=dir: _newTestDir( name, opts, dir ) + +def _newTestDir( name, opts, dir ): + opts.testdir = dir + opts.compiler_always_flags = config.compiler_always_flags # ----------------------------------------------------------------------------- # Actually doing tests @@ -643,16 +648,22 @@ def test (name, setup, func, args): global aloneTests global parallelTests global allTestNames + global thisdir_settings if name in allTestNames: framework_fail(name, 'duplicate', 'There are multiple tests with this name') if not re.match('^[0-9]*[a-zA-Z][a-zA-Z0-9._-]*$', name): framework_fail(name, 'bad_name', 'This test has an invalid name') - myTestOpts = copy.copy(thisdir_testopts) + + # Make a deep copy of the default_testopts, as we need our own copy + # of any dictionaries etc inside it. Otherwise, if one test modifies + # them, all tests will see the modified version! + myTestOpts = copy.deepcopy(default_testopts) if type(setup) is types.ListType: setup = composes(setup) - setup(myTestOpts) + setup = compose(thisdir_settings, setup) + setup(name, myTestOpts) thisTest = lambda : runTest(myTestOpts, name, func, args) if myTestOpts.alone: @@ -726,6 +737,8 @@ def test_common_work (name, opts, func, args): if not config.clean_only: # Run the required tests... for way in do_ways: + if stopping(): + break do_test (name, way, func, args) for way in all_ways: @@ -888,7 +901,7 @@ def do_test(name, way, func, args): else: framework_fail(name, way, 'bad result ' + passFail) except KeyboardInterrupt: - raise + stopNow() except: framework_fail(name, way, 'do_test exception') traceback.print_exc() @@ -1111,15 +1124,14 @@ def multi_compile_and_run( name, way, top_mod, extra_mods, extra_hc_opts ): def stats( name, way, stats_file ): opts = getTestOpts() - return checkStats(stats_file, opts.stats_range_fields - , opts.stats_num_fields) + return checkStats(stats_file, opts.stats_range_fields) # ----------------------------------------------------------------------------- # Check -t stats info -def checkStats(stats_file, range_fields, num_fields): +def checkStats(stats_file, range_fields): result = passed() - if len(num_fields) + len(range_fields) > 0: + if len(range_fields) > 0: f = open(in_testdir(stats_file)) contents = f.read() f.close() @@ -1131,36 +1143,31 @@ def checkStats(stats_file, range_fields, num_fields): result = failBecause('no such stats field') val = int(m.group(1)) - min = expected * ((100 - float(dev))/100); - max = expected * ((100 + float(dev))/100); + lowerBound = trunc( expected * ((100 - float(dev))/100)); + upperBound = trunc(0.5 + ceil(expected * ((100 + float(dev))/100))); - if val < min: - print field, val, 'is more than ' + repr(dev) + '%' - print 'less than the exepected value', expected - print 'If this is because you have improved GHC, please' - print 'update the test so that GHC doesn\'t regress again' + if val < lowerBound: + print field, 'value is too low:' + print '(If this is because you have improved GHC, please' + print 'update the test so that GHC doesn\'t regress again)' result = failBecause('stat too good') - if val > max: - print field, val, 'is more than ' + repr(dev) + '% greater than the expected value,', expected, max - result = failBecause('stat not good enough') - - # ToDo: remove all uses of this, and delete it - for (field, (min, max)) in num_fields.items(): - m = re.search('\("' + field + '", "([0-9]+)"\)', contents) - if m == None: - print 'Failed to find field: ', field - result = failBecause('no such stats field') - val = int(m.group(1)) - - if val < min: - print field, val, 'is less than minimum allowed', min - print 'If this is because you have improved GHC, please' - print 'update the test so that GHC doesn\'t regress again' - result = failBecause('stat too good') - if val > max: - print field, val, 'is more than maximum allowed', max + if val > upperBound: + print field, 'value is too high:' result = failBecause('stat not good enough') + if val < lowerBound or val > upperBound: + valStr = str(val) + valLen = len(valStr) + expectedStr = str(expected) + expectedLen = len(expectedStr) + length = max(map (lambda x : len(str(x)), [expected, lowerBound, upperBound, val])) + def display(descr, val, extra): + print descr, string.rjust(str(val), length), extra + display(' Expected ' + field + ':', expected, '+/-' + str(dev) + '%') + display(' Lower bound ' + field + ':', lowerBound, '') + display(' Upper bound ' + field + ':', upperBound, '') + display(' Actual ' + field + ':', val, '') + return result # ----------------------------------------------------------------------------- @@ -1211,7 +1218,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, to_do = '-c' # just compile stats_file = name + '.comp.stats' - if len(opts.compiler_stats_num_fields) + len(opts.compiler_stats_range_fields) > 0: + if len(opts.compiler_stats_range_fields) > 0: extra_hc_opts += ' +RTS -V0 -t' + stats_file + ' --machine-readable -RTS' # Required by GHC 7.3+, harmless for earlier versions: @@ -1250,8 +1257,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, # ToDo: if the sub-shell was killed by ^C, then exit - statsResult = checkStats(stats_file, opts.compiler_stats_range_fields - , opts.compiler_stats_num_fields) + statsResult = checkStats(stats_file, opts.compiler_stats_range_fields) if badResult(statsResult): return statsResult @@ -1297,7 +1303,7 @@ def simple_run( name, way, prog, args ): my_rts_flags = rts_flags(way) stats_file = name + '.stats' - if len(opts.stats_num_fields) + len(opts.stats_range_fields) > 0: + if len(opts.stats_range_fields) > 0: args += ' +RTS -V0 -t' + stats_file + ' --machine-readable -RTS' if opts.no_stdin: @@ -1351,8 +1357,7 @@ def simple_run( name, way, prog, args ): if check_prof and not check_prof_ok(name): return failBecause('bad profile') - return checkStats(stats_file, opts.stats_range_fields - , opts.stats_num_fields) + return checkStats(stats_file, opts.stats_range_fields) def rts_flags(way): if (way == ''): @@ -1615,7 +1620,7 @@ def check_stderr_ok( name ): return normalise_errmsg(str) return compare_outputs('stderr', \ - two_normalisers(norm, getTestOpts().extra_normaliser), \ + two_normalisers(norm, getTestOpts().extra_errmsg_normaliser), \ expected_stderr_file, actual_stderr_file) def dump_stderr( name ): @@ -1861,6 +1866,15 @@ def rawSystem(cmd_and_args): else: return os.spawnv(os.P_WAIT, cmd_and_args[0], cmd_and_args) +# Note that this doesn't handle the timeout itself; it is just used for +# commands that have timeout handling built-in. +def rawSystemWithTimeout(cmd_and_args): + r = rawSystem(cmd_and_args) + if r == 98: + # The python timeout program uses 98 to signal that ^C was pressed + stopNow() + return r + # cmd is a complex command in Bourne-shell syntax # e.g (cd . && 'c:/users/simonpj/darcs/HEAD/compiler/stage1/ghc-inplace' ...etc) # Hence it must ultimately be run by a Bourne shell @@ -1880,7 +1894,7 @@ def runCmd( cmd ): assert config.timeout_prog!='' if config.timeout_prog != '': - r = rawSystem([config.timeout_prog, str(config.timeout), cmd]) + r = rawSystemWithTimeout([config.timeout_prog, str(config.timeout), cmd]) else: r = os.system(cmd) return r << 8 @@ -1891,18 +1905,19 @@ def runCmdFor( name, cmd, timeout_multiplier=1.0 ): if config.os == 'mingw32': # On MinGW, we will always have timeout assert config.timeout_prog!='' - timeout = int(math.ceil(config.timeout * timeout_multiplier)) + timeout = int(ceil(config.timeout * timeout_multiplier)) if config.timeout_prog != '': if config.check_files_written: fn = name + ".strace" - r = rawSystem(["strace", "-o", fn, "-fF", "-e", "creat,open,chdir,clone,vfork", - config.timeout_prog, str(timeout), - cmd]) + r = rawSystemWithTimeout( + ["strace", "-o", fn, "-fF", + "-e", "creat,open,chdir,clone,vfork", + config.timeout_prog, str(timeout), cmd]) addTestFilesWritten(name, fn) rm_no_fail(fn) else: - r = rawSystem([config.timeout_prog, str(timeout), cmd]) + r = rawSystemWithTimeout([config.timeout_prog, str(timeout), cmd]) else: r = os.system(cmd) return r << 8 @@ -2216,6 +2231,7 @@ def findTFiles_(path): def summary(t, file): file.write('\n') + printUnexpectedTests(file, [t.unexpected_passes, t.unexpected_failures]) file.write('OVERALL SUMMARY for test run started at ' \ + t.start_time + '\n'\ + string.rjust(`t.total_tests`, 8) \ @@ -2249,6 +2265,21 @@ def summary(t, file): if config.check_files_written: checkForFilesWrittenProblems(file) + if stopping(): + file.write('WARNING: Testsuite run was terminated early\n') + +def printUnexpectedTests(file, testInfoss): + unexpected = [] + for testInfos in testInfoss: + directories = testInfos.keys() + for directory in directories: + tests = testInfos[directory].keys() + unexpected += tests + if unexpected != []: + file.write('Unexpected results from:\n') + file.write('TEST="' + ' '.join(unexpected) + '"\n') + file.write('\n') + def printPassingTestInfosSummary(file, testInfos): directories = testInfos.keys() directories.sort() diff --git a/testsuite/tests/annotations/should_run/all.T b/testsuite/tests/annotations/should_run/all.T index 22256b2f85..871b409164 100644 --- a/testsuite/tests/annotations/should_run/all.T +++ b/testsuite/tests/annotations/should_run/all.T @@ -10,7 +10,7 @@ test('annrun01', [extra_clean(['Annrun01_Help.hi', 'Annrun01_Help.o', 'annrun01.hi', 'annrun01.o', 'Config.hs', 'Config.hi', 'Config.o']), - pre_cmd('$MAKE -s config'), + pre_cmd('$MAKE -s --no-print-directory config'), omit_ways(['profasm','profthreaded', 'dyn'])], multimod_compile_and_run, ['annrun01', '-package ghc'] diff --git a/testsuite/tests/cabal/all.T b/testsuite/tests/cabal/all.T index 04e918d23a..d05d05fe1e 100644 --- a/testsuite/tests/cabal/all.T +++ b/testsuite/tests/cabal/all.T @@ -16,7 +16,7 @@ test('ghcpkg02', test('ghcpkg03', [extra_clean(['local03.package.conf', 'local03.package.conf.old']), - normalise_fun(normaliseDynlibNames)], + normalise_errmsg_fun(normaliseDynlibNames)], run_command, ['$MAKE -s --no-print-directory ghcpkg03']) test('ghcpkg04', @@ -36,8 +36,8 @@ test('ghcpkg05', 'local05a.package.conf.old', 'local05b.package.conf', 'local05b.package.conf.old']), - normalise_fun(two_normalisers(normalise_haddock_junk, - normaliseDynlibNames)) + normalise_errmsg_fun(two_normalisers(normalise_haddock_junk, + normaliseDynlibNames)) ], run_command, ['$MAKE -s --no-print-directory ghcpkg05']) diff --git a/testsuite/tests/cabal/cabal01/all.T b/testsuite/tests/cabal/cabal01/all.T index 2c64449c9c..f8873230b2 100644 --- a/testsuite/tests/cabal/cabal01/all.T +++ b/testsuite/tests/cabal/cabal01/all.T @@ -20,7 +20,10 @@ if default_testopts.cleanup != '': else: cleanup = '' +def ignoreLdOutput(str): + return re.sub('Creating library file: dist.build.libHStest-1.0-ghc[0-9.]*.dll.a\n', '', str) + test('cabal01', - normal, + normalise_errmsg_fun(ignoreLdOutput), run_command, ['$MAKE -s --no-print-directory cabal01 VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn + ' ' + cleanup]) diff --git a/testsuite/tests/codeGen/should_run/all.T b/testsuite/tests/codeGen/should_run/all.T index b12c30b8f7..77224a2e15 100644 --- a/testsuite/tests/codeGen/should_run/all.T +++ b/testsuite/tests/codeGen/should_run/all.T @@ -100,8 +100,8 @@ test('T7319', [ extra_ways(['prof']), only_ways(['prof']), exit_code(1), req_profiling, extra_hc_opts('-fprof-auto'), extra_run_opts('+RTS -xc') ], compile_and_run, ['']) -test('Word2Float32', unless_wordsize(32, skip), compile_and_run, ['']) -test('Word2Float64', unless_wordsize(64, skip), compile_and_run, ['']) +test('Word2Float32', unless(wordsize(32), skip), compile_and_run, ['']) +test('Word2Float64', unless(wordsize(64), skip), compile_and_run, ['']) test('T7361', normal, compile_and_run, ['']) test('T7600', normal, compile_and_run, ['']) diff --git a/testsuite/tests/codeGen/should_run/cgrun055.hs b/testsuite/tests/codeGen/should_run/cgrun055.hs index 737632748d..f824e1b9f6 100644 --- a/testsuite/tests/codeGen/should_run/cgrun055.hs +++ b/testsuite/tests/codeGen/should_run/cgrun055.hs @@ -1,4 +1,4 @@ --- This program broke GHC 6.3, becuase dataToTag was called with +-- This program broke GHC 6.3, because dataToTag was called with -- an unevaluated argument module Main where diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T index 356cdbc6bb..97dc4b13a1 100644 --- a/testsuite/tests/concurrent/should_run/all.T +++ b/testsuite/tests/concurrent/should_run/all.T @@ -77,7 +77,7 @@ test('T5866', exit_code(1), compile_and_run, ['']) # ----------------------------------------------------------------------------- # These tests we only do for a full run -def f( opts ): +def f( name, opts ): if config.fast: opts.skip = 1 @@ -204,7 +204,7 @@ test('conc058', only_compiler_types(['ghc']), compile_and_run, ['']) test('conc059', [only_compiler_types(['ghc']), only_ways(['threaded1','threaded2']), - compile_cmd_prefix('$MAKE conc059_setup && '), + pre_cmd('$MAKE -s --no-print-directory conc059_setup'), extra_clean(['conc059_c.o'])], compile_and_run, ['conc059_c.c -no-hs-main']) diff --git a/testsuite/tests/cpranal/should_compile/all.T b/testsuite/tests/cpranal/should_compile/all.T index 99ffed997f..2ec0a84e9a 100644 --- a/testsuite/tests/cpranal/should_compile/all.T +++ b/testsuite/tests/cpranal/should_compile/all.T @@ -1,5 +1,5 @@ # Just do the opt way... -def f( opts ): +def f( name, opts ): opts.only_ways = ['optasm'] setTestOpts(f) diff --git a/testsuite/tests/deSugar/should_compile/all.T b/testsuite/tests/deSugar/should_compile/all.T index b932a49a0e..979b1e7640 100644 --- a/testsuite/tests/deSugar/should_compile/all.T +++ b/testsuite/tests/deSugar/should_compile/all.T @@ -1,5 +1,5 @@ # Just do the normal way... -def f( opts ): +def f( name, opts ): opts.only_ways = ['normal'] setTestOpts(f) diff --git a/testsuite/tests/dph/classes/dph-classes.T b/testsuite/tests/dph/classes/dph-classes.T index 29c520b9a0..aa10c831d5 100644 --- a/testsuite/tests/dph/classes/dph-classes.T +++ b/testsuite/tests/dph/classes/dph-classes.T @@ -1,5 +1,6 @@ test ('dph-classes-vseg-fast' - , [ extra_clean(['Main.o', 'Main.hi', 'DefsVect.hi', 'DefsVect.o']) + , [ expect_fail + , extra_clean(['Main.o', 'Main.hi', 'DefsVect.hi', 'DefsVect.o']) , reqlib('dph-lifted-vseg') , reqlib('dph-prim-par') , only_ways(['normal', 'threaded1', 'threaded2']) ] diff --git a/testsuite/tests/dph/nbody/dph-nbody.T b/testsuite/tests/dph/nbody/dph-nbody.T index 6d201606b9..429ef8fa32 100644 --- a/testsuite/tests/dph/nbody/dph-nbody.T +++ b/testsuite/tests/dph/nbody/dph-nbody.T @@ -20,7 +20,7 @@ test ('dph-nbody-copy-opt' , only_ways(['normal', 'threaded1', 'threaded2']) ] , multimod_compile_and_run , [ 'Main' - , '-Odph -fno-liberate-case -package dph-lifted-copy -package dph-prim-par']) + , '-Odph -fno-vectorisation-avoidance -fno-liberate-case -package dph-lifted-copy -package dph-prim-par']) test ('dph-nbody-vseg-fast' @@ -40,4 +40,4 @@ test ('dph-nbody-copy-fast' , only_ways(['normal', 'threaded1', 'threaded2']) ] , multimod_compile_and_run , [ 'Main' - , '-O0 -package dph-lifted-copy -package dph-prim-par']) + , '-O0 -fno-vectorisation-avoidance -package dph-lifted-copy -package dph-prim-par']) diff --git a/testsuite/tests/dph/quickhull/dph-quickhull.T b/testsuite/tests/dph/quickhull/dph-quickhull.T index bd10565350..14922821f5 100644 --- a/testsuite/tests/dph/quickhull/dph-quickhull.T +++ b/testsuite/tests/dph/quickhull/dph-quickhull.T @@ -8,7 +8,7 @@ test ('dph-quickhull-copy-opt' , only_ways(['normal', 'threaded1', 'threaded2']) ] , multimod_compile_and_run , [ 'Main' - , '-Odph -funfolding-use-threshold30 -package dph-lifted-copy -package dph-prim-par']) + , '-Odph -fno-vectorisation-avoidance -funfolding-use-threshold30 -package dph-lifted-copy -package dph-prim-par']) test ('dph-quickhull-vseg-opt' @@ -30,7 +30,7 @@ test ('dph-quickhull-copy-fast' , only_ways(['normal', 'threaded1', 'threaded2']) ] , multimod_compile_and_run , [ 'Main' - , '-O0 -package dph-lifted-copy -package dph-prim-par']) + , '-O0 -fno-vectorisation-avoidance -package dph-lifted-copy -package dph-prim-par']) test ('dph-quickhull-vseg-fast' diff --git a/testsuite/tests/dph/words/WordsVect.hs b/testsuite/tests/dph/words/WordsVect.hs index ba4abc5d39..344442f3fb 100644 --- a/testsuite/tests/dph/words/WordsVect.hs +++ b/testsuite/tests/dph/words/WordsVect.hs @@ -107,6 +107,7 @@ flattenState ss -- | Break up an array of chars into words then flatten it back. wordsOfPArray :: PArray Word8 -> PArray Word8 +{-# NOINLINE wordsOfPArray #-} wordsOfPArray arr = let str = fromPArrayP arr state = stateOfString str @@ -116,6 +117,7 @@ wordsOfPArray arr -- | Count the number of words in an array wordCountOfPArray :: PArray Word8 -> Int +{-# NOINLINE wordCountOfPArray #-} wordCountOfPArray arr = let str = fromPArrayP arr state = stateOfString str diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile index bd24b2e88d..5152061f2f 100644 --- a/testsuite/tests/driver/Makefile +++ b/testsuite/tests/driver/Makefile @@ -17,6 +17,7 @@ OBJSUFFIX = .o # -fforce-recomp makes lots of driver tests trivially pass, so we # filter it out from $(TEST_HC_OPTS). TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) +TEST_HC_OPTS_NO_RECOMP_NO_RTSOPTS = $(filter-out -rtsopts,$(TEST_HC_OPTS_NO_RECOMP)) # ----------------------------------------------------------------------------- # One-shot compilations, non-hierarchical modules @@ -435,7 +436,7 @@ mode001: # Test for building DLLs with ghc -shared, see #2745 shared001: $(RM) Shared001.hi Shared001.o HSdll.dll.a HSdll.dll Shared001_stub.* - "$(TEST_HC)" $(TEST_HC_OPTS_NO_RECOMP) -v0 -shared Shared001.hs + "$(TEST_HC)" $(TEST_HC_OPTS_NO_RECOMP_NO_RTSOPTS) -v0 -shared Shared001.hs # ----------------------------------------------------------------------------- diff --git a/testsuite/tests/driver/dynamicToo/all.T b/testsuite/tests/driver/dynamicToo/all.T index a03c314d94..b85ff318ec 100644 --- a/testsuite/tests/driver/dynamicToo/all.T +++ b/testsuite/tests/driver/dynamicToo/all.T @@ -6,6 +6,7 @@ test('dynamicToo001', 'A001.dyn_o', 'B001.dyn_o', 'C001.dyn_o', 'A001.dyn_hi', 'B001.dyn_hi', 'C001.dyn_hi', 's001', 'd001']), + if_os('mingw32', expect_broken(7665)), unless_have_vanilla(skip), unless_have_dynamic(skip)], run_command, diff --git a/testsuite/tests/ffi/should_compile/all.T b/testsuite/tests/ffi/should_compile/all.T index 99c5eef8f4..a192a7b0cc 100644 --- a/testsuite/tests/ffi/should_compile/all.T +++ b/testsuite/tests/ffi/should_compile/all.T @@ -1,5 +1,5 @@ -def ffi( opts ): +def ffi( name, opts ): opts.extra_hc_opts = '-XForeignFunctionInterface -optc-Wno-implicit' setTestOpts(ffi) diff --git a/testsuite/tests/ffi/should_run/all.T b/testsuite/tests/ffi/should_run/all.T index 7727492656..1811f42af9 100644 --- a/testsuite/tests/ffi/should_run/all.T +++ b/testsuite/tests/ffi/should_run/all.T @@ -13,7 +13,7 @@ test('fed001', compose(only_compiler_types(['ghc']), test('ffi001', omit_ways(['ghci']), compile_and_run, ['']) test('ffi002', [ omit_ways(['ghci']), extra_clean(['ffi002_c.o']), - compile_cmd_prefix('$MAKE ffi002_setup && ') ], + pre_cmd('$MAKE -s --no-print-directory ffi002_setup') ], # The ffi002_setup hack is to ensure that we generate # ffi002_stub.h before compiling ffi002_c.c, which # needs it. @@ -109,7 +109,7 @@ test('ffi018', [ omit_ways(['ghci']), extra_clean(['ffi018_c.o']) ], compile_and_run, ['ffi018_c.c']) test('ffi018_ghci', [ only_ways(['ghci']), - cmd_prefix('$MAKE ffi018_ghci_setup && '), + pre_cmd('$MAKE -s --no-print-directory ffi018_ghci_setup'), extra_clean(['ffi018_ghci_c.o']) ], compile_and_run, ['ffi018_ghci_c.o']) @@ -122,7 +122,7 @@ test('T1288', [ omit_ways(['ghci']), extra_clean(['T1288_c.o']) ], compile_and_run, ['T1288_c.c']) test('T1288_ghci', [ only_ways(['ghci']), - cmd_prefix('$MAKE --no-print-directory T1288_ghci_setup && '), + pre_cmd('$MAKE -s --no-print-directory T1288_ghci_setup'), extra_clean(['T1288_ghci_c.o']) ], compile_and_run, ['T1288_ghci_c.o']) @@ -130,7 +130,7 @@ test('T2276', [ omit_ways(['ghci']), extra_clean(['T2276_c.o']) ], compile_and_run, ['T2276_c.c']) test('T2276_ghci', [ only_ways(['ghci']), - cmd_prefix('$MAKE --no-print-directory T2276_ghci_setup && '), + pre_cmd('$MAKE -s --no-print-directory T2276_ghci_setup'), extra_clean(['T2276_ghci_c.o']) ], compile_and_run, ['-fobject-code T2276_ghci_c.o']) @@ -177,12 +177,12 @@ test('T5402', [ omit_ways(['ghci']), # The T5402_setup hack is to ensure that we generate # T5402_stub.h before compiling T5402_main.c, which # needs it. - compile_cmd_prefix('$MAKE --no-print-directory T5402_setup && ') ], + pre_cmd('$MAKE -s --no-print-directory T5402_setup') ], compile_and_run, ["-no-hs-main T5402_main.c"]) test('T5594', [ omit_ways(['ghci']), extra_clean(['T5594_c.o']), - compile_cmd_prefix('$MAKE --no-print-directory T5594_setup && ') ], + pre_cmd('$MAKE -s --no-print-directory T5594_setup') ], # The T5594_setup hack is to ensure that we generate # T5594_stub.h before compiling T5594_c.c, which # needs it. diff --git a/testsuite/tests/gadt/gadt-escape1.hs b/testsuite/tests/gadt/gadt-escape1.hs index d90d6a951a..05579f9f09 100644 --- a/testsuite/tests/gadt/gadt-escape1.hs +++ b/testsuite/tests/gadt/gadt-escape1.hs @@ -10,7 +10,7 @@ data Hidden = forall t . Hidden (ExpGADT t) (ExpGADT t) hval = Hidden (ExpInt 0) (ExpInt 1) -- With the type sig this is ok, but without it maybe --- should be rejected becuase the result type is wobbly +-- should be rejected because the result type is wobbly -- weird1 :: ExpGADT Int -- -- And indeed it is rejected by GHC 7.8 because OutsideIn diff --git a/testsuite/tests/ghci/linking/all.T b/testsuite/tests/ghci/linking/all.T index 39be389b5c..bd87173c84 100644 --- a/testsuite/tests/ghci/linking/all.T +++ b/testsuite/tests/ghci/linking/all.T @@ -1,11 +1,12 @@ test('ghcilink001', [if_ghci_dynamic(expect_fail), # dynamic ghci can't load '.a's + skip_if_no_ghci, extra_clean(['dir001/*','dir001'])], run_command, ['$MAKE -s --no-print-directory ghcilink001']) test('ghcilink002', - extra_clean(['dir002/*','dir002']), + [skip_if_no_ghci, extra_clean(['dir002/*','dir002'])], run_command, ['$MAKE -s --no-print-directory ghcilink002']) @@ -13,6 +14,7 @@ test('ghcilink003', [ if_os('mingw32', expect_broken(5289)), # still cannot load libstdc++ # on Windows. See also #4468. + skip_if_no_ghci, extra_clean(['dir003/*','dir003']) ], run_command, @@ -20,12 +22,13 @@ test('ghcilink003', test('ghcilink004', [if_ghci_dynamic(expect_fail), # dynamic ghci can't load '.a's + skip_if_no_ghci, extra_clean(['dir004/*','dir004'])], run_command, ['$MAKE -s --no-print-directory ghcilink004']) test('ghcilink005', - extra_clean(['dir005/*','dir005']), + [skip_if_no_ghci, extra_clean(['dir005/*','dir005'])], run_command, ['$MAKE -s --no-print-directory ghcilink005']) @@ -33,6 +36,7 @@ test('ghcilink006', [ if_os('mingw32', expect_broken(5289)), # still cannot load libstdc++ # on Windows. See also #4468. + skip_if_no_ghci, extra_clean(['dir006/*','dir006']) ], run_command, diff --git a/testsuite/tests/ghci/prog004/prog004.T b/testsuite/tests/ghci/prog004/prog004.T index a67ebf35c8..ed17afd088 100644 --- a/testsuite/tests/ghci/prog004/prog004.T +++ b/testsuite/tests/ghci/prog004/prog004.T @@ -1,6 +1,6 @@ setTestOpts(only_compiler_types(['ghc'])) -def f(opts): +def f(name, opts): if not ('ghci' in config.run_ways): opts.skip = 1 setTestOpts(f) diff --git a/testsuite/tests/ghci/scripts/Makefile b/testsuite/tests/ghci/scripts/Makefile index 1fe702567f..73f62036d7 100644 --- a/testsuite/tests/ghci/scripts/Makefile +++ b/testsuite/tests/ghci/scripts/Makefile @@ -34,3 +34,8 @@ ghci037: ghci056_setup: '$(TEST_HC)' $(TEST_HC_OPTS) -c ghci056_c.c + +.PHONY: T6106_prep +T6106_prep: + '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make T6106_preproc + diff --git a/testsuite/tests/ghci/scripts/T6106.script b/testsuite/tests/ghci/scripts/T6106.script index 1b071ec604..be6de46362 100644 --- a/testsuite/tests/ghci/scripts/T6106.script +++ b/testsuite/tests/ghci/scripts/T6106.script @@ -3,7 +3,7 @@ :l :shell rm -f T6106.hs -:shell echo "{-# OPTIONS_GHC -F -pgmF ./T6106_preproc.sh #-}" >T6106.hs +:shell echo "{-# OPTIONS_GHC -F -pgmF ./T6106_preproc #-}" >T6106.hs :shell echo "module T6106 where" >>T6106.hs :load T6106.hs -- second one should fail: diff --git a/testsuite/tests/ghci/scripts/T6106_preproc.hs b/testsuite/tests/ghci/scripts/T6106_preproc.hs new file mode 100644 index 0000000000..fd2a55a646 --- /dev/null +++ b/testsuite/tests/ghci/scripts/T6106_preproc.hs @@ -0,0 +1,17 @@ + +import Control.Concurrent +import Data.ByteString as BS +import System.Environment + +main :: IO () +main = do args <- getArgs + case args of + [x, y, z] -> f x y z + _ -> error ("Bad args: " ++ show args) + +f :: String -> String -> String -> IO () +f x y z = do bs <- BS.readFile y + BS.writeFile z bs + threadDelay 1000000 + Prelude.writeFile x "FAIL" + diff --git a/testsuite/tests/ghci/scripts/T6106_preproc.sh b/testsuite/tests/ghci/scripts/T6106_preproc.sh deleted file mode 100755 index 56ca6082f6..0000000000 --- a/testsuite/tests/ghci/scripts/T6106_preproc.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# -# file T6106_preproc.sh -# -cat $2 > $3 -sleep 1 -echo "FAIL" >$1 diff --git a/testsuite/tests/ghci/scripts/all.T b/testsuite/tests/ghci/scripts/all.T index 659a275660..f204af76db 100755 --- a/testsuite/tests/ghci/scripts/all.T +++ b/testsuite/tests/ghci/scripts/all.T @@ -76,7 +76,7 @@ test('ghci055', combined_output, ghci_script, ['ghci055.script']) test('ghci056', [ - cmd_prefix('$MAKE --no-print-directory ghci056_setup && '), + pre_cmd('$MAKE -s --no-print-directory ghci056_setup'), extra_run_opts('ghci056_c.o'), extra_clean('ghci056_c.o') ], @@ -128,7 +128,13 @@ test('T6027ghci', normal, ghci_script, ['T6027ghci.script']) test('T6007', normal, ghci_script, ['T6007.script']) test('T6091', normal, ghci_script, ['T6091.script']) -test('T6106', extra_clean(['T6106.hs']), ghci_script, ['T6106.script']) +test('T6106', + [extra_clean(['T6106.hs', + 'T6106_preproc.hi', 'T6106_preproc.o', + 'T6106_preproc', 'T6106_preproc.exe']), + pre_cmd('$MAKE -s --no-print-directory T6106_prep')], + ghci_script, + ['T6106.script']) test('T6105', normal, ghci_script, ['T6105.script']) test('T7117', normal, ghci_script, ['T7117.script']) test('ghci058', diff --git a/testsuite/tests/ghci/should_run/all.T b/testsuite/tests/ghci/should_run/all.T index d34eade39b..a2552f6f93 100644 --- a/testsuite/tests/ghci/should_run/all.T +++ b/testsuite/tests/ghci/should_run/all.T @@ -2,7 +2,7 @@ setTestOpts(if_compiler_profiled(skip)) # We only want to run these tests with GHCi -def just_ghci( opts ): +def just_ghci( name, opts ): opts.only_ways = ['ghci'] test('ghcirun001', just_ghci, compile_and_run, ['']) diff --git a/testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs b/testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs index a62020f508..2f5e9ca685 100644 --- a/testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs +++ b/testsuite/tests/haddock/should_compile_noflag_haddock/haddockSimplUtilsBug.hs @@ -4,7 +4,7 @@ postInlineUnconditionally = case Just "Hey" of -- The point of examining occ_info here is that for *non-values* -- that occur outside a lambda, the call-site inliner won't have - -- a chance (becuase it doesn't know that the thing + -- a chance (because it doesn't know that the thing -- only occurs once). The pre-inliner won't have gotten -- it either, if the thing occurs in more than one branch -- So the main target is things like diff --git a/testsuite/tests/llvm/should_compile/all.T b/testsuite/tests/llvm/should_compile/all.T index 61d0f3f615..448e8e0097 100644 --- a/testsuite/tests/llvm/should_compile/all.T +++ b/testsuite/tests/llvm/should_compile/all.T @@ -1,6 +1,6 @@ # Tests for LLVM code generator -def f( opts ): +def f( name, opts ): opts.only_ways = ['optllvm', 'llvm', 'debugllvm'] setTestOpts(f) @@ -11,4 +11,4 @@ test('T5486', normal, compile, ['']) test('T5681', normal, compile, ['']) test('T6158', [reqlib('vector'), reqlib('primitive')], compile, ['-package vector -package primitive']) test('T7571', cmm_src, compile, ['']) -test('T7575', unless_wordsize(32, skip), compile, ['']) +test('T7575', unless(wordsize(32), skip), compile, ['']) diff --git a/testsuite/tests/parser/should_fail/T984.hs b/testsuite/tests/parser/should_fail/T984.hs new file mode 100644 index 0000000000..ba2e282d5a --- /dev/null +++ b/testsuite/tests/parser/should_fail/T984.hs @@ -0,0 +1,9 @@ + +module T984 where + +f _ = do + x <- computation + case () of + _ -> + result <- computation + case () of () -> undefined diff --git a/testsuite/tests/parser/should_fail/T984.stderr b/testsuite/tests/parser/should_fail/T984.stderr new file mode 100644 index 0000000000..4c723a7869 --- /dev/null +++ b/testsuite/tests/parser/should_fail/T984.stderr @@ -0,0 +1,4 @@ + +T984.hs:6:9: + Parse error in pattern: case () of { _ -> result } + Possibly caused by a missing 'do'? diff --git a/testsuite/tests/parser/should_fail/all.T b/testsuite/tests/parser/should_fail/all.T index 355961dd4f..114524affa 100644 --- a/testsuite/tests/parser/should_fail/all.T +++ b/testsuite/tests/parser/should_fail/all.T @@ -76,3 +76,4 @@ test('ParserNoLambdaCase', if_compiler_lt('ghc', '7.5', skip), compile_fail, ['' test('ParserNoMultiWayIf', if_compiler_lt('ghc', '7.5', skip), compile_fail, ['']) test('T5425', normal, compile_fail, ['']) +test('T984', normal, compile_fail, ['']) diff --git a/testsuite/tests/parser/should_fail/readFail007.stderr b/testsuite/tests/parser/should_fail/readFail007.stderr index 3236824a78..bd6d92ed58 100644 --- a/testsuite/tests/parser/should_fail/readFail007.stderr +++ b/testsuite/tests/parser/should_fail/readFail007.stderr @@ -1,2 +1,4 @@ -readFail007.hs:6:4: Parse error in pattern: 2 + 2 +readFail007.hs:6:4: + Parse error in pattern: 2 + 2 + Possibly caused by a missing 'do'? diff --git a/testsuite/tests/perf/compiler/all.T b/testsuite/tests/perf/compiler/all.T index 09cdb0111f..09a02975a2 100644 --- a/testsuite/tests/perf/compiler/all.T +++ b/testsuite/tests/perf/compiler/all.T @@ -1,4 +1,4 @@ -def no_lint(opts): +def no_lint(name, opts): opts.compiler_always_flags = \ filter(lambda opt: opt != '-dcore-lint' and opt != '-dcmm-lint', opts.compiler_always_flags) @@ -6,39 +6,36 @@ setTestOpts(no_lint) test('T1969', - [if_wordsize(32, - compiler_stats_num_field('peak_megabytes_allocated', 13, - 19)), + [when(wordsize(32), + compiler_stats_range_field('peak_megabytes_allocated', 18, 1)), # expected value: 14 (x86/Windows 17/05/10) # 15 (x86/OS X) # 19 (x86/OS X) - if_wordsize(64, - compiler_stats_num_field('peak_megabytes_allocated', 22, - 28)), + when(wordsize(64), + compiler_stats_range_field('peak_megabytes_allocated', 25, 1)), # expected value: 28 (amd64/Linux) # expected value: 34 (amd64/Linux) # 2012-09-20 23 (amd64/Linux) # 2012-10-03 25 (amd64/Linux if .hi exists) - if_wordsize(32, - compiler_stats_num_field('max_bytes_used', 4000000, - 7000000)), + when(wordsize(32), + compiler_stats_range_field('max_bytes_used', 6149572, 5)), # expected value: 6707308 (x86/OS X) # 5717704 (x86/Windows 17/05/10) # 6149572 (x86/Linux, 31/12/09) - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('max_bytes_used', 9000000, 20)), # looks like the peak is around 10M, but we're # unlikely to GC exactly on the peak. # varies quite a lot with CLEANUP and BINDIST, # hence 10% range. - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 303930948, 5)), # expected value: 215582916 (x86/Windows) # 221667908 (x86/OS X) # 274932264 (x86/Linux) # 2012-10-08: 303930948 (x86/Linux, new codegen) # 2012-10-29: 298921816 (x86/Windows; increased range to 5% - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 658786936, 5)), # 17/11/2009: 434,845,560 (amd64/Linux) # 08/12/2009: 459,776,680 (amd64/Linux) @@ -80,24 +77,23 @@ else: conf_3294 = skip test('T3294', - [if_wordsize(32, - compiler_stats_num_field('max_bytes_used', 12000000, - 20000000)), + [when(wordsize(32), + compiler_stats_range_field('max_bytes_used', 17725476, 5)), # expected value: 17725476 (x86/OS X) - # 14593500 (Windows) - if_wordsize(64, + # 14593500 (Windows) + when(wordsize(64), compiler_stats_range_field('max_bytes_used', 44894544, 15)), # prev: 25753192 (amd64/Linux) # 29/08/2012: 37724352 (amd64/Linux) # (increase due to new codegen, see #7198) # 13/13/2012: 44894544 (amd64/Linux) # (reason for increase unknown) - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 1373514844, 5)), # previous: 815479800 (x86/Linux) # (^ increase due to new codegen, see #7198) # 2012-10-08: 1373514844 (x86/Linux) - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 2717327208, 5)), # old: 1,357,587,088 (amd64/Linux) # 29/08/2012: 2,961,778,696 (amd64/Linux) @@ -111,10 +107,10 @@ test('T3294', test('T4801', [ # expect_broken(5224), # temporarily unbroken (#5227) - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('peak_megabytes_allocated', 30, 20)), - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('peak_megabytes_allocated', 49, 20)), # prev: 50 (amd64/Linux) # 19/10/2012: 64 (amd64/Linux) (REASON UNKNOWN!) @@ -122,12 +118,12 @@ test('T4801', # expected value: 58 (amd64/OS X): if_platform('x86_64-apple-darwin', - compiler_stats_num_field('peak_megabytes_allocated', 56, 60)), + compiler_stats_range_field('peak_megabytes_allocated', 58, 1)), # expected value: 228286660 (x86/OS X) - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 185669232, 10)), - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 392409984, 10)), # prev: 360243576 (amd64/Linux) # 19/10/2012: 447190832 (amd64/Linux) (-fPIC turned on) @@ -135,15 +131,13 @@ test('T4801', # expected value: 510938976 (amd64/OS X): if_platform('x86_64-apple-darwin', - compiler_stats_num_field('bytes allocated', 490000000, - 530000000)), + compiler_stats_range_field('bytes allocated', 510938976, 5)), - if_wordsize(32, + when(wordsize(32), + compiler_stats_range_field('max_bytes_used', 9651948, 5)), # expected value: x86/OS X: 9651948 - compiler_stats_num_field('max_bytes_used', 8000000, - 12000000)), - # expected value: 10290952 (windows) - if_wordsize(64, + # expected value: 10290952 (windows) + when(wordsize(64), compiler_stats_range_field('max_bytes_used', 21657520, 15)), # prev: 20486256 (amd64/OS X) # 30/08/2012: 17305600--20391920 (varies a lot) @@ -151,8 +145,7 @@ test('T4801', # 19/10/2012: 18619912 (-fPIC turned off) # 24/12/2012: 21657520 (perhaps gc sampling time wibbles?) if_platform('x86_64-apple-darwin', - compiler_stats_num_field('max_bytes_used', 20000000, - 23000000)), + compiler_stats_range_field('max_bytes_used', 21657520, 5)), only_ways(['normal']), extra_hc_opts('-static') ], @@ -162,32 +155,33 @@ test('T4801', test('T3064', [# expect_broken( 3064 ), # expected value: 14 (x86/Linux 28-06-2012): - if_wordsize(32, - compiler_stats_range_field('peak_megabytes_allocated', 14, 30)), + when(wordsize(32), + compiler_stats_range_field('peak_megabytes_allocated', 14, 1)), - # expected value: 18 (amd64/Linux): - if_wordsize(64, - compiler_stats_num_field('peak_megabytes_allocated', 20, 28)), + when(wordsize(64), + compiler_stats_range_field('peak_megabytes_allocated', 26, 1)), + # (amd64/Linux): 18 + # (amd64/Linux) 2012-02-07: 26 # expected value: 56380288 (x86/Linux) (28/6/2011) # 111189536 (x86/Windows) (30/10/12) - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 111189536, 10)), - # expected value: 73259544 (amd64/Linux) (28/6/2011): - if_wordsize(64, - compiler_stats_num_field('bytes allocated', 200000000, - 280000000)), + when(wordsize(64), + compiler_stats_range_field('bytes allocated', 224798696, 5)), + # (amd64/Linux) (28/06/2011): 73259544 + # (amd64/Linux) (07/02/2013): 224798696 # expected value: 2247016 (x86/Linux) (28/6/2011): - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('max_bytes_used', 5511604, 20)), - # expected value: 4032024 (amd64/Linux, intree) (28/6/2011): - if_wordsize(64, - compiler_stats_num_field('max_bytes_used', 8000000, - 14000000)), + when(wordsize(64), + compiler_stats_range_field('max_bytes_used', 9819288, 5)), + # (amd64/Linux, intree) (28/06/2011): 4032024 + # (amd64/Linux, intree) (07/02/2013): 9819288 only_ways(['normal']) ], compile, @@ -200,12 +194,12 @@ test('T4007', test('T5030', [ - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 259547660, 10)), # previous: 196457520 # 2012-10-08: 259547660 (x86/Linux, new codegen) - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 602993184, 10)), # Previously 530000000 (+/- 10%) # 17/1/13: 602,993,184 (x86_64/Linux) @@ -217,12 +211,11 @@ test('T5030', ['-fcontext-stack=300']) test('T5631', - [if_wordsize(32, # sample from x86/Linux + [when(wordsize(32), # sample from x86/Linux compiler_stats_range_field('bytes allocated', 392904228, 10)), # expected value: 774,595,008 (amd64/Linux): - if_wordsize(64, - compiler_stats_num_field('bytes allocated', 600000000, - 900000000)), + when(wordsize(64), + compiler_stats_range_field('bytes allocated', 774595008, 5)), only_ways(['normal']) ], compile, @@ -230,12 +223,11 @@ test('T5631', test('parsing001', [# expected value: ? - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 274000576, 10)), # expected value: 587079016 (amd64/Linux): - if_wordsize(64, - compiler_stats_num_field('bytes allocated', 540000000, - 620000000)), + when(wordsize(64), + compiler_stats_range_field('bytes allocated', 587079016, 5)), only_ways(['normal']), ], compile_fail, ['']) @@ -244,10 +236,10 @@ test('parsing001', test('T783', [ only_ways(['normal']), # no optimisation for this one # expected value: 175,569,928 (x86/Linux) - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 226907420, 10)), # 2012-10-08: 226907420 (x86/Linux) - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 640324528, 10)), # prev: 349,263,216 (amd64/Linux) # 07/08/2012: 384,479,856 (amd64/Linux) @@ -262,12 +254,12 @@ test('T783', test('T5321Fun', [ only_ways(['normal']), # no optimisation for this one # sample from x86/Linux - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 344416344, 10)), # prev: 300000000 # 2012-10-08: 344416344 # (increase due to new codegen) - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 713385808, 10)) # prev: 585,521,080 # 29/08/2012: 713,385,808 @@ -277,12 +269,12 @@ test('T5321Fun', test('T5321FD', [ only_ways(['normal']), # no optimisation for this one - if_wordsize(32, + when(wordsize(32), compiler_stats_range_field('bytes allocated', 240302920, 10)), # prev: 213380256 # 2012-10-08: 240302920 (x86/Linux) # (increase due to new codegen) - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 492905640, 10)) # prev: 418,306,336 # 29/08/2012: 492,905,640 @@ -292,20 +284,20 @@ test('T5321FD', test('T5642', [ only_ways(['normal']), - if_wordsize(32, # sample from x86/Linux + when(wordsize(32), # sample from x86/Linux compiler_stats_range_field('bytes allocated', 650000000, 10)), - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 1300000000, 10)) ], compile,['-O']) test('T5837', [ only_ways(['normal']), - if_wordsize(32, # sample from x86/Linux + when(wordsize(32), # sample from x86/Linux compiler_stats_range_field('bytes allocated', 40000000, 10)), # sample: 3926235424 (amd64/Linux, 15/2/2012) - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 81879216, 10)) # 2012-10-02 81879216 # 2012-09-20 87254264 amd64/Linux @@ -314,11 +306,11 @@ test('T5837', test('T6048', [ only_ways(['optasm']), - if_wordsize(32, # sample from x86/Linux + when(wordsize(32), # sample from x86/Linux compiler_stats_range_field('bytes allocated', 48887164, 10)), # prev: 38000000 # 2012-10-08: 48887164 (x86/Linux) - if_wordsize(64, + when(wordsize(64), compiler_stats_range_field('bytes allocated', 97247032, 10)) # 18/09/2012 97247032 amd64/Linux ], diff --git a/testsuite/tests/perf/haddock/all.T b/testsuite/tests/perf/haddock/all.T index 07942bd662..14d972783d 100644 --- a/testsuite/tests/perf/haddock/all.T +++ b/testsuite/tests/perf/haddock/all.T @@ -1,34 +1,33 @@ test('haddock.base', [unless_in_tree_compiler(skip) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('peak_megabytes_allocated', 274, 10)) # 2012-08-14: 240 (amd64/Linux) # 2012-09-18: 237 (amd64/Linux) # 2012-11-12: 249 (amd64/Linux) # 2013-01-29: 274 (amd64/Linux) - ,if_wordsize(32, - stats_num_field('peak_megabytes_allocated', 110, - 115)) + ,when(wordsize(32), + stats_range_field('peak_megabytes_allocated', 113, 1)) # 2012-08-14: 144 (x86/OSX) # 2012-10-30: 113 (x86/Windows) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('max_bytes_used', 96022312, 10)) # 2012-08-14: 87374568 (amd64/Linux) # 2012-08-21: 86428216 (amd64/Linux) # 2012-09-20: 84794136 (amd64/Linux) # 2012-11-12: 87265136 (amd64/Linux) # 2013-01-29: 96022312 (amd64/Linux) - ,if_wordsize(32, + ,when(wordsize(32), stats_range_field('max_bytes_used', 45574928, 1)) # 2012-08-14: 45574928 (x86/OSX) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('bytes allocated', 6064874536, 2)) # 2012-08-14: 5920822352 (amd64/Linux) # 2012-09-20: 5829972376 (amd64/Linux) # 2012-10-08: 5902601224 (amd64/Linux) # 2013-01-17: 6064874536 (x86_64/Linux) - ,if_wordsize(32, + ,when(wordsize(32), stats_range_field('bytes allocated', 2955470952, 1)) # 2012-08-14: 3046487920 (x86/OSX) # 2012-10-30: 2955470952 (x86/Windows) @@ -38,33 +37,32 @@ test('haddock.base', test('haddock.Cabal', [unless_in_tree_compiler(skip) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('peak_megabytes_allocated', 217, 10)) # 2012-08-14: 202 (amd64/Linux) # 2012-08-29: 211 (amd64/Linux, new codegen) # 2012-09-20: 227 (amd64/Linux) # 2012-10-08: 217 (amd64/Linux) - ,if_wordsize(32, - stats_num_field('peak_megabytes_allocated', 80, - 85)) + ,when(wordsize(32), + stats_range_field('peak_megabytes_allocated', 83, 1)) # 2012-08-14: 116 (x86/OSX) # 2012-10-30: 83 (x86/Windows) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('max_bytes_used', 80590280, 15)) # 2012-08-14: 74119424 (amd64/Linux) # 2012-08-29: 77992512 (amd64/Linux, new codegen) # 2012-10-02: 91341568 (amd64/Linux) # 2012-10-08: 80590280 (amd64/Linux) - ,if_wordsize(32, + ,when(wordsize(32), stats_range_field('max_bytes_used', 44224896, 5)) # 2012-08-14: 47461532 (x86/OSX) # 2012-10-30: 44224896 (x86/Windows insreased range to 5%) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('bytes allocated', 3373401360, 2)) # 2012-08-14: 3255435248 (amd64/Linux) # 2012-08-29: 3324606664 (amd64/Linux, new codegen) # 2012-10-08: 3373401360 (amd64/Linux) - ,if_wordsize(32, + ,when(wordsize(32), stats_range_field('bytes allocated', 1733638168, 1)) # 2012-08-14: 1648610180 (x86/OSX) # 2012-10-30: 1733638168 (x86/Windows) @@ -74,34 +72,33 @@ test('haddock.Cabal', test('haddock.compiler', [unless_in_tree_compiler(skip) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('peak_megabytes_allocated', 1240, 10)) # 2012-08-14: 1203 (amd64/Linux) # 2012-08-21: 1199 (amd64/Linux) # 2012-09-20: 1228 (amd64/Linux) # 2012-10-08: 1240 (amd64/Linux) - ,if_wordsize(32, - stats_num_field('peak_megabytes_allocated', 600, - 610)) + ,when(wordsize(32), + stats_range_field('peak_megabytes_allocated', 606, 1)) # 2012-08-14: 631 (x86/OSX) # 2012-10-30: 606 (x86/Windows) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('max_bytes_used', 420105120, 10)) # 2012-08-14: 428775544 (amd64/Linux) # 2012-09-20: 437618008 (amd64/Linux) # 2012-10-08: 442768280 (amd64/Linux) # 2012-11-12: 420105120 (amd64/Linux) - ,if_wordsize(32, + ,when(wordsize(32), stats_range_field('max_bytes_used', 220847924, 1)) # 2012-08-14: 231064920 (x86/OSX) # 2012-10-30: 220847924 (x86/Windows) - ,if_wordsize(64, + ,when(wordsize(64), stats_range_field('bytes allocated', 25990254632, 10)) # 2012-08-14: 26,070,600,504 (amd64/Linux) # 2012-08-29: 26,353,100,288 (amd64/Linux, new CG) # 2012-09-18: 26,882,813,032 (amd64/Linux) # 2012-11-12: 25,990,254,632 (amd64/Linux) - ,if_wordsize(32, + ,when(wordsize(32), stats_range_field('bytes allocated', 13773051312, 1)) # 2012-08-14: 13471797488 (x86/OSX) # 2012-10-30: 13773051312 (x86/Windows) diff --git a/testsuite/tests/perf/should_run/all.T b/testsuite/tests/perf/should_run/all.T index b201bb1b11..5b17e452c8 100644 --- a/testsuite/tests/perf/should_run/all.T +++ b/testsuite/tests/perf/should_run/all.T @@ -4,21 +4,19 @@ # because the test allocates an unboxed array of doubles. test('T3586', - [stats_num_field('peak_megabytes_allocated', 17, - 18), - # expected value: 17 (amd64/Linux) - stats_num_field('bytes allocated', 16000000, - 17000000), - # expected value: 16835544 (amd64/Linux) + [stats_num_field('peak_megabytes_allocated', (17, 1)), + # expected value: 17 (amd64/Linux) + stats_num_field('bytes allocated', (16835544, 5)), + # expected value: 16835544 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O']) test('T4830', - [stats_num_field('bytes allocated', 60000, - 200000), - # expected value: 127,000 (amd64/Linux) + [stats_num_field('bytes allocated', (99264, 1)), + # (amd64/Linux): 127000 + # (amd64/Linux) 2013-02-07: 99264 only_ways(['normal']) ], compile_and_run, @@ -30,12 +28,11 @@ test('T3245', normal, compile_and_run, ['-O']) # a bug in hGetBufNonBlocking in 6.13 that triggered this. # test('lazy-bs-alloc', - [stats_num_field('peak_megabytes_allocated', 1, - 3), - # expected value: 2 (amd64/Linux) - stats_num_field('bytes allocated', 400000, - 600000), - # expected value: 489776 (amd64/Linux) + [stats_num_field('peak_megabytes_allocated', (2, 1)), + # expected value: 2 (amd64/Linux) + stats_num_field('bytes allocated', (429744, 1)), + # (amd64/Linux): 489776 + # (amd64/Linux) 2013-02-07: 429744 only_ways(['normal']), extra_run_opts('../../numeric/should_run/arith011.stdout'), ignore_output @@ -60,35 +57,27 @@ test('T3736', ['$MAKE -s --no-print-directory T3736']) test('T3738', [extra_clean(['T3738a.hi', 'T3738a.o']), - stats_num_field('peak_megabytes_allocated', 1, - 1), - # expected value: 1 (amd64/Linux) - # expected value: 45648 (x86/Linux): - if_wordsize(32, - stats_num_field('bytes allocated', 40000, - 50000)), - if_wordsize(64, - stats_num_field('bytes allocated', 40000, - 60000)), - # expected value: 49400 (amd64/Linux) + stats_num_field('peak_megabytes_allocated', (1, 0)), + # expected value: 1 (amd64/Linux) + stats_num_field('bytes allocated', + [(wordsize(32), 45648, 5), + # expected value: 45648 (x86/Linux) + (wordsize(64), 49400, 5)]), + # expected value: 49400 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O']) test('MethSharing', - [stats_num_field('peak_megabytes_allocated', 1, - 1), - # expected value: 1 (amd64/Linux) - # expected value: 2685858140 (x86/OS X): - if_wordsize(32, - stats_num_field('bytes allocated', 300000000, - 400000000)), - # expected: 360940756 (x86/Linux) - if_wordsize(64, - stats_num_field('bytes allocated', 600000000, - 700000000)), - # expected: 640067672 (amd64/Linux) + [stats_num_field('peak_megabytes_allocated', (1, 0)), + # expected value: 1 (amd64/Linux) + stats_num_field('bytes allocated', + [(wordsize(32), 360940756, 5), + # expected value: 2685858140 (x86/OS X) + # expected: 360940756 (x86/Linux) + (wordsize(64), 640067672, 5)]), + # expected: 640067672 (amd64/Linux) only_ways(['normal']) ], compile_and_run, @@ -112,127 +101,98 @@ test('T149', ['$MAKE -s --no-print-directory T149']) test('T5113', - [ - if_wordsize(32, - stats_num_field('bytes allocated', 3000000, - 5000000)), - if_wordsize(64, - stats_num_field('bytes allocated', 8000000, - 9000000)), + [stats_num_field('bytes allocated', + [(wordsize(32), 4000000, 5), + (wordsize(64), 8000000, 5)]), only_ways(['normal']), - normal - # WAS: expect_broken(7046) - # but it started working again around 01/2013, see #7046 + expect_broken(7046) ], compile_and_run, ['-O']) test('T4978', - [if_wordsize(32, - stats_num_field('bytes allocated', 9000000, - 11000000)), - if_wordsize(64, - stats_num_field('bytes allocated', 9000000, - 11000000)), - # expected value: 10137680 (amd64/Linux) + [stats_num_field('bytes allocated', + [(wordsize(32), 10000000, 5), + (wordsize(64), 10137680, 5)]), + # expected value: 10137680 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O2']) test('T5205', - [if_wordsize(32, - stats_num_field('bytes allocated', 40000, - 50000)), - # expected value: 47088 (x86/Darwin) - if_wordsize(64, - stats_num_field('bytes allocated', 40000, - 60000)), - # expected value: 51320 (amd64/Linux) + [stats_num_field('bytes allocated', + [(wordsize(32), 47088, 5), + # expected value: 47088 (x86/Darwin) + (wordsize(64), 51320, 5)]), + # expected value: 51320 (amd64/Linux) only_ways(['normal', 'optasm']) ], compile_and_run, ['']) test('T5549', - [if_wordsize(32, - stats_num_field('bytes allocated', 3000000000, - 8000000000)), - # expected value: 3362958676 (Windows) - if_wordsize(64, - stats_num_field('bytes allocated', 5000000000, - 8000000000)), - # expected value: 6,725,846,120 (amd64/Linux) + [stats_num_field('bytes allocated', + [(wordsize(32), 3362958676, 5), + # expected value: 3362958676 (Windows) + (wordsize(64), 6725846120, 5)]), + # expected value: 6725846120 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O']) test('T4474a', - [if_wordsize(32, - stats_num_field('bytes allocated', 1600000000, - 2000000000)), - # expected value: 1879095912 (i386/OSX) - if_wordsize(64, - stats_num_field('bytes allocated', 3500000000, - 3900000000)), - # expected value: 3766493912 (amd64/Linux) + [stats_num_field('bytes allocated', + [(wordsize(32), 1879095912, 5), + # expected value: 1879095912 (i386/OSX) + (wordsize(64), 3766493912, 5)]), + # expected value: 3766493912 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O']) test('T4474b', - [if_wordsize(32, - stats_num_field('bytes allocated', 1600000000, - 2000000000)), - # expected value: 1879095912 (i386/OSX) - if_wordsize(64, - stats_num_field('bytes allocated', 3500000000, - 3900000000)), - # expected value: 3766493912 (amd64/Linux) + [stats_num_field('bytes allocated', + [(wordsize(32), 1879095912, 5), + # expected value: 1879095912 (i386/OSX) + (wordsize(64), 3766493912, 5)]), + # expected value: 3766493912 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O']) test('T4474c', - [if_wordsize(32, - stats_num_field('bytes allocated', 1600000000, - 2000000000)), - # expected value: 1879095912 (i386/OSX) - if_wordsize(64, - stats_num_field('bytes allocated', 3500000000, - 3900000000)), - # expected value: 3766493912 (amd64/Linux) + [stats_num_field('bytes allocated', + [(wordsize(32), 1879095912, 5), + # expected value: 1879095912 (i386/OSX) + (wordsize(64), 3766493912, 5)]), + # expected value: 3766493912 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O']) test('T5237', - [if_wordsize(32, - stats_num_field('bytes allocated', 70000, - 90000)), - # expected value: 78328 (i386/Linux) - if_wordsize(64, - stats_num_field('bytes allocated', 90000, - 130000)), - # expected value: 110888 (amd64/Linux) + [stats_num_field('bytes allocated', + [(wordsize(32), 78328, 5), + # expected value: 78328 (i386/Linux) + (wordsize(64), 110888, 5)]), + # expected value: 110888 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O ' + sse2_opts]) test('T5536', - [if_wordsize(32, - stats_num_field('bytes allocated', 1150000000, - 1250000000)), - # expected value: 1246287228 (i386/Linux) - if_wordsize(64, - stats_range_field('bytes allocated', 892399040, 5)), - # expected value: 2,492,589,480 (amd64/Linux) - # 17/1/13: 892,399,040 (x86_64/Linux) - # (new demand analyser) + [stats_num_field('bytes allocated', + [(wordsize(32), 1246287228, 5), + # expected value: 1246287228 (i386/Linux) + (wordsize(64), 892399040, 5)]), + # expected value: 2492589480 (amd64/Linux) + # 17/1/13: 892399040 (x86_64/Linux) + # (new demand analyser) extra_clean(['T5536.data']), ignore_output, only_ways(['normal']) @@ -241,30 +201,27 @@ test('T5536', ['-O']) test('T7257', - [if_wordsize(32, - stats_range_field('bytes allocated', 1150000000, 10)), - # expected value: 1246287228 (i386/Linux) - if_wordsize(32, - stats_range_field('peak_megabytes_allocated', 217, 5)), - # 2012-10-08: 217 (x86/Linux) - if_wordsize(64, - stats_range_field('bytes allocated', 1774893760, 5)), - # 2012-09-21: 1774893760 (amd64/Linux) - if_wordsize(64, - stats_range_field('peak_megabytes_allocated', 227, 5)), - # 2012-09-21: 227 (amd64/Linux) + [stats_num_field('bytes allocated', + [(wordsize(32), 1150000000, 10), + # expected value: 1246287228 (i386/Linux) + (wordsize(64), 1774893760, 5)]), + # 2012-09-21: 1774893760 (amd64/Linux) + stats_num_field('peak_megabytes_allocated', + [(wordsize(32), 217, 5), + # 2012-10-08: 217 (x86/Linux) + (wordsize(64), 227, 5)]), + # 2012-09-21: 227 (amd64/Linux) only_ways(['normal']) ], compile_and_run, ['-O']) test('Conversions', - [if_wordsize(32, - stats_range_field('bytes allocated', 55316, 5)), - # 2012-12-18: Guessed 64-bit value / 2 - if_wordsize(64, - stats_range_field('bytes allocated', 110632, 5)), - # 2012-12-18: 109608 (amd64/OS X) + [stats_num_field('bytes allocated', + [(wordsize(32), 55316, 5), + # 2012-12-18: Guessed 64-bit value / 2 + (wordsize(64), 110632, 5)]), + # 2012-12-18: 109608 (amd64/OS X) only_ways(['normal']) ], @@ -274,9 +231,9 @@ test('T7507', omit_ways(['ghci']), compile_and_run, ['-O']) # For 7507, stack overflow is the bad case test('T7436', - [stats_num_field('max_bytes_used', 50000, - 100000), - # expected value: 127,000 (amd64/Linux) + [stats_num_field('max_bytes_used', (60360, 1)), + # (amd64/Linux): 127000 + # (amd64/Linux) 2013-02-07: 60360 only_ways(['normal']) ], compile_and_run, diff --git a/testsuite/tests/perf/space_leaks/all.T b/testsuite/tests/perf/space_leaks/all.T index 6dec9f0990..dcc1f08650 100644 --- a/testsuite/tests/perf/space_leaks/all.T +++ b/testsuite/tests/perf/space_leaks/all.T @@ -4,15 +4,13 @@ test('space_leak_001', # Now it's: 3 (amd64/Linux) # 4 (x86/OS X) # 5 (x86/Linux) - [stats_num_field('peak_megabytes_allocated', 3, 5), - stats_num_field('max_bytes_used', 400000, - 500000), - # expected value: 440224 (amd64/Linux) - # 417016 (x86/OS X) - # 415672 (x86/Windows) - # 481456 (unreg amd64/Linux) - stats_num_field('bytes allocated', 9050000000, - 9100000000), + [stats_range_field('peak_megabytes_allocated', 4, 1), + stats_range_field('max_bytes_used', 440000, 10), + # expected value: 440224 (amd64/Linux) + # 417016 (x86/OS X) + # 415672 (x86/Windows) + # 481456 (unreg amd64/Linux) + stats_range_field('bytes allocated', 9079316016, 1), # expected value: 9079316016 (amd64/Linux) # 9331570416 (x86/Linux) # 9329073952 (x86/OS X) @@ -25,7 +23,7 @@ test('space_leak_001', test('T4334', # Test for a space leak in Data.List.lines (fixed with #4334) [extra_run_opts('1000000 2 t'), - stats_num_field('peak_megabytes_allocated', 1, 3), + stats_range_field('peak_megabytes_allocated', 2, 0), # prof ways don't work well with +RTS -V0 omit_ways(['profasm','profthreaded']) ], @@ -34,7 +32,7 @@ test('T4334', test('T2762', [# peak_megabytes_allocated is 2 with 7.0.2. # Was 57 with 6.12.3. - stats_num_field('peak_megabytes_allocated', 1, 3), + stats_range_field('peak_megabytes_allocated', 2, 0), only_ways(['normal']), extra_clean(['T2762A.hi', 'T2762A.o'])], compile_and_run, ['-O']) diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T index 68225aed7b..2f0fc44c9b 100644 --- a/testsuite/tests/plugins/all.T +++ b/testsuite/tests/plugins/all.T @@ -1,4 +1,4 @@ -def f(opts): +def f(name, opts): if (ghc_with_interpreter == 0): opts.skip = 1 diff --git a/testsuite/tests/programs/okeefe_neural/test.T b/testsuite/tests/programs/okeefe_neural/test.T index cf329cf716..326dd6b0f0 100644 --- a/testsuite/tests/programs/okeefe_neural/test.T +++ b/testsuite/tests/programs/okeefe_neural/test.T @@ -1,7 +1,7 @@ # this one causes the compiler to run out of heap in the simplifier -def set_opts( opts ): +def set_opts( name, opts ): opts.expect = 'fail' test('okeefe_neural', diff --git a/testsuite/tests/rts/Makefile b/testsuite/tests/rts/Makefile index 2eb952df25..5d663d1260 100644 --- a/testsuite/tests/rts/Makefile +++ b/testsuite/tests/rts/Makefile @@ -48,11 +48,16 @@ T5423: T6006_setup : '$(TEST_HC)' $(TEST_HC_OPTS) -c T6006.hs +ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32" +T7037_CONST = const +else +T7037_CONST = +endif .PHONY: T7037 T7037: $(RM) 7037.o 7037.hi 7037$(exeext) "$(TEST_HC)" $(TEST_HC_OPTS) T7037.hs -v0 - "$(TEST_HC)" $(filter-out -rtsopts, $(TEST_HC_OPTS)) T7037_main.c -v0 -o T7037_main -no-hs-main + "$(TEST_HC)" -optc-DT7037_CONST=$(T7037_CONST) $(filter-out -rtsopts, $(TEST_HC_OPTS)) T7037_main.c -v0 -o T7037_main -no-hs-main ./T7037_main T7040_ghci_setup : diff --git a/testsuite/tests/rts/T7037_main.c b/testsuite/tests/rts/T7037_main.c index c195834650..ce7fa65b02 100644 --- a/testsuite/tests/rts/T7037_main.c +++ b/testsuite/tests/rts/T7037_main.c @@ -2,9 +2,6 @@ #include <unistd.h> int main(int argc, char *argv[]) { -#ifdef __MINGW32__ - const -#endif - char * args[2] = {"T7037", NULL}; + T7037_CONST char * args[2] = {"T7037", NULL}; execv("./T7037", args); } diff --git a/testsuite/tests/rts/T7636.hs b/testsuite/tests/rts/T7636.hs new file mode 100644 index 0000000000..9e3dbd69d2 --- /dev/null +++ b/testsuite/tests/rts/T7636.hs @@ -0,0 +1,13 @@ +import GHC.Conc.Sync +import System.Environment + +test n = atomically $ f [1..n] + where + f [] = retry + f (x:xs) = do + ys <- f xs + return (x:ys) + +main = do + [n] <- getArgs + test (read n) diff --git a/testsuite/tests/rts/T7636.stderr b/testsuite/tests/rts/T7636.stderr new file mode 100644 index 0000000000..76984e3b7a --- /dev/null +++ b/testsuite/tests/rts/T7636.stderr @@ -0,0 +1 @@ +T7636: thread blocked indefinitely in an STM transaction diff --git a/testsuite/tests/rts/all.T b/testsuite/tests/rts/all.T index 50c6b3b003..05510e9ad1 100644 --- a/testsuite/tests/rts/all.T +++ b/testsuite/tests/rts/all.T @@ -85,9 +85,9 @@ test('T2615', if_os('darwin', skip), # Solaris' linker does not support GNUish linker scripts if_os('solaris2', skip), - cmd_prefix('$MAKE T2615-prep && ' + - # Add current directory to dlopen search path - 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. '), + pre_cmd('$MAKE -s --no-print-directory T2615-prep'), + # Add current directory to dlopen search path + cmd_prefix('LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. '), extra_clean(['libfoo_T2615.so', 'libfoo_T2615.o'])], compile_and_run, ['-package ghc']) @@ -106,7 +106,8 @@ test('T4059', # Test for #4274 test('exec_signals', [ if_os('mingw32', skip), - cmd_prefix('$MAKE exec_signals-prep && ./exec_signals_prepare'), + pre_cmd('$MAKE -s --no-print-directory exec_signals-prep'), + cmd_prefix('./exec_signals_prepare'), extra_clean(['exec_signals_child', 'exec_signals_prepare']) ], compile_and_run, ['']) @@ -114,7 +115,7 @@ test('return_mem_to_os', normal, compile_and_run, ['']) test('T4850', normal, run_command, ['$MAKE -s --no-print-directory T4850']) -def config_T5250(opts): +def config_T5250(name, opts): if not (config.arch in ['i386','x86_64']): opts.skip = 1; @@ -136,7 +137,7 @@ test('T5993', extra_run_opts('+RTS -k8 -RTS'), compile_and_run, ['']) test('T6006', [ omit_ways(prof_ways + ['ghci']), extra_clean(['T6006_c.o']), - compile_cmd_prefix('$MAKE T6006_setup && ') ], + pre_cmd('$MAKE -s --no-print-directory T6006_setup') ], # The T6006_setup hack is to ensure that we generate # T6006_stub.h before compiling T6006_c.c, which # needs it. @@ -154,10 +155,12 @@ test('T7040', [ extra_clean(['T7040_c.o']), omit_ways(['ghci']) ], compile_and_run, ['T7040_c.c']) test('T7040_ghci', [ only_ways(['ghci']), - cmd_prefix('$MAKE T7040_ghci_setup && '), + pre_cmd('$MAKE -s --no-print-directory T7040_ghci_setup'), extra_clean(['T7040_ghci_c.o']) ], compile_and_run, ['T7040_ghci_c.o']) test('T7227', [ extra_run_opts('+RTS -tT7227.stat --machine-readable -RTS'), extra_clean(['T7227.stat']) ] , compile_and_run, [''] ) + +test('T7636', [ exit_code(1), extra_run_opts('100000') ], compile_and_run, [''] ) diff --git a/testsuite/tests/safeHaskell/check/all.T b/testsuite/tests/safeHaskell/check/all.T index ca6ba0f372..59ab4fdb97 100644 --- a/testsuite/tests/safeHaskell/check/all.T +++ b/testsuite/tests/safeHaskell/check/all.T @@ -2,7 +2,7 @@ # check of safe haskell is working properly. # Just do the normal way, SafeHaskell is all in the frontend -def f( opts ): +def f( name, opts ): opts.only_ways = ['normal'] setTestOpts(f) diff --git a/testsuite/tests/safeHaskell/check/pkg01/all.T b/testsuite/tests/safeHaskell/check/pkg01/all.T index 0f5f2024e5..08f0b61820 100644 --- a/testsuite/tests/safeHaskell/check/pkg01/all.T +++ b/testsuite/tests/safeHaskell/check/pkg01/all.T @@ -1,5 +1,5 @@ # Just do the normal way, SafeHaskell is all in the frontend -def f( opts ): +def f( name, opts ): opts.only_ways = ['normal'] def normaliseArrayPackage(str): @@ -8,6 +8,9 @@ def normaliseArrayPackage(str): def normaliseBytestringPackage(str): return re.sub('bytestring-[0-9]+(\.[0-9]+)*', 'bytestring-<VERSION>', str) +def ignoreLdOutput(str): + return re.sub('Creating library file: pdb.safePkg01/dist.build.libHSsafePkg01-1.0-ghc[0-9.]*.dll.a\n', '', str) + setTestOpts(f) if config.have_vanilla: @@ -31,6 +34,7 @@ make_args = 'VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn # and can be changed correctly test('safePkg01', [clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.safePkg01'), + normalise_errmsg_fun(ignoreLdOutput), normalise_fun(two_normalisers(normaliseArrayPackage, normaliseBytestringPackage))], run_command, diff --git a/testsuite/tests/safeHaskell/flags/all.T b/testsuite/tests/safeHaskell/flags/all.T index 713439567d..fff8841797 100644 --- a/testsuite/tests/safeHaskell/flags/all.T +++ b/testsuite/tests/safeHaskell/flags/all.T @@ -4,7 +4,7 @@ # has been dropped. # Just do the normal way, SafeHaskell is all in the frontend -def f( opts ): +def f( name, opts ): opts.only_ways = ['normal'] setTestOpts(f) diff --git a/testsuite/tests/safeHaskell/ghci/all.T b/testsuite/tests/safeHaskell/ghci/all.T index 2a91b33108..2dca62efd6 100644 --- a/testsuite/tests/safeHaskell/ghci/all.T +++ b/testsuite/tests/safeHaskell/ghci/all.T @@ -5,7 +5,7 @@ def normaliseBytestringPackage(str): test('p1', normal, ghci_script, ['p1.script']) test('p2', normal, ghci_script, ['p2.script']) -test('p3', normalise_fun(normaliseBytestringPackage), +test('p3', normalise_errmsg_fun(normaliseBytestringPackage), ghci_script, ['p3.script']) test('p4', normal, ghci_script, ['p4.script']) test('p5', normal, ghci_script, ['p5.script']) @@ -15,13 +15,13 @@ test('p8', normal, ghci_script, ['p8.script']) test('p9', normal, ghci_script, ['p9.script']) test('p10', normal, ghci_script, ['p10.script']) test('p11', normal, ghci_script, ['p11.script']) -test('p12', normalise_fun(normaliseBytestringPackage), +test('p12', normalise_errmsg_fun(normaliseBytestringPackage), ghci_script, ['p12.script']) test('p13', normal, ghci_script, ['p13.script']) test('p14', normal, ghci_script, ['p14.script']) test('p15', normal, ghci_script, ['p15.script']) test('p16', normal, ghci_script, ['p16.script']) -test('p17', normalise_fun(normaliseBytestringPackage), +test('p17', normalise_errmsg_fun(normaliseBytestringPackage), ghci_script, ['p17.script']) # 7172 test('p18', normalise_fun(normaliseBytestringPackage), diff --git a/testsuite/tests/safeHaskell/safeInfered/all.T b/testsuite/tests/safeHaskell/safeInfered/all.T index dee056a614..47e9656279 100644 --- a/testsuite/tests/safeHaskell/safeInfered/all.T +++ b/testsuite/tests/safeHaskell/safeInfered/all.T @@ -2,7 +2,7 @@ # mode safe inference works correctly. # Just do the normal way, SafeHaskell is all in the frontend -def f( opts ): +def f( name, opts ): opts.only_ways = ['normal'] setTestOpts(f) diff --git a/testsuite/tests/safeHaskell/safeLanguage/all.T b/testsuite/tests/safeHaskell/safeLanguage/all.T index 506b45d432..f8479b12c3 100644 --- a/testsuite/tests/safeHaskell/safeLanguage/all.T +++ b/testsuite/tests/safeHaskell/safeLanguage/all.T @@ -4,7 +4,7 @@ # works correctly (incluidng testing safe imports a little). # Just do the normal way, SafeHaskell is all in the frontend -def f( opts ): +def f( name, opts ): opts.only_ways = ['normal'] setTestOpts(f) diff --git a/testsuite/tests/safeHaskell/unsafeLibs/all.T b/testsuite/tests/safeHaskell/unsafeLibs/all.T index eddf9566cf..69d1804b02 100644 --- a/testsuite/tests/safeHaskell/unsafeLibs/all.T +++ b/testsuite/tests/safeHaskell/unsafeLibs/all.T @@ -4,7 +4,7 @@ # Checking base package is properly safe basically # Just do the normal way, SafeHaskell is all in the frontend -def f( opts ): +def f( name, opts ): opts.only_ways = ['normal'] setTestOpts(f) diff --git a/testsuite/tests/simplCore/should_run/all.T b/testsuite/tests/simplCore/should_run/all.T index 40c553fe8c..545dadbf6e 100644 --- a/testsuite/tests/simplCore/should_run/all.T +++ b/testsuite/tests/simplCore/should_run/all.T @@ -4,7 +4,7 @@ # expected process return value, if not zero # Only compile with optimisation -def f( opts ): +def f( name, opts ): opts.only_ways = ['optasm'] setTestOpts(f) diff --git a/testsuite/tests/simplCore/should_run/simplrun004.hs b/testsuite/tests/simplCore/should_run/simplrun004.hs index 16e7566ee2..e76274f971 100644 --- a/testsuite/tests/simplCore/should_run/simplrun004.hs +++ b/testsuite/tests/simplCore/should_run/simplrun004.hs @@ -23,7 +23,7 @@ sucW = gen_sucW (\ g x -> map (+x) [fst g..snd g]) f (11,500000) main = print (sum $ sucW 11,sum $ sucW 12) --- Becuase this version uses a case expression, the bug +-- Because this version uses a case expression, the bug -- doesn't happen and execution is much faster gen_sucC grow c g = case c g of check -> \ x -> grow g x >>= \ y -> do guard $ check y; return y diff --git a/testsuite/tests/th/T1849.script b/testsuite/tests/th/T1849.script new file mode 100644 index 0000000000..861b8d43d3 --- /dev/null +++ b/testsuite/tests/th/T1849.script @@ -0,0 +1,10 @@ +:set -XTemplateHaskell +import Language.Haskell.TH +let seeType n = do VarI _ t _ _ <- reify n; runIO $ putStrLn $ show t; [| return True |] +let f = undefined :: Int -> Int +let g = undefined :: [Int] +let h = undefined :: (Int, Int) +$(seeType (mkName "f")) +$(seeType (mkName "g")) +$(seeType (mkName "h")) + diff --git a/testsuite/tests/th/T1849.stdout b/testsuite/tests/th/T1849.stdout new file mode 100644 index 0000000000..3d48e778a5 --- /dev/null +++ b/testsuite/tests/th/T1849.stdout @@ -0,0 +1,6 @@ +AppT (AppT ArrowT (ConT GHC.Types.Int)) (ConT GHC.Types.Int) +True +AppT ListT (ConT GHC.Types.Int) +True +AppT (AppT (TupleT 2) (ConT GHC.Types.Int)) (ConT GHC.Types.Int) +True diff --git a/testsuite/tests/th/T2222.hs b/testsuite/tests/th/T2222.hs new file mode 100644 index 0000000000..9a97c0d4d3 --- /dev/null +++ b/testsuite/tests/th/T2222.hs @@ -0,0 +1,36 @@ + +{-# LANGUAGE TemplateHaskell #-} +module ReifyPlusTypeInferenceBugs where + +import Language.Haskell.TH +import System.IO + +a = 1 + +b = $(do VarI _ t _ _ <- reify 'a + runIO $ putStrLn ("inside b: " ++ pprint t) + [| undefined |]) + +c = $([| True |]) + +d = $(do VarI _ t _ _ <- reify 'c + runIO $ putStrLn ("inside d: " ++ pprint t) + [| undefined |] ) + +$(do VarI _ t _ _ <- reify 'c + runIO $ putStrLn ("type of c: " ++ pprint t) + return [] ) + +e = $([| True |]) + +f = $(do VarI _ t _ _ <- reify 'e + runIO $ putStrLn ("inside f: " ++ pprint t) + [| undefined |] ) + +$(do VarI _ t _ _ <- reify 'e + runIO $ putStrLn ("type of e: " ++ pprint t) + return [] ) + +$( runIO $ do hFlush stdout + hFlush stderr + return [] ) diff --git a/testsuite/tests/th/T2222.stderr b/testsuite/tests/th/T2222.stderr new file mode 100644 index 0000000000..7d90eb3e94 --- /dev/null +++ b/testsuite/tests/th/T2222.stderr @@ -0,0 +1,5 @@ +inside d: t_0 +inside b: a_0 +type of c: GHC.Types.Bool +inside f: GHC.Types.Bool +type of e: GHC.Types.Bool diff --git a/testsuite/tests/th/TH_spliceViewPat/test.T b/testsuite/tests/th/TH_spliceViewPat/test.T index c93e1cb3a7..b177c075b3 100644 --- a/testsuite/tests/th/TH_spliceViewPat/test.T +++ b/testsuite/tests/th/TH_spliceViewPat/test.T @@ -1,4 +1,4 @@ -def f(opts): +def f(name, opts): opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell' if (ghc_with_interpreter == 0): opts.skip = 1 diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T index 21464d2bbd..e9c6c08cd1 100644 --- a/testsuite/tests/th/all.T +++ b/testsuite/tests/th/all.T @@ -3,7 +3,7 @@ # to run it !if_compiler_profiled test('T4255', unless_compiler_profiled(skip), compile_fail, ['-v0']) -def f(opts): +def f(name, opts): opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell' if (ghc_with_interpreter == 0): opts.skip = 1 @@ -267,3 +267,5 @@ test('T7532', extra_clean(['T7532a.hi', 'T7532a.o']), multimod_compile, ['T7532', '-v0']) +test('T2222', normal, compile, ['-v0']) +test('T1849', normal, ghci_script, ['T1849.script']) diff --git a/testsuite/tests/typecheck/should_compile/all.T b/testsuite/tests/typecheck/should_compile/all.T index 94ebf41fd1..da91233691 100644 --- a/testsuite/tests/typecheck/should_compile/all.T +++ b/testsuite/tests/typecheck/should_compile/all.T @@ -1,6 +1,6 @@ # Args to vtc are: extra compile flags -def f( opts ): +def f( name, opts ): opts.extra_hc_opts = '-fno-warn-incomplete-patterns' setTestOpts(f) diff --git a/testsuite/tests/typecheck/should_compile/tc167.hs b/testsuite/tests/typecheck/should_compile/tc167.hs index b317763831..cadb1a7fba 100644 --- a/testsuite/tests/typecheck/should_compile/tc167.hs +++ b/testsuite/tests/typecheck/should_compile/tc167.hs @@ -17,7 +17,7 @@ f x = x -- You might think that (->) should have type (? -> ? -> *), and you'd be right -- But if we do that we get kind errors when saying -- instance Control.Arrow (->) --- becuase the expected kind is (*->*->*). The trouble is that the +-- because the expected kind is (*->*->*). The trouble is that the -- expected/actual stuff in the unifier does not go contra-variant, whereas -- the kind sub-typing does. Sigh. It really only matters if you use (->) in -- a prefix way, thus: (->) Int# Int#. And this is unusual. diff --git a/testsuite/tests/typecheck/should_fail/tcfail032.hs b/testsuite/tests/typecheck/should_fail/tcfail032.hs index 5950064655..8c6bdd46c7 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail032.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail032.hs @@ -6,7 +6,7 @@ It *is* an error, because x does not have the polytype forall a. Eq a => a -> Int -becuase it is monomorphic, but the error message isn't very illuminating. +because it is monomorphic, but the error message isn't very illuminating. -} module ShouldFail where diff --git a/testsuite/tests/typecheck/should_fail/tcfail132.hs b/testsuite/tests/typecheck/should_fail/tcfail132.hs index cc933dc6ee..dd8d644abc 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail132.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail132.hs @@ -4,7 +4,7 @@ -- Kind error: Expecting kind `k_a1JA -> k_a1JE -> k_a1JI -> *', -- but `DUnit t' has kind `k_a1JA -> k_a1JE -> *' -- --- as we couldn't tidy kinds, becuase they didn't have OccNames. +-- as we couldn't tidy kinds, because they didn't have OccNames. -- This test recalls the bad error message. module ShouldFail where diff --git a/testsuite/tests/typecheck/should_fail/tcfail181.hs b/testsuite/tests/typecheck/should_fail/tcfail181.hs index 01d06599ef..ca96a2c07e 100644 --- a/testsuite/tests/typecheck/should_fail/tcfail181.hs +++ b/testsuite/tests/typecheck/should_fail/tcfail181.hs @@ -4,7 +4,7 @@ -- (Monad GHC.Prim.Any1, Monad m) => -- t -> Something (m Bool) e -- --- The stupid 'GHC.Prim.Any1' arose becuase of type ambiguity +-- The stupid 'GHC.Prim.Any1' arose because of type ambiguity -- which should be reported, and wasn't. module ShouldFail where diff --git a/testsuite/tests/typecheck/should_run/all.T b/testsuite/tests/typecheck/should_run/all.T index 4c9d7abffb..083088c3e2 100755 --- a/testsuite/tests/typecheck/should_run/all.T +++ b/testsuite/tests/typecheck/should_run/all.T @@ -16,7 +16,7 @@ test('Defer01', normal, compile_and_run, ['']) # ----------------------------------------------------------------------------- # Skip everything else if fast is on -def f(opts): +def f(name, opts): if config.fast: opts.skip = 1 setTestOpts(f) diff --git a/testsuite/timeout/timeout.py b/testsuite/timeout/timeout.py index 76660a7390..6a57ac2f82 100644 --- a/testsuite/timeout/timeout.py +++ b/testsuite/timeout/timeout.py @@ -1,46 +1,53 @@ #!/usr/bin/env python -import errno -import os -import signal -import sys -import time +try: -secs = int(sys.argv[1]) -cmd = sys.argv[2] + import errno + import os + import signal + import sys + import time -def killProcess(pid): - os.killpg(pid, signal.SIGKILL) - for x in range(10): - try: - time.sleep(0.3) - r = os.waitpid(pid, os.WNOHANG) - if r == (0, 0): - os.killpg(pid, signal.SIGKILL) - else: - return - except OSError, e: - if e.errno == errno.ECHILD: - return - else: - raise e + secs = int(sys.argv[1]) + cmd = sys.argv[2] -pid = os.fork() -if pid == 0: - # child - os.setpgrp() - os.execvp('/bin/sh', ['/bin/sh', '-c', cmd]) -else: - # parent - def handler(signum, frame): - sys.stderr.write('Timeout happened...killing process...\n') - killProcess(pid) - sys.exit(99) - old = signal.signal(signal.SIGALRM, handler) - signal.alarm(secs) - (pid2, res) = os.waitpid(pid, 0) - if (os.WIFEXITED(res)): - sys.exit(os.WEXITSTATUS(res)) + def killProcess(pid): + os.killpg(pid, signal.SIGKILL) + for x in range(10): + try: + time.sleep(0.3) + r = os.waitpid(pid, os.WNOHANG) + if r == (0, 0): + os.killpg(pid, signal.SIGKILL) + else: + return + except OSError, e: + if e.errno == errno.ECHILD: + return + else: + raise e + + pid = os.fork() + if pid == 0: + # child + os.setpgrp() + os.execvp('/bin/sh', ['/bin/sh', '-c', cmd]) else: - sys.exit(res) + # parent + def handler(signum, frame): + sys.stderr.write('Timeout happened...killing process...\n') + killProcess(pid) + sys.exit(99) + old = signal.signal(signal.SIGALRM, handler) + signal.alarm(secs) + (pid2, res) = os.waitpid(pid, 0) + if (os.WIFEXITED(res)): + sys.exit(os.WEXITSTATUS(res)) + else: + sys.exit(res) + +except KeyboardInterrupt: + sys.exit(98) +except: + raise |