Commit 179553f5 authored by sewardj's avatar sewardj
Browse files

[project @ 2001-07-13 14:59:13 by sewardj]

-- Use diff to show diffs between actual and expected compiler output.
-- Show compiler output in cases where none was expected.
parent 87d8f19e
......@@ -77,8 +77,15 @@ def say_fail_because_nonempty ( $filename1 )
def say_fail_because_compiler_barfd ( $res )
{
print "--- FAIL because the compiler returned non-zero exit code = " ++ $res
$comp_stderr = qualify("comp.stderr")
if exists($comp_stderr)
then print "--- Error messages:"
$barfage = contents(qualify("comp.stderr"))
print $barfage
fi
}
---------------------------------------------------------------
--- COMPILATION ---
---------------------------------------------------------------
......@@ -147,15 +154,6 @@ def simple_build_Main_WRK ( $_extra_args )
return $res
}
-- Compile testname.hs into testname; comp errors -> testname.comp.stderr.
-- Used for run tests, so framefail if compilation fails.
def simple_build_Main ( $_extra_args )
{
$res = simple_build_Main_WRK ( $_extra_args )
if $res /= "0" then framefail "simple_build_Main: failed" fi
}
---------------------------------------------------------------
--- RUNNING, AND ASSESSING RUN RESULTS ---
......@@ -263,7 +261,14 @@ def multimod-run-test-actions ( $extra_compile_args,
$allowable_nonzero_exit_code )
{
pretest_cleanup()
simple_build_Main( $extra_compile_args )
$res = simple_build_Main_WRK( $extra_compile_args )
-- If the compiler barf'd, fail.
if $res /= "0"
then say_fail_because_compiler_barfd ( $res )
return False
fi
$res = simple_run_main( $extra_run_args )
if $res /= "0" && $res /= $allowable_nonzero_exit_code
then print "multimod-test: unexpected exit code (" ++ $res
......
......@@ -71,6 +71,12 @@ def say_fail_because_nonempty ( $filename1 )
def say_fail_because_compiler_barfd ( $res )
{
print "--- FAIL because the compiler returned non-zero exit code = " ++ $res
$comp_stderr = qualify("comp.stderr")
if exists($comp_stderr)
then print "--- Error messages:"
$barfage = contents(qualify("comp.stderr"))
print $barfage
fi
}
---------------------------------------------------------------
......@@ -133,15 +139,6 @@ def simple_build_Main_WRK ( $_extra_args, $compile_only )
return $res
}
-- Compile testname.hs into testname; comp errors -> testname.comp.stderr.
-- Used for run tests, so framefail if compilation fails.
def simple_build_Main ( $_extra_args )
{
$res = simple_build_Main_WRK ( $_extra_args, False )
if $res /= "0" then framefail "simple_build_Main: failed" fi
}
---------------------------------------------------------------
--- RUNNING, AND ASSESSING RUN RESULTS ---
......@@ -249,7 +246,14 @@ def vanilla-run-test-actions ( $extra_compile_args,
$allowable_nonzero_exit_code )
{
pretest_cleanup()
simple_build_Main( $extra_compile_args )
$res = simple_build_Main_WRK( $extra_compile_args )
-- If the compiler barf'd, fail.
if $res /= "0"
then say_fail_because_compiler_barfd ( $res )
return False
fi
$res = simple_run_main( $extra_run_args )
if $res /= "0" && $res /= $allowable_nonzero_exit_code
then print "vanilla-test: unexpected exit code (" ++ $res
......@@ -284,8 +288,8 @@ def vanilla-compok-test-actions ( $extra_compile_args )
then $stderr_a = normalise_errmsg(contents($actual_stderr))
$stderr_e = normalise_errmsg(contents($expected_stderr))
if $stderr_e /= $stderr_a
then print ( "-- UNMATCHED WARNING MSGS: EXPECTED\n" ++ $stderr_e ++
"-- ACTUAL\n" ++ $stderr_a ++ "-- END\n" )
then print "UNMATCHED WARNING MSGS:"
$dummy = run ("diff " ++ $expected_stderr ++ " " ++ $actual_stderr)
return False
else return True
fi
......@@ -319,12 +323,13 @@ def vanilla-compfail-test-actions ( $extra_compile_args )
$res = simple_build_Main_WRK ( $extra_compile_args, True )
$stderr_a = normalise_errmsg(contents(qualify("comp.stderr")))
$actual_stderr = qualify("comp.stderr")
$stderr_a = normalise_errmsg(contents($actual_stderr))
$stderr_e = normalise_errmsg(contents($expected_stderr))
if $stderr_e /= $stderr_a
then print ( "-- UNMATCHED ERROR MSGS: EXPECTED\n" ++ $stderr_e ++
"-- ACTUAL\n" ++ $stderr_a ++ "-- END\n" )
if $stderr_e /= $stderr_a
then print "UNMATCHED ERROR MSGS:"
$dummy = run ("diff " ++ $expected_stderr ++ " " ++ $actual_stderr)
fi
if $res /= "0" && $stderr_e == $stderr_a
......
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