summaryrefslogtreecommitdiff
path: root/testsuite/config
diff options
context:
space:
mode:
authorrrt <unknown>2001-09-07 13:00:52 +0000
committerrrt <unknown>2001-09-07 13:00:52 +0000
commitc9cb517c9df0b28c804d28f36fd8aa09087eabfb (patch)
tree3f6d85d0b3740c153cc90be7dd0aafc0967bf8a8 /testsuite/config
parent0ecc9e312fbb0b170be531ed42e4c180e8b417e6 (diff)
downloadhaskell-c9cb517c9df0b28c804d28f36fd8aa09087eabfb.tar.gz
[project @ 2001-09-07 13:00:51 by rrt]
Test-suite titivation --------------------- This commit achieves several glorious goals and adds many frivolous features: * Makes the test driver work on Windows (use bash for system calls) * Adds -Di386_unknown_mingw32 to CPP_OPTS so that Win-specific code is compiled properly * Adds the ability to have platform-specific test results (by setting the new $platform variable to config.mk's TARGETPLATFORM) * Fixes several tests to work on Windows, mostly by adding platform- specific result files. * Pipes all stderr files through normalise_errmsg, which itself is improved to handle .exe at the end of filenames, and backslashes. * Allows stdout output to be piped through normalise_errmsg; useful in the rare cases where output includes filenames. * Comprehensively breaks the testsuite on all other platforms (with any luck) * Splundig vur thrig, earthlets!
Diffstat (limited to 'testsuite/config')
-rw-r--r--testsuite/config/multimod-test.T41
-rw-r--r--testsuite/config/std-macros.T70
-rw-r--r--testsuite/config/vanilla-test.T45
3 files changed, 78 insertions, 78 deletions
diff --git a/testsuite/config/multimod-test.T b/testsuite/config/multimod-test.T
index 6119d14c50..649797f930 100644
--- a/testsuite/config/multimod-test.T
+++ b/testsuite/config/multimod-test.T
@@ -8,6 +8,8 @@
-- global variables:
$stdin = ""
$expect = "pass"
+$normalise_errmsg = False
+$normalise_output = False
---------------------------------------------------------------
--- UTILITY FNs ---
@@ -92,45 +94,6 @@ def simple_build_prog_WRK ( $_main, $_extra_args )
---------------------------------------------------------------
---- RUNNING, AND ASSESSING RUN RESULTS ---
----------------------------------------------------------------
-
--- Check that the run.stdout file matches at least one spec'd stdout.
-def check_stdout_ok()
-{
- $r_stdout = qualify("run.stdout")
- $s_stdout = qualify("stdout")
-
- if not ( exists($s_stdout) )
- then if ((contents $r_stdout) == "")
- then return True
- else say_fail_because_nonempty($r_stdout)
- return False
- fi
- fi
-
- return same($s_stdout, $r_stdout)
-}
-
--- If there's any spec'd stderr files, check that the run.stderr matches it.
--- Check that the run.stdout file matches at least one spec'd stdout.
-def check_stderr_ok()
-{
- $r_stderr = qualify("run.stderr")
- $s_stderr = qualify("stderr")
-
- if not ( exists($s_stderr) )
- then if ((contents $r_stderr) == "")
- then return True
- else say_fail_because_output_produced($r_stdout)
- return False
- fi
- fi
-
- return same($s_stderr, $r_stderr)
-}
-
----------------------------------------------------------------
--- CONDUCTING A COMPLETE TEST ---
---------------------------------------------------------------
diff --git a/testsuite/config/std-macros.T b/testsuite/config/std-macros.T
index a289168cfc..e8a8e727b7 100644
--- a/testsuite/config/std-macros.T
+++ b/testsuite/config/std-macros.T
@@ -59,6 +59,16 @@ def qualify ( $_filename_frag )
fi
}
+-- "foo" -> qualify("foo-platform") if it exists, or qualify("foo") otherwise
+def platform_qualify ( $_filename_frag )
+{
+ $name = qualify($_filename_frag)
+ if exists($name ++ "-" ++ $platform)
+ then return $name ++ "-" ++ $platform
+ else return $name
+ fi
+}
+
def testnameWith ( $_filename_frag )
{
if $_filename_frag == ""
@@ -106,6 +116,22 @@ def same ( $_file1, $_file2 )
return $same
}
+-- returns True if both files are identical when normalised (unpathified)
+def same_normalised ( $_file1, $_file2 )
+{
+ if defined $verbose
+ then print "vanilla-test: comparing " ++ $_file1
+ ++ " and " ++ $_file2
+ fi
+ $cts1 = normalise_errmsg(contents($_file1))
+ $cts2 = normalise_errmsg(contents($_file2))
+ $same = $cts1 == $cts2
+ if not($same) then
+ say_fail_because_noteq($_file1, $_file2)
+ fi
+ return $same
+}
+
-- Give hints as to why a test is failing.
def say_fail_because_noteq ( $filename1, $filename2 )
{
@@ -191,3 +217,47 @@ def simple_run_pgm( $extra_args, $exit_code )
return $test_passed
}
+
+-- Check that the run.stdout file matches either the .stdout-TARGETPLATFORM
+-- (if it exists) or the .stdout otherwise.
+def check_stdout_ok()
+{
+ $r_stdout = qualify("run.stdout")
+ $s_stdout = platform_qualify("stdout")
+
+ if not ( exists($s_stdout) )
+ then if ((contents $r_stdout) == "")
+ then return True
+ else say_fail_because_nonempty($r_stdout)
+ return False
+ fi
+ fi
+
+ if $normalise_output
+ then return same_normalised($s_stdout, $r_stdout)
+ else return same($s_stdout, $r_stdout)
+ fi
+}
+
+-- Check that the run.stderr matches either the .stderr-TARGETPLATFORM
+-- (if it exists) or the .stderr otherwise. Normalise the stderr if
+-- $normalise_errmsg is set
+def check_stderr_ok()
+{
+ $r_stderr = qualify("run.stderr")
+ $s_stderr = platform_qualify("stderr")
+
+ if not ( exists($s_stderr) )
+ then if ((contents $r_stderr) == "")
+ then return True
+ else say_fail_because_nonempty($r_stderr)
+ return False
+ fi
+ fi
+
+-- if $normalise_errmsg
+-- then
+ return same_normalised($s_stderr, $r_stderr)
+-- else return same($s_stderr, $r_stderr)
+-- fi
+}
diff --git a/testsuite/config/vanilla-test.T b/testsuite/config/vanilla-test.T
index 8d7dd45280..c3a8bfd542 100644
--- a/testsuite/config/vanilla-test.T
+++ b/testsuite/config/vanilla-test.T
@@ -7,10 +7,13 @@
-- global variables:
$stdin = ""
$expect = "pass"
+$normalise_errmsg = False
+$normalise_output = False
---------------------------------------------------------------
-- Define the following things on the command line:
--
+-- $platform TARGETPLATFORM from config.mk
-- $verbose print command lines
-- $accept accept any changed output
@@ -69,48 +72,12 @@ def simple_build_Main_WRK ( $_extra_args, $compile_only )
then " -c "
else " -o " ++ $testname ++ " ")
++ $srcname ++ " >" ++ $errname ++ " 2>&1"
+ print $cmd
$res = runCmd($cmd)
return $res
}
--- Check that the run.stdout file matches at least one spec'd stdout.
-def check_stdout_ok()
-{
- $r_stdout = qualify("run.stdout")
- $s_stdout = qualify("stdout")
-
- if not ( exists($s_stdout) )
- then if ((contents $r_stdout) == "")
- then return True
- else say_fail_because_nonempty($r_stdout)
- return False
- fi
- fi
-
- return same($s_stdout, $r_stdout)
-}
-
-
--- If there's any spec'd stderr files, check that the run.stderr matches it.
--- Check that the run.stdout file matches at least one spec'd stdout.
-def check_stderr_ok()
-{
- $r_stderr = qualify("run.stderr")
- $s_stderr = qualify("stderr")
-
- if not ( exists($s_stderr) )
- then if ((contents $r_stderr) == "")
- then return True
- else say_fail_because_nonempty($r_stderr)
- return False
- fi
- fi
-
- return same($s_stderr, $r_stderr)
-}
-
-
---------------------------------------------------------------
--- CONDUCTING A COMPLETE TEST ---
---------------------------------------------------------------
@@ -157,7 +124,7 @@ def vanilla-compok-test-actions ( $extra_compile_args )
-- If there's an expected .stderr, presumably containing
-- warnings, ensure the compiler produced the same.
$actual_stderr = qualify("comp.stderr")
- $expected_stderr = qualify("stderr")
+ $expected_stderr = platform_qualify("stderr")
if exists($expected_stderr)
then $stderr_a = normalise_errmsg(contents($actual_stderr))
$stderr_e = normalise_errmsg(contents($expected_stderr))
@@ -187,7 +154,7 @@ def vanilla-compok-test-actions ( $extra_compile_args )
def vanilla-compfail-test-actions ( $extra_compile_args )
{
pretest_cleanup()
- $expected_stderr = qualify("stderr")
+ $expected_stderr = platform_qualify("stderr")
-- Sanity check
if not(exists($expected_stderr))