Commit a63312d6 authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Allow tests to be skipped based on whether or not the compiler has a tag

When working on a new foo extension, you can now put your tests in the
testsuite, set ProjectTags=-foo in mk/build.mk and skip_unless_tag('foo')
in the tests.
parent 67a15284
import os
import re
# Testsuite configuration setup for GHC
#
# This file is Python source
......@@ -73,3 +77,12 @@ config.way_rts_flags = {
'hpc' : []
}
def get_compiler_info():
h = os.popen(config.compiler + ' --numeric-version', 'r')
v = h.read()
h.close()
v = re.sub('[\r\n]', '', v)
v = v.split('-')
config.compiler_version = v[0]
config.compiler_tags = v[1:]
......@@ -15,3 +15,7 @@ config.other_ways = []
config.way_flags = { 'normal' : [] }
config.way_rts_flags = { 'normal' : [] }
def get_compiler_info():
pass
......@@ -74,6 +74,9 @@ for opt,arg in opts:
if opt == '--threads':
config.threads = int(arg)
# This has to come after arg parsing as the args can change the compiler
get_compiler_info()
# Can't import this earlier as we need to know if threading will be
# enabled or not
from testlib import *
......
......@@ -54,6 +54,10 @@ class TestConfig:
# and ghc-pkg
self.ghc_pkg = ''
# Compiler version info
self.compiler_version = ''
self.compiler_tags = []
# Flags we always give to this compiler
self.compiler_always_flags = []
......
......@@ -221,6 +221,22 @@ def _skip_if_platform( opts, plat ):
if config.platform == plat:
opts.skip = 1
# ---
def skip_if_tag( tag ):
return lambda opts, t=tag: _skip_if_tag(opts, t)
def _skip_if_tag( opts, tag ):
if tag in config.compiler_tags:
opts.skip = 1
def skip_unless_tag( tag ):
return lambda opts, t=tag: _skip_unless_tag(opts, t)
def _skip_unless_tag( opts, tag ):
if not (tag in config.compiler_tags):
opts.skip = 1
# ---
def alone(opts):
opts.alone = 1
......
Markdown is supported
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