Commit 8d34b5c7 authored by ian@well-typed.com's avatar ian@well-typed.com
Browse files

Convert more helper functions

parent 7cc907d3
......@@ -348,75 +348,36 @@ def have_profiling( ):
# ---
def if_ghci_dynamic( f ):
if config.ghc_dynamic_by_default:
return f
else:
return normal
def ghci_dynamic( ):
return config.ghc_dynamic_by_default
def if_in_tree_compiler( f ):
if config.in_tree_compiler:
return f
else:
return normal
def in_tree_compiler( ):
return config.in_tree_compiler
def unless_in_tree_compiler( f ):
if config.in_tree_compiler:
return normal
else:
return f
def compiler_type( compiler ):
return config.compiler_type == compiler
def if_compiler_type( compiler, f ):
if config.compiler_type == compiler:
return f
else:
return normal
def compiler_profiled( ):
return config.compiler_profiled
def if_compiler_profiled( f ):
if config.compiler_profiled:
return f
else:
return normal
def compiler_lt( compiler, version ):
return config.compiler_type == compiler and \
version_lt(config.compiler_version, version)
def unless_compiler_profiled( f ):
if config.compiler_profiled:
return normal
else:
return f
def compiler_le( compiler, version ):
return config.compiler_type == compiler and \
version_le(config.compiler_version, version)
def if_compiler_lt( compiler, version, f ):
if config.compiler_type == compiler and \
version_lt(config.compiler_version, version):
return f
else:
return normal
def compiler_gt( compiler, version ):
return config.compiler_type == compiler and \
version_gt(config.compiler_version, version)
def if_compiler_le( compiler, version, f ):
if config.compiler_type == compiler and \
version_le(config.compiler_version, version):
return f
else:
return normal
def compiler_ge( compiler, version ):
return config.compiler_type == compiler and \
version_ge(config.compiler_version, version)
def if_compiler_gt( compiler, version, f ):
if config.compiler_type == compiler and \
version_gt(config.compiler_version, version):
return f
else:
return normal
def if_compiler_ge( compiler, version, f ):
if config.compiler_type == compiler and \
version_ge(config.compiler_version, version):
return f
else:
return normal
def if_compiler_debugged( f ):
if config.compiler_debugged:
return f
else:
return normal
def compiler_debugged( ):
return config.compiler_debugged
def namebase( nb ):
return lambda opts, nb=nb: _namebase(opts, nb)
......
setTestOpts(if_compiler_profiled(skip))
setTestOpts(when(compiler_profiled(), skip))
# Annotations, like Template Haskell, require runtime evaluation. In
# order for this to work with profiling, we would have to build the
......
setTestOpts(if_compiler_profiled(skip))
setTestOpts(when(compiler_profiled(), skip))
# These tests are very slow due to their use of package GHC
setTestOpts(skip_if_fast)
......
setTestOpts(only_compiler_types(['ghc']))
test('arrowfail001',
if_compiler_debugged(expect_broken(5267)),
when(compiler_debugged(), expect_broken(5267)),
compile_fail,
[''])
# arrowfail001 gets an ASSERT error in the stage1 compiler
......
......@@ -53,7 +53,7 @@ test('numsparks001', only_ways(['threaded1']), compile_and_run, [''])
test('T4262', [ skip, # skip for now, it doesn't give reliable results
only_ways(['threaded1']),
unless(opsys('linux'),skip),
if_compiler_lt('ghc', '7.1', expect_fail) ],
when(compiler_lt('ghc', '7.1'), expect_fail) ],
compile_and_run, [''])
test('T4813', normal, compile_and_run, [''])
......
......@@ -76,7 +76,7 @@ test('GadtOverlap', normal, compile, ['-Wall'])
test('T2395', normal, compile, [''])
test('T4371', normal, compile, [''])
test('T4439', normal, compile, [''])
test('T4488', if_compiler_lt('ghc', '7.1', expect_fail), compile, [''])
test('T4488', when(compiler_lt('ghc', '7.1'), expect_fail), compile, [''])
test('T4870',
[only_ways(['optasm']),
only_compiler_types(['ghc']),
......
......@@ -38,5 +38,5 @@ test('mc06', normal, compile_and_run, [''])
test('mc07', normal, compile_and_run, [''])
test('mc08', normal, compile_and_run, [''])
test('T5742', normal, compile_and_run, [''])
test('DsLambdaCase', if_compiler_lt('ghc', '7.5', skip), compile_and_run, [''])
test('DsMultiWayIf', if_compiler_lt('ghc', '7.5', skip), compile_and_run, [''])
test('DsLambdaCase', when(compiler_lt('ghc', '7.5'), skip), compile_and_run, [''])
test('DsMultiWayIf', when(compiler_lt('ghc', '7.5'), skip), compile_and_run, [''])
......@@ -102,10 +102,10 @@ test('gadt25', normal, compile, [''])
test('T3651', normal, compile_fail, [''])
test('T3638', normal, compile, [''])
test('gadtSyntax001', if_compiler_lt('ghc', '7.1', expect_fail), compile, [''])
test('gadtSyntaxFail001', if_compiler_lt('ghc', '7.1', expect_fail), compile_fail, [''])
test('gadtSyntaxFail002', if_compiler_lt('ghc', '7.1', expect_fail), compile_fail, [''])
test('gadtSyntaxFail003', if_compiler_lt('ghc', '7.1', expect_fail), compile_fail, [''])
test('gadtSyntax001', when(compiler_lt('ghc', '7.1'), expect_fail), compile, [''])
test('gadtSyntaxFail001', when(compiler_lt('ghc', '7.1'), expect_fail), compile_fail, [''])
test('gadtSyntaxFail002', when(compiler_lt('ghc', '7.1'), expect_fail), compile_fail, [''])
test('gadtSyntaxFail003', when(compiler_lt('ghc', '7.1'), expect_fail), compile_fail, [''])
test('T3169', normal, compile_fail, [''])
test('T5424',
extra_clean(['T5424a.hi', 'T5424a.o']),
......
setTestOpts(if_compiler_profiled(skip))
setTestOpts(when(compiler_profiled(), skip))
test('ghc-e001', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e001'])
test('ghc-e002', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e002'])
......@@ -8,7 +8,7 @@ test('ghc-e004', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e0
test('ghc-e005', req_interp, run_command, ['$MAKE --no-print-directory -s ghc-e005'])
test('T2228',
[req_interp, if_ghci_dynamic(expect_broken(7298))],
[req_interp, when(ghci_dynamic(), expect_broken(7298))],
run_command,
['$MAKE --no-print-directory -s T2228'])
test('T2636', req_interp, run_command, ['$MAKE --no-print-directory -s T2636'])
......
setTestOpts(composes([extra_run_opts('-ignore-dot-ghci'),
if_compiler_profiled(skip),
when(compiler_profiled(), skip),
normalise_slashes]))
test('print001', normal, ghci_script, ['print001.script'])
......@@ -36,7 +36,7 @@ test('print032', normal, ghci_script, ['print032.script'])
test('print033', normal, ghci_script, ['print033.script'])
test('print034', normal, ghci_script, ['print034.script'])
test('print035',
if_ghci_dynamic(expect_broken(7326)),
when(ghci_dynamic(), expect_broken(7326)),
ghci_script,
['print035.script'])
......
setTestOpts(extra_run_opts('-ignore-dot-ghci'))
setTestOpts(if_compiler_profiled(skip))
setTestOpts(when(compiler_profiled(), skip))
test('break022', extra_clean(['A.hs']), ghci_script, ['break022.script'])
setTestOpts(extra_run_opts('-ignore-dot-ghci'))
setTestOpts(if_compiler_profiled(skip))
setTestOpts(when(compiler_profiled(), skip))
test('break023', extra_clean(['A.hs']), ghci_script, ['break023.script'])
test('ghcilink001',
[if_ghci_dynamic(expect_fail), # dynamic ghci can't load '.a's
[when(ghci_dynamic(), expect_fail), # dynamic ghci can't load '.a's
skip_if_no_ghci,
extra_clean(['dir001/*','dir001'])],
run_command,
......@@ -21,7 +21,7 @@ test('ghcilink003',
['$MAKE -s --no-print-directory ghcilink003'])
test('ghcilink004',
[if_ghci_dynamic(expect_fail), # dynamic ghci can't load '.a's
[when(ghci_dynamic(), expect_fail), # dynamic ghci can't load '.a's
skip_if_no_ghci,
extra_clean(['dir004/*','dir004'])],
run_command,
......
# coding=utf8
setTestOpts(if_compiler_profiled(skip))
setTestOpts(when(compiler_profiled(), skip))
test('ghci001', combined_output, ghci_script, ['ghci001.script'])
test('ghci002', combined_output, ghci_script, ['ghci002.script'])
......
setTestOpts(if_compiler_profiled(skip))
setTestOpts(when(compiler_profiled(), skip))
# We only want to run these tests with GHCi
def just_ghci( name, opts ):
......
......@@ -159,7 +159,7 @@ test('T4484', normal, compile, [''])
test('T4492', normal, compile, [''])
test('T4494', normal, compile, [''])
test('DataFamDeriv', normal, compile, [''])
test('T1769', if_compiler_lt('ghc', '7.1', expect_fail), compile, [''])
test('T1769', when(compiler_lt('ghc', '7.1'), expect_fail), compile, [''])
test('T4497', normal, compile, [''])
test('T3484', normal, compile, [''])
test('T3460', normal, compile, [''])
......
......@@ -65,7 +65,7 @@ test('T2239', normal, compile_fail, [''])
test('T3440', normal, compile_fail, [''])
test('T4485', normal, compile_fail, [''])
test('T4174', normal, compile_fail, [''])
test('DerivUnsatFam', if_compiler_lt('ghc', '7.1', expect_fail), compile_fail, [''])
test('DerivUnsatFam', when(compiler_lt('ghc', '7.1'), expect_fail), compile_fail, [''])
test('T2664', normal, compile_fail, [''])
test('T2664a', normal, compile, [''])
test('T2544', normal, compile_fail, [''])
......
......@@ -39,7 +39,7 @@ test('layout007',
[req_interp,
extra_clean(['layout007.hi', 'layout007.o']),
only_compiler_types(['ghc']),
if_compiler_profiled(skip)],
when(compiler_profiled(), skip)],
run_command,
['$MAKE -s --no-print-directory layout007'])
......
......@@ -251,7 +251,7 @@ test('mod150', normal, compile_fail, [''])
test('mod151', normal, compile_fail, [''])
test('mod152', normal, compile_fail, [''])
test('mod153', normal, compile_fail, [''])
test('mod154', if_compiler_type('hugs', expect_fail), compile, [''])
test('mod154', when(compiler_type('hugs'), expect_fail), compile, [''])
test('mod155', normal, compile_fail, [''])
test('mod156', normal, compile, [''])
test('mod157',
......
setTestOpts(only_compiler_types(['ghc']))
test('base01',
[if_compiler_lt('ghc', '7.1', expect_fail),
[when(compiler_lt('ghc', '7.1'), expect_fail),
normalise_slashes,
clean_cmd('$MAKE -s clean')],
run_command,
......
Supports Markdown
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