summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/driver/testglobals.py3
-rw-r--r--testsuite/driver/testlib.py26
2 files changed, 29 insertions, 0 deletions
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index b3c9a55131..054fd713d0 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -223,6 +223,9 @@ class TestOptions:
# the stdin file that this test will use (empty for <name>.stdin)
self.stdin = ''
+ # Set the expected stderr/stdout. '' means infer from test name.
+ self.use_specs = {}
+
# don't compare output
self.ignore_stdout = False
self.ignore_stderr = False
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index dd66340e5f..e800772cd1 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -189,6 +189,28 @@ def ignore_stderr(name, opts):
def combined_output( name, opts ):
opts.combined_output = True
+def use_specs( specs ):
+ """
+ use_specs allows one to override files based on suffixes. e.g. 'stdout',
+ 'stderr', 'asm', 'prof.sample', etc.
+
+ Example use_specs({'stdout' : 'prof002.stdout'}) to make the test re-use
+ prof002.stdout.
+
+ Full Example:
+ test('T5889', [only_ways(['normal']), req_profiling,
+ extra_files(['T5889/A.hs', 'T5889/B.hs']),
+ use_specs({'stdout' : 'prof002.stdout'})],
+ multimod_compile,
+ ['A B', '-O -prof -fno-prof-count-entries -v0'])
+
+ """
+ return lambda name, opts, s=specs: _use_specs( name, opts, s )
+
+def _use_specs( name, opts, specs ):
+ opts.extra_files.extend(specs.values ())
+ opts.use_specs = specs
+
# -----
def expect_fail_for( ways ):
@@ -2001,6 +2023,10 @@ def in_srcdir(name, suffix=''):
#
def find_expected_file(name, suff):
basename = add_suffix(name, suff)
+ # Override the basename if the user has specified one, this will then be
+ # subjected to the same name mangling scheme as normal to allow platform
+ # specific overrides to work.
+ basename = getTestOpts().use_specs.get (suff, basename)
files = [basename + ws + plat
for plat in ['-' + config.platform, '-' + config.os, '']