summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorEdward Z. Yang <ezyang@cs.stanford.edu>2015-03-10 14:10:26 -0700
committerEdward Z. Yang <ezyang@cs.stanford.edu>2015-03-10 15:20:43 -0700
commit8cbd7f5d97cdc0f4cd6b8baaa999f990533dc801 (patch)
treec795fdea467ce91690f6090dbb1bbe01ba610ccd /testsuite/tests
parent8a91079b5895c1505717b5d401617269720ad8ab (diff)
downloadhaskell-8cbd7f5d97cdc0f4cd6b8baaa999f990533dc801.tar.gz
Refactor testsuite with normalise_version()
Summary: This function generalizes the normaliseBytestringPackage and other similar one-off functions into normalise_version() with takes a package name to normalize against. This JUST manages package versions; we also could use a normalize for keys. In the process, I modified all the normalization functions to be accumulative; I don't think this makes a difference for current test cases but I think it makes things nicer. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Reviewers: austin Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D725
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/package/all.T9
-rw-r--r--testsuite/tests/safeHaskell/check/all.T5
-rw-r--r--testsuite/tests/safeHaskell/check/pkg01/all.T21
-rw-r--r--testsuite/tests/safeHaskell/ghci/all.T15
-rw-r--r--testsuite/tests/th/all.T4
5 files changed, 16 insertions, 38 deletions
diff --git a/testsuite/tests/package/all.T b/testsuite/tests/package/all.T
index f2dc9dc6fa..1f5f46091e 100644
--- a/testsuite/tests/package/all.T
+++ b/testsuite/tests/package/all.T
@@ -7,9 +7,6 @@ incr_ghc = '-package "ghc (HsTypes as MyHsTypes, HsUtils)" '
inc_ghc = '-package ghc '
hide_ghc = '-hide-package ghc '
-def normaliseGhcVersion(str):
- return re.sub('ghc-[0-9.]+', 'ghc-<VERSION>', str)
-
test('package01', normal, compile, [hide_all + incr_containers])
test('package01e', normal, compile_fail, [hide_all + incr_containers])
test('package02', normal, compile, [hide_all + inc_containers + incr_containers])
@@ -17,8 +14,8 @@ test('package03', normal, compile, [hide_all + incr_containers + inc_conta
test('package04', normal, compile, [incr_containers])
test('package05', normal, compile, [incr_ghc + inc_ghc])
test('package06', normal, compile, [incr_ghc])
-test('package06e', normalise_errmsg_fun(normaliseGhcVersion), compile_fail, [incr_ghc])
-test('package07e', normalise_errmsg_fun(normaliseGhcVersion), compile_fail, [incr_ghc + inc_ghc + hide_ghc])
-test('package08e', normalise_errmsg_fun(normaliseGhcVersion), compile_fail, [incr_ghc + hide_ghc])
+test('package06e', normalise_version('ghc'), compile_fail, [incr_ghc])
+test('package07e', normalise_version('ghc'), compile_fail, [incr_ghc + inc_ghc + hide_ghc])
+test('package08e', normalise_version('ghc'), compile_fail, [incr_ghc + hide_ghc])
test('package09e', normal, compile_fail, ['-package "containers (Data.Map as M, Data.Set as M)"'])
test('package10', normal, compile, ['-hide-all-packages -package "ghc (UniqFM as Prelude)" '])
diff --git a/testsuite/tests/safeHaskell/check/all.T b/testsuite/tests/safeHaskell/check/all.T
index 59ab4fdb97..0a4fda62c8 100644
--- a/testsuite/tests/safeHaskell/check/all.T
+++ b/testsuite/tests/safeHaskell/check/all.T
@@ -7,9 +7,6 @@ def f( name, opts ):
setTestOpts(f)
-def normaliseBytestringPackage(str):
- return re.sub('bytestring-[0-9]+(\.[0-9]+)*', 'bytestring-<VERSION>', str)
-
test('CheckA', normal, compile, [''])
test('CheckB',
extra_clean(['CheckB_Aux.hi', 'CheckB_Aux.o']),
@@ -62,7 +59,7 @@ test('Check08',
# check -distrust-all-packages flag works
test('Check09',
- normalise_errmsg_fun(normaliseBytestringPackage),
+ normalise_version("bytestring"),
compile_fail,
['-fpackage-trust -distrust-all-packages'])
diff --git a/testsuite/tests/safeHaskell/check/pkg01/all.T b/testsuite/tests/safeHaskell/check/pkg01/all.T
index e1ed80dd7c..5f337370af 100644
--- a/testsuite/tests/safeHaskell/check/pkg01/all.T
+++ b/testsuite/tests/safeHaskell/check/pkg01/all.T
@@ -2,15 +2,6 @@
def f( name, opts ):
opts.only_ways = ['normal']
-def normaliseArrayPackage(str):
- return re.sub('array-[0-9]+(\.[0-9]+)*', 'array-<VERSION>', str)
-
-def normaliseBytestringPackage(str):
- return re.sub('bytestring-[0-9]+(\.[0-9]+)*', 'bytestring-<VERSION>', str)
-
-def normaliseIntegerPackage(str):
- return re.sub('integer-(gmp|simple)-[0-9.]+', 'integer-<IMPL>-<VERSION>', str)
-
def ignoreLdOutput(str):
return re.sub('Creating library file: pdb.safePkg01/dist.build.libHSsafePkg01-1.0-ghc[0-9.]*.dll.a\n', '', str)
@@ -38,10 +29,8 @@ make_args = 'VANILLA=' + vanilla + ' PROF=' + prof + ' DYN=' + dyn
test('safePkg01',
[clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.safePkg01'),
normalise_errmsg_fun(ignoreLdOutput),
- normalise_fun(
- normaliseArrayPackage,
- normaliseIntegerPackage,
- normaliseBytestringPackage)],
+ normalise_version("array", "integer-gmp", "integer-simple", "bytestring"),
+ ],
run_command,
['$MAKE -s --no-print-directory safePkg01 ' + make_args])
@@ -102,19 +91,19 @@ test('ImpSafeOnly06',
test('ImpSafeOnly07',
[pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly07 ' + make_args),
clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly07'),
- normalise_errmsg_fun(normaliseBytestringPackage)],
+ normalise_version("bytestring")],
compile_fail,
['-fpackage-trust -package-db pdb.ImpSafeOnly07/local.db -trust safePkg01 -distrust bytestring'])
test('ImpSafeOnly08',
[pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly08 ' + make_args),
clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly08'),
- normalise_errmsg_fun(normaliseBytestringPackage)],
+ normalise_version("bytestring")],
compile_fail,
['-fpackage-trust -package-db pdb.ImpSafeOnly08/local.db -trust safePkg01'])
test('ImpSafeOnly09',
[pre_cmd('$MAKE -s --no-print-directory mkPackageDatabase.ImpSafeOnly09 ' + make_args),
clean_cmd('$MAKE -s --no-print-directory cleanPackageDatabase.ImpSafeOnly09'),
- normalise_errmsg_fun(normaliseBytestringPackage)],
+ normalise_version("bytestring")],
compile_fail,
['-fpackage-trust -package-db pdb.ImpSafeOnly09/local.db -trust safePkg01'])
diff --git a/testsuite/tests/safeHaskell/ghci/all.T b/testsuite/tests/safeHaskell/ghci/all.T
index c0ca23ac26..980f1b5fc3 100644
--- a/testsuite/tests/safeHaskell/ghci/all.T
+++ b/testsuite/tests/safeHaskell/ghci/all.T
@@ -1,12 +1,8 @@
# Test GHCi works with Safe Haskell
-def normaliseBytestringPackage(str):
- return re.sub('bytestring-[0-9.]+', 'bytestring-<VERSION>', str)
-
test('p1', normal, ghci_script, ['p1.script'])
test('p2', normal, ghci_script, ['p2.script'])
-test('p3', normalise_errmsg_fun(normaliseBytestringPackage),
- ghci_script, ['p3.script'])
+test('p3', normalise_version("bytestring"), ghci_script, ['p3.script'])
test('p4', normal, ghci_script, ['p4.script'])
test('p5', normal, ghci_script, ['p5.script'])
test('p6', normal, ghci_script, ['p6.script'])
@@ -15,14 +11,11 @@ test('p8', normal, ghci_script, ['p8.script'])
test('p9', normal, ghci_script, ['p9.script'])
test('p10', normal, ghci_script, ['p10.script'])
test('p11', normal, ghci_script, ['p11.script'])
-test('p12', normalise_errmsg_fun(normaliseBytestringPackage),
- ghci_script, ['p12.script'])
+test('p12', normalise_version("bytestring"), ghci_script, ['p12.script'])
test('p13', normal, ghci_script, ['p13.script'])
test('p14', normal, ghci_script, ['p14.script'])
test('p16', normal, ghci_script, ['p16.script'])
-test('p17', normalise_errmsg_fun(normaliseBytestringPackage),
- ghci_script, ['p17.script'])
+test('p17', normalise_version("bytestring"), ghci_script, ['p17.script'])
# 7172
-test('p18', normalise_fun(normaliseBytestringPackage),
- ghci_script, ['p18.script'])
+test('p18', normalise_version("bytestring"), ghci_script, ['p18.script'])
diff --git a/testsuite/tests/th/all.T b/testsuite/tests/th/all.T
index 641064d345..5b566cb47a 100644
--- a/testsuite/tests/th/all.T
+++ b/testsuite/tests/th/all.T
@@ -289,7 +289,9 @@ test('T8028',
['T8028', '-v0 ' + config.ghc_th_way_flags])
test('TH_Roles1', normal, compile_fail, ['-v0'])
-test('TH_Roles2', normal, compile, ['-v0 -ddump-tc'])
+test('TH_Roles2', normalise_version('array', 'base', 'deepseq', 'ghc-prim',
+ 'integer-gmp', 'pretty', 'template-haskell'
+ ), compile, ['-v0 -ddump-tc'])
test('TH_Roles3', normal, compile, ['-v0 -dsuppress-uniques'])
test('TH_Roles4', normal, compile, ['-v0'])