[commit: ghc] wip/ci-i386, wip/linters, wip/ww-noinline: Testsuite: implement use_specs. (0fff3ae)
git at git.haskell.org
git at git.haskell.org
Tue Feb 19 14:13:17 UTC 2019
Repository : ssh://git@git.haskell.org/ghc
On branches: wip/ci-i386,wip/linters,wip/ww-noinline
Link : http://ghc.haskell.org/trac/ghc/changeset/0fff3ae6d2b821cacf33193b85307588402f1748/ghc
>---------------------------------------------------------------
commit 0fff3ae6d2b821cacf33193b85307588402f1748
Author: Tamar Christina <tamar at zhox.com>
Date: Sun Jan 27 20:18:24 2019 +0000
Testsuite: implement use_specs.
>---------------------------------------------------------------
0fff3ae6d2b821cacf33193b85307588402f1748
testsuite/driver/testglobals.py | 3 +++
testsuite/driver/testlib.py | 26 ++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index b3c9a55..054fd71 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 dd66340..e800772 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, '']
More information about the ghc-commits
mailing list