Commit d5c903e2 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Expect tests to fail if we don't have libraries that they use

parent 4d12bf8a
......@@ -45,6 +45,8 @@ class TestConfig:
# Path to the compiler
self.compiler = ''
# and ghc-pkg
self.ghc_pkg = ''
# Flags we always give to this compiler
self.compiler_always_flags = []
......
......@@ -71,6 +71,15 @@ def skip( opts ):
def expect_fail( opts ):
opts.expect = 'fail';
def reqlib( lib ):
return lambda opts, l=lib: _reqlib (opts, l )
def _reqlib( opts, lib ):
# opts.reqlibs.append(lib)
r = os.system(config.ghc_pkg + ' describe ' + lib + ' > /dev/null 2> /dev/null')
if r != 0:
opts.expect = 'fail'
def expect_broken( bug ):
return lambda opts, b=bug: _expect_broken (opts, b )
......
......@@ -33,6 +33,7 @@ export MAKE
GHC_STAGE1_ABS = $(GHC_COMPILER_DIR_ABS)/stage1/ghc-inplace
GHC_STAGE2_ABS = $(GHC_COMPILER_DIR_ABS)/stage2/ghc-inplace
GHC_STAGE3_ABS = $(GHC_COMPILER_DIR_ABS)/stage3/ghc-inplace
GHC_PKG_ABS = $(GHC_PKG_DIR_ABS)/ghc-pkg-inplace
HP2PS_ABS = $(GHC_HP2PS_DIR_ABS)/hp2ps
GS = gs
......@@ -48,6 +49,8 @@ else
TEST_HC = $(GHC_STAGE1_ABS)
endif
GHC_PKG = $(GHC_PKG_ABS)
RUNTEST_OPTS =
ifeq "$(GhcWithNativeCodeGen)" "YES"
......@@ -98,6 +101,7 @@ RUNTEST_OPTS += \
-e config.compiler=\"$(TEST_HC)\" \
-e config.compiler_always_flags.append"(\"-D$(HostPlatform_CPP)\")" \
-e config.compiler_always_flags.append"(\"$(EXTRA_HC_OPTS)\")" \
-e config.ghc_pkg=\"$(GHC_PKG)\" \
-e config.hp2ps=\"$(HP2PS_ABS)\" \
-e config.gs=\"$(GS)\" \
-e config.platform=\"$(TARGETPLATFORM)\" \
......
......@@ -124,7 +124,9 @@ test('conc053', compose(only_ways(['threaded1','threaded2']),
compile_and_run, ['-package stm'])
test('conc054', normal, compile_and_run, ['-package stm'])
test('conc055', exit_code(1), compile_and_run, ['-package stm'])
test('conc056', only_ways(['threaded1','threaded2']), compile_and_run, ['-package stm -package network'])
test('conc056', compose(only_ways(['threaded1','threaded2']),
reqlib('network')),
compile_and_run, ['-package stm -package network'])
test('conc057', only_ways(['threaded2']), compile_and_run, ['-O0'])
......
setTestOpts(only_compiler_types(['ghc']))
test('SampleVar001', normal, compile_and_run, ['-package QuickCheck'])
test('Chan001', normal, compile_and_run, ['-package QuickCheck'])
test('MVar001', normal, compile_and_run, ['-package QuickCheck'])
test('QSemN001', normal, compile_and_run, ['-package QuickCheck'])
test('QSem001', normal, compile_and_run, ['-package QuickCheck'])
test('SampleVar001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('Chan001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('MVar001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('QSemN001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('QSem001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('ThreadDelay001', normal, compile_and_run, [''])
test('bytestring001', normal, compile_and_run, ['-package QuickCheck'])
test('bytestring001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('bytestring002', normal, compile_and_run, [''])
test('bytestring003', normal, compile_and_run, [''])
test('bytestring004', normal, compile_and_run, ['-package QuickCheck'])
test('bytestring005', normal, compile_and_run, ['-package QuickCheck'])
test('bytestring004', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('bytestring005', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('net001', only_compiler_types(['ghc']), compile_and_run, ['-package network'])
test('net002', compose(only_compiler_types(['ghc']), extra_run_opts('3')),
test('net001', compose(only_compiler_types(['ghc']), reqlib('network')), compile_and_run, ['-package network'])
test('net002', compose(compose(only_compiler_types(['ghc']), extra_run_opts('3')), reqlib('network')),
compile_and_run, ['-package network'])
test('uri001', skip_if_fast, compile_and_run, ['-package network -package HUnit'])
test('uri001', compose(skip_if_fast, reqlib('network')), compile_and_run, ['-package network -package HUnit'])
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