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

Add if_os, and change derefnull/divbyzero to use it

I think different Linux setups generate different output for these tests,
so we just ignore the output on Linux now.
parent 8f4ee52c
...@@ -36,6 +36,7 @@ class TestConfig: ...@@ -36,6 +36,7 @@ class TestConfig:
# What platform are we running on? # What platform are we running on?
self.platform = '' self.platform = ''
self.os = ''
# What is the wordsize (in bits) of this platform? # What is the wordsize (in bits) of this platform?
self.wordsize = '' self.wordsize = ''
......
...@@ -252,6 +252,12 @@ def if_platform( plat, f ): ...@@ -252,6 +252,12 @@ def if_platform( plat, f ):
else: else:
return normal return normal
def if_os( os, f ):
if config.os == os:
return f
else:
return normal
# --- # ---
def if_compiler_lt( compiler, version, f ): def if_compiler_lt( compiler, version, f ):
......
...@@ -106,6 +106,7 @@ RUNTEST_OPTS += \ ...@@ -106,6 +106,7 @@ RUNTEST_OPTS += \
-e config.hp2ps=\"$(HP2PS_ABS)\" \ -e config.hp2ps=\"$(HP2PS_ABS)\" \
-e config.gs=\"$(GS)\" \ -e config.gs=\"$(GS)\" \
-e config.platform=\"$(TARGETPLATFORM)\" \ -e config.platform=\"$(TARGETPLATFORM)\" \
-e config.os=\"$(TargetOS_CPP)\" \
-e config.wordsize=\"$(WORDSIZE)\" \ -e config.wordsize=\"$(WORDSIZE)\" \
-e default_testopts.cleanup=\"$(CLEANUP)\" \ -e default_testopts.cleanup=\"$(CLEANUP)\" \
-e "if '$(USETHREADS)': config.use_threads=int($(USETHREADS))" \ -e "if '$(USETHREADS)': config.use_threads=int($(USETHREADS))" \
......
...@@ -8,17 +8,26 @@ test('testblockalloc', compose(c_src, ...@@ -8,17 +8,26 @@ test('testblockalloc', compose(c_src,
# only GHCi triggers the bug, but we run the test all ways for completeness. # only GHCi triggers the bug, but we run the test all ways for completeness.
test('bug1010', normal, compile_and_run, ['+RTS -c -RTS']) test('bug1010', normal, compile_and_run, ['+RTS -c -RTS'])
test('derefnull', test('derefnull',
# SIGSEGV on Linux composes([
composes([exit_code(139), # 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.
if_os('linux', ignore_output),
# SIGBUS on OX X # SIGBUS on OX X
if_platform('i386-apple-darwin', exit_code(138)), if_os('darwin', exit_code(138)),
if_platform('powerpc-apple-darwin', exit_code(138)),
if_platform('i386-unknown-mingw32', exit_code(1))]), if_platform('i386-unknown-mingw32', exit_code(1))]),
compile_and_run, ['']) compile_and_run, [''])
test('divbyzero', test('divbyzero',
composes([
# SIGFPE on Linux # SIGFPE on Linux
compose(exit_code(136), exit_code(136),
if_platform('i386-unknown-mingw32', exit_code(1))), # 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.
if_os('linux', ignore_output),
if_platform('i386-unknown-mingw32', exit_code(1))]),
compile_and_run, ['']) compile_and_run, [''])
test('outofmem', normal, run_command, ['$MAKE -s --no-print-directory outofmem']) test('outofmem', normal, run_command, ['$MAKE -s --no-print-directory outofmem'])
......
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