diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-03-10 14:10:26 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2015-03-10 15:20:43 -0700 |
commit | 8cbd7f5d97cdc0f4cd6b8baaa999f990533dc801 (patch) | |
tree | c795fdea467ce91690f6090dbb1bbe01ba610ccd /testsuite/tests/safeHaskell/check | |
parent | 8a91079b5895c1505717b5d401617269720ad8ab (diff) | |
download | haskell-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/safeHaskell/check')
-rw-r--r-- | testsuite/tests/safeHaskell/check/all.T | 5 | ||||
-rw-r--r-- | testsuite/tests/safeHaskell/check/pkg01/all.T | 21 |
2 files changed, 6 insertions, 20 deletions
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']) |