summaryrefslogtreecommitdiff
path: root/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite')
-rw-r--r--testsuite/config/ghc2
-rw-r--r--testsuite/driver/testglobals.py1
-rw-r--r--testsuite/driver/testlib.py51
3 files changed, 38 insertions, 16 deletions
diff --git a/testsuite/config/ghc b/testsuite/config/ghc
index ddd7ebf1c2..875717ee6e 100644
--- a/testsuite/config/ghc
+++ b/testsuite/config/ghc
@@ -92,5 +92,5 @@ def get_compiler_info():
v = re.sub('[\r\n]', '', v)
v = v.split('-')
config.compiler_version = v[0]
+ config.compiler_maj_version = re.sub('^([0-9]+\.[0-9]+).*',r'\1', v[0])
config.compiler_tags = v[1:]
-
diff --git a/testsuite/driver/testglobals.py b/testsuite/driver/testglobals.py
index e8c3253294..0554a5c7bf 100644
--- a/testsuite/driver/testglobals.py
+++ b/testsuite/driver/testglobals.py
@@ -56,6 +56,7 @@ class TestConfig:
# Compiler version info
self.compiler_version = ''
+ self.compiler_maj_version = ''
self.compiler_tags = []
# Flags we always give to this compiler
diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 1a1fe24496..a9c3f7fe5b 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -382,6 +382,7 @@ def test ( name, setup, func, args):
setup = composes(setup)
setup(opts)
+
if opts.alone:
n = config.threads
@@ -1237,22 +1238,42 @@ def in_testdir( name ):
def qualify( name, suff ):
return in_testdir(add_suffix(name, suff))
-# "foo" -> qualify("foo-platform") if it exists, otherwise
-# try qualify("foo-compiler_type"), qualify("foo-ws-wordsize")
-# or finally qualify("foo")
+
+# Finding the sample output. The filename is of the form
+#
+# <test>.stdout[-<compiler>][-<version>][-ws-<wordsize>][-<platform>]
+#
+# and we pick the most specific version available. The <version> is
+# the major version of the compiler (e.g. 6.8.2 would be "6.8"). For
+# more fine-grained control use if_compiler_lt().
+#
def platform_wordsize_qualify( name, suff ):
- path = qualify(name, suff)
- platform_path = path + '-' + config.platform
- compiler_type_path = path + '-' + config.compiler_type
- wordsize_path = path + '-ws-' + config.wordsize
- if os.path.exists(platform_path):
- return (1,platform_path)
- elif os.path.exists(compiler_type_path):
- return (0,compiler_type_path)
- elif os.path.exists(wordsize_path):
- return (0,wordsize_path)
- else:
- return (0,path)
+
+ basepath = qualify(name, suff)
+
+ fns = [ lambda x: x + '-' + config.compiler_type,
+ lambda x: x + '-' + config.compiler_maj_version,
+ lambda x: x + '-ws-' + config.wordsize ]
+
+ paths = [ basepath ]
+ for fn in fns:
+ paths = paths + map(fn, paths)
+
+ paths.reverse()
+
+ plat_paths = map (lambda x: x + '-' + config.platform, paths)
+
+ dir = glob.glob(basepath + '*')
+
+ for f in plat_paths:
+ if f in dir:
+ return (1,f)
+
+ for f in paths:
+ if f in dir:
+ return (0,f)
+
+ return (0, basepath)
# Clean up prior to the test, so that we can't spuriously conclude
# that it passed on the basis of old run outputs.