Commit aea57e43 authored by ian@well-typed.com's avatar ian@well-typed.com

Remove uses of compose(s) in tests, and change how composition is handled

The driver now also supports nested lists of setup functions
parent be6d11c3
......@@ -62,7 +62,7 @@ def setLocalTestOpts(opts):
# for the following tests.
def setTestOpts( f ):
global thisdir_settings
thisdir_settings = compose(thisdir_settings, f)
thisdir_settings = [thisdir_settings, f]
# -----------------------------------------------------------------------------
# Canned setup functions for common cases. eg. for a test you might say
......@@ -475,15 +475,16 @@ def two_normalisers(f, g):
# ----
# Function for composing two opt-fns together
def composes( fs ):
return reduce(lambda f, g: compose(f, g), fs)
def executeSetups(fs, name, opts):
if type(fs) is types.ListType:
# If we have a list of setups, then execute each one
map (lambda f : executeSetups(f, name, opts), fs)
else:
# fs is a single function, so just apply it
fs(name, opts)
def compose( f, g ):
return lambda name, opts, f=f, g=g: _compose(name, opts, f, g)
def _compose( name, opts, f, g ):
f(name, opts)
g(name, opts)
return [f, g]
# -----------------------------------------------------------------------------
# The current directory of tests
......@@ -539,11 +540,7 @@ def test (name, setup, func, args):
# them, all tests will see the modified version!
myTestOpts = copy.deepcopy(default_testopts)
if type(setup) is types.ListType:
setup = composes(setup)
setup = compose(thisdir_settings, setup)
setup(name, myTestOpts)
executeSetups([thisdir_settings, setup], name, myTestOpts)
thisTest = lambda : runTest(myTestOpts, name, func, args)
if myTestOpts.alone:
......
......@@ -6,12 +6,12 @@
test('arr001', when(fast(), skip), compile_and_run, [''])
test('arr002', when(fast(), skip), compile_and_run, [''])
test('arr003', compose(when(fast(), skip),exit_code(1)), compile_and_run, [''])
test('arr004', compose(when(fast(), skip),exit_code(1)), compile_and_run, [''])
test('arr003', [when(fast(), skip),exit_code(1)], compile_and_run, [''])
test('arr004', [when(fast(), skip),exit_code(1)], compile_and_run, [''])
test('arr005', when(fast(), skip), compile_and_run, [''])
test('arr006', when(fast(), skip), compile_and_run, [''])
test('arr007', compose(when(fast(), skip),exit_code(1)), compile_and_run, [''])
test('arr008', compose(when(fast(), skip),exit_code(1)), compile_and_run, [''])
test('arr007', [when(fast(), skip),exit_code(1)], compile_and_run, [''])
test('arr008', [when(fast(), skip),exit_code(1)], compile_and_run, [''])
test('arr009', when(fast(), skip), compile_and_run, [''])
test('arr010', when(fast(), skip), compile_and_run, [''])
test('arr011', when(fast(), skip), compile_and_run, [''])
......
......@@ -24,8 +24,9 @@ test('cgrun020', normal, compile_and_run, [''])
test('cgrun021', normal, compile_and_run, [''])
test('cgrun022', normal, compile_and_run, [''])
test('cgrun024', normal, compile_and_run, [''])
test('cgrun025', compose(reqlib('regex-compat'), compose(extra_run_opts('cg025.hs'),exit_code(1))),
compile_and_run, ['-package regex-compat'])
test('cgrun025',
[reqlib('regex-compat'), extra_run_opts('cg025.hs'), exit_code(1)],
compile_and_run, ['-package regex-compat'])
test('cgrun026', only_compiler_types(['ghc']), compile_and_run, [''])
test('cgrun027', normal, compile_and_run, [''])
test('cgrun028', normal, compile_and_run, [''])
......@@ -48,7 +49,8 @@ test('cgrun048', normal, compile_and_run, [''])
test('cgrun049', normal, compile_and_run, ['-funbox-strict-fields'])
test('cgrun050', normal, compile_and_run, [''])
# Doesn't work with External Core due to datatype declaration with no constructors
test('cgrun051', (compose (expect_fail_for(['extcore','optextcore']),exit_code(1))), compile_and_run, [''])
test('cgrun051', [expect_fail_for(['extcore','optextcore']), exit_code(1)],
compile_and_run, [''])
test('cgrun052', only_ways(['optasm']), compile_and_run, ['-funbox-strict-fields'])
test('cgrun053', normal, compile_and_run, [''])
test('cgrun054', normal, compile_and_run, [''])
......
......@@ -22,8 +22,8 @@ test('conc072', only_ways(['threaded2']), compile_and_run, [''])
test('conc073', normal, compile_and_run, [''])
# vector code must get inlined to become non-allocating
test('T367', composes([reqlib('vector'), timeout_multiplier(0.001)]), compile_and_run, ['-O2 -fno-omit-yields'])
test('T367_letnoescape', composes([timeout_multiplier(0.001)]), compile_and_run, ['-fno-omit-yields'])
test('T367', [reqlib('vector'), timeout_multiplier(0.001)], compile_and_run, ['-O2 -fno-omit-yields'])
test('T367_letnoescape', [timeout_multiplier(0.001)], compile_and_run, ['-fno-omit-yields'])
test('T1980', normal, compile_and_run, [''])
test('T2910', normal, compile_and_run, [''])
......@@ -89,11 +89,11 @@ test('conc002', normal, compile_and_run, [''])
# Omit GHCi way - it blows up to 0.5G. Something to do with the threaded RTS?
test('conc004', omit_ways(['ghci']), compile_and_run, [''])
test('conc007', compose(only_compiler_types(['ghc']),
extra_run_opts('+RTS -H128M -RTS')),
test('conc007', [only_compiler_types(['ghc']),
extra_run_opts('+RTS -H128M -RTS')],
compile_and_run, [''])
test('conc008', only_compiler_types(['ghc']), compile_and_run, [''])
test('conc009', compose(only_compiler_types(['ghc']), exit_code(1)),
test('conc009', [only_compiler_types(['ghc']), exit_code(1)],
compile_and_run, [''])
test('conc010', only_compiler_types(['ghc']), compile_and_run, [''])
......@@ -110,8 +110,8 @@ test('conc016', [ omit_ways(['threaded2']), # see comment in conc016.hs
test('conc017', only_compiler_types(['ghc']), compile_and_run, [''])
test('conc017a', only_compiler_types(['ghc']), compile_and_run, [''])
test('conc018', only_compiler_types(['ghc']), compile_and_run, [''])
test('conc019', compose(only_compiler_types(['ghc']),
extra_run_opts('+RTS -K16m -RTS')),
test('conc019', [only_compiler_types(['ghc']),
extra_run_opts('+RTS -K16m -RTS')],
compile_and_run, [''])
test('conc020', only_compiler_types(['ghc']), compile_and_run, [''])
test('conc021', [ omit_ways(['ghci']), exit_code(1) ], compile_and_run, [''])
......@@ -127,18 +127,18 @@ if config.platform == 'i386-unknown-mingw32':
else:
conc023_ways = normal
test('conc023', composes([when(fast(), skip),
only_compiler_types(['ghc']),
reqlib('random'),
conc023_ways]), compile_and_run, [''])
test('conc023', [when(fast(), skip),
only_compiler_types(['ghc']),
reqlib('random'),
conc023_ways], compile_and_run, [''])
test('conc024', only_compiler_types(['ghc']), compile_and_run, [''])
test('conc025', normal, compile_and_run, [''])
test('conc026', only_compiler_types(['ghc']), compile_and_run, [''])
test('conc028', normal, compile_and_run, [''])
test('conc029', normal, compile_and_run, [''])
test('conc030', compose(only_compiler_types(['ghc']),
extra_run_opts('+RTS -K4M -RTS')),
test('conc030',
[only_compiler_types(['ghc']), extra_run_opts('+RTS -K4M -RTS')],
compile_and_run, [''])
test('conc031', normal, compile_and_run, [''])
......@@ -147,9 +147,9 @@ test('conc032', only_compiler_types(['ghc']), compile_and_run, [''])
test('conc033', normal, compile_and_run, [''])
# Omit for GHCi, because it just sits there waiting for you to press ^C
test('conc034', compose(only_compiler_types(['ghc']),
compose(omit_ways(['ghci']),
extra_run_opts('+RTS -C0 -RTS'))),
test('conc034', [only_compiler_types(['ghc']),
omit_ways(['ghci']),
extra_run_opts('+RTS -C0 -RTS')],
compile_and_run, [''])
test('conc035', only_compiler_types(['ghc']), compile_and_run, [''])
......@@ -187,9 +187,8 @@ test('conc038', only_ways(['threaded1','threaded2']), compile_and_run, [''])
test('conc039', omit_ways(['ghci','threaded1','threaded2','profthreaded']), compile_and_run, [''])
# Omit for GHCi, uses foreign export
test('conc040', compose(only_compiler_types(['ghc']),
compose(exit_code(1),
omit_ways(['ghci']))),
test('conc040',
[only_compiler_types(['ghc']), exit_code(1), omit_ways(['ghci'])],
compile_and_run, [''])
# STM-related tests.
......
......@@ -19,7 +19,7 @@ test('drvrun013', when(fast(), skip), compile_and_run, [''])
test('drvrun014', when(fast(), skip), compile_and_run, [''])
test('drvrun015', when(fast(), skip), compile_and_run, [''])
test('drvrun016', when(fast(), skip), compile_and_run, ['-funbox-strict-fields'])
test('drvrun017', compose(when(fast(), skip), only_compiler_types(['ghc'])), compile_and_run, [''])
test('drvrun017', [when(fast(), skip), only_compiler_types(['ghc'])], compile_and_run, [''])
test('drvrun018', when(fast(), skip), compile_and_run, [''])
test('drvrun019', normal, compile_and_run, [''])
test('drvrun020', normal, compile_and_run, [''])
......
......@@ -5,8 +5,8 @@
# expected process return value, if not zero
# Doesn't work with External Core due to __labels
test('fed001', compose(only_compiler_types(['ghc']),
expect_fail_for(['extcore','optextcore'])),
test('fed001', [only_compiler_types(['ghc']),
expect_fail_for(['extcore','optextcore'])],
compile_and_run, [''])
# Omit GHCi for these two, as they use foreign export
......@@ -48,13 +48,14 @@ test('ffi006', expect_fail_for(['extcore','optextcore']), compile_and_run, [''])
# Sometimes we end up with the wrong exit code, or get an extra
# 'interrupted' message from the GHCi thread shutting down.
test('ffi007', compose( omit_ways(['ghci']),
expect_fail_for(['extcore','optextcore']) ),
test('ffi007',
[omit_ways(['ghci']), expect_fail_for(['extcore','optextcore'])],
compile_and_run, [''])
test('ffi008', compose(expect_fail_for(['extcore','optextcore']),
compose(exit_code(1),
omit_ways(['ghci']))),
test('ffi008',
[expect_fail_for(['extcore','optextcore']),
exit_code(1),
omit_ways(['ghci'])],
compile_and_run, [''])
# On i386, we need -msse2 to get reliable floating point results
......@@ -145,7 +146,7 @@ test('fptr01', [ omit_ways(['ghci']), extra_clean(['fptr01_c.o']) ],
compile_and_run, ['fptr01_c.c'])
test('fptr02', normal, compile_and_run, [''])
test('fptrfail01', [ compose(omit_ways(['ghci']), exit_code(1)),
test('fptrfail01', [ omit_ways(['ghci']), exit_code(1),
extra_clean(['fptrfail01_c.o']) ],
compile_and_run, ['fptrfail01_c.c'])
......
setTestOpts(composes([extra_run_opts('-ignore-dot-ghci'),
when(compiler_profiled(), skip),
normalise_slashes]))
setTestOpts([extra_run_opts('-ignore-dot-ghci'),
when(compiler_profiled(), skip),
normalise_slashes])
test('print001', normal, ghci_script, ['print001.script'])
test('print002', normal, ghci_script, ['print002.script'])
......
......@@ -29,7 +29,7 @@ test('arith011', normal, compile_and_run, [''])
test('arith012', ways, compile_and_run, [opts])
test('arith013', compose(normal,only_compiler_types(['ghc'])), compile_and_run, [''])
test('arith013', only_compiler_types(['ghc']), compile_and_run, [''])
test('arith014', normal, compile_and_run, [''])
test('arith015', normal, compile_and_run, [''])
test('numrun009', normal, compile_and_run, [''])
......@@ -38,7 +38,7 @@ test('numrun011', normal, compile_and_run, [''])
test('numrun012', normal, compile_and_run, [''])
test('numrun013', normal, compile_and_run, [''])
test('numrun014', normal, compile_and_run, [''])
test('arith016', compose(normal,only_compiler_types(['ghc'])), compile_and_run, [''])
test('arith016', [normal,only_compiler_types(['ghc'])], compile_and_run, [''])
test('arith017', normal, compile_and_run, [''])
test('arith018', normal, compile_and_run, [''])
test('arith019', normal, compile_and_run, [''])
......
# We need to run prof001 and prof002 the normal way, as the extra flags
# added for the profiling ways makes it pass
test('prof001', compose(only_ways(['normal']), req_profiling), compile_and_run, ['-prof -caf-all'])
test('prof002', compose(only_ways(['normal']), req_profiling), compile_and_run, ['-prof -caf-all'])
test('prof001', [only_ways(['normal']), req_profiling], compile_and_run, ['-prof -caf-all'])
test('prof002', [only_ways(['normal']), req_profiling], compile_and_run, ['-prof -caf-all'])
test('T2410', compose(only_ways(['normal']), req_profiling), compile, ['-O2 -prof -caf-all'])
test('T2410', [only_ways(['normal']), req_profiling], compile, ['-O2 -prof -caf-all'])
......@@ -3,10 +3,10 @@
extra_prof_ways = ['prof', 'prof_hc_hb', 'prof_hb', 'prof_hd', 'prof_hy', 'prof_hr']
test('heapprof001',
composes([only_ways(prof_ways),
extra_ways(extra_prof_ways),
req_profiling,
extra_run_opts('7')]),
[only_ways(prof_ways),
extra_ways(extra_prof_ways),
req_profiling,
extra_run_opts('7')],
compile_and_run, [''])
test('T2592',
......
test('testblockalloc', compose(c_src,
compose(only_ways(['normal','threaded1']),
extra_run_opts('+RTS -I0'))),
compile_and_run, [''])
test('testblockalloc',
[c_src, only_ways(['normal','threaded1']), extra_run_opts('+RTS -I0')],
compile_and_run, [''])
# See bug #101, test requires +RTS -c (or equivalently +RTS -M<something>)
# only GHCi triggers the bug, but we run the test all ways for completeness.
test('bug1010', normal, compile_and_run, ['+RTS -c -RTS'])
test('derefnull',
composes([
when(platform('x86_64-unknown-mingw32'), expect_broken(6079)),
# LLVM Optimiser considers dereference of a null pointer
# undefined and marks the code as unreachable which means
# that later optimisations remove it altogether.
omit_ways(['optllvm']),
# SIGSEGV on Linux (which we make the default)
exit_code(139),
# Apparently the output can be different on different
# Linux setups, so just ignore it. As long as we get
# the right exit code we're OK.
when(opsys('linux'), ignore_output),
# SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
when(platform('i386-apple-darwin'), exit_code(138)),
when(platform('powerpc-apple-darwin'), exit_code(138)),
when(opsys('mingw32'), exit_code(1))]),
[when(platform('x86_64-unknown-mingw32'), expect_broken(6079)),
# LLVM Optimiser considers dereference of a null pointer
# undefined and marks the code as unreachable which means
# that later optimisations remove it altogether.
omit_ways(['optllvm']),
# SIGSEGV on Linux (which we make the default)
exit_code(139),
# Apparently the output can be different on different
# Linux setups, so just ignore it. As long as we get
# the right exit code we're OK.
when(opsys('linux'), ignore_output),
# SIGBUS on OX X (PPC and x86 only; amd64 gives SEGV)
when(platform('i386-apple-darwin'), exit_code(138)),
when(platform('powerpc-apple-darwin'), exit_code(138)),
when(opsys('mingw32'), exit_code(1))],
compile_and_run, [''])
test('divbyzero',
composes([
when(platform('x86_64-unknown-mingw32'), expect_broken(6079)),
# SIGFPE on Linux
exit_code(136),
# Apparently the output can be different on different
# Linux setups, so just ignore it. As long as we get
# the right exit code we're OK.
when(opsys('linux'), ignore_output),
when(opsys('mingw32'), exit_code(1))]),
[when(platform('x86_64-unknown-mingw32'), expect_broken(6079)),
# SIGFPE on Linux
exit_code(136),
# Apparently the output can be different on different
# Linux setups, so just ignore it. As long as we get
# the right exit code we're OK.
when(opsys('linux'), ignore_output),
when(opsys('mingw32'), exit_code(1))],
compile_and_run, [''])
test('outofmem', when(opsys('darwin'), skip),
......@@ -42,7 +39,7 @@ test('outofmem', when(opsys('darwin'), skip),
test('outofmem2', extra_run_opts('+RTS -M5m -RTS'),
run_command, ['$MAKE -s --no-print-directory outofmem2'])
test('T2047', compose(ignore_output, extra_run_opts('+RTS -c -RTS')),
test('T2047', [ignore_output, extra_run_opts('+RTS -c -RTS')],
compile_and_run, ['-package containers'])
# Blackhole-detection test.
......
......@@ -18,8 +18,8 @@ test('simplrun005', normal, compile_and_run, [''])
test('simplrun007', normal, compile_and_run, [''])
test('simplrun008', normal, compile_and_run, [''])
test('simplrun009', normal, compile_and_run, [''])
test('simplrun010', composes([extra_run_opts('24 16 8 +RTS -M10m -RTS'),
exit_code(251)])
test('simplrun010', [extra_run_opts('24 16 8 +RTS -M10m -RTS'),
exit_code(251)]
, compile_and_run, [''])
# Really we'd like to run T2486 too, to check that its
......
......@@ -38,7 +38,8 @@ test('tcrun020', normal, compile_and_run, [''])
# Doesn't work with External Core due to datatype with no constructors
test('tcrun021', expect_fail_for(['extcore','optextcore']),
compile_and_run, ['-package containers'])
test('tcrun022', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, ['-O'])
test('tcrun022', [omit_ways(['ghci']),only_compiler_types(['ghc'])],
compile_and_run, ['-O'])
test('tcrun023', normal, compile_and_run, ['-O'])
test('tcrun024', normal, compile_and_run, ['-O'])
test('tcrun025', extra_clean(['TcRun025_B.hi', 'TcRun025_B.o']),
......@@ -70,11 +71,16 @@ test('tcrun043', normal, compile_and_run, [''])
test('tcrun044', normal, compile_and_run, [''])
test('tcrun045', normal, compile_and_run, [''])
test('tcrun046', normal, compile_and_run, [''])
test('tcrun047', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, [''])
test('tcrun048', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, [''])
test('tcrun049', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, [''])
test('tcrun050', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, [''])
test('tcrun051', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, [''])
test('tcrun047', [omit_ways(['ghci']), only_compiler_types(['ghc'])],
compile_and_run, [''])
test('tcrun048', [omit_ways(['ghci']), only_compiler_types(['ghc'])],
compile_and_run, [''])
test('tcrun049', [omit_ways(['ghci']), only_compiler_types(['ghc'])],
compile_and_run, [''])
test('tcrun050', [omit_ways(['ghci']), only_compiler_types(['ghc'])],
compile_and_run, [''])
test('tcrun051', [omit_ways(['ghci']), only_compiler_types(['ghc'])],
compile_and_run, [''])
test('church', normal, compile_and_run, [''])
test('testeq2', normal, compile_and_run, [''])
......@@ -92,8 +98,10 @@ test('T4809', reqlib('mtl'), compile_and_run, [''])
test('T2722', normal, compile_and_run, [''])
test('mc17', normal, compile_and_run, [''])
test('T5759', normal, compile_and_run, [''])
test('T5573a', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, [''])
test('T5573b', compose(omit_ways(['ghci']),only_compiler_types(['ghc'])), compile_and_run, [''])
test('T5573a', [omit_ways(['ghci']), only_compiler_types(['ghc'])],
compile_and_run, [''])
test('T5573b', [omit_ways(['ghci']), only_compiler_types(['ghc'])],
compile_and_run, [''])
test('T7023', normal, compile_and_run, [''])
test('T7126', normal, compile_and_run, [''])
test('T6117', normal, compile_and_run, [''])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment