summaryrefslogtreecommitdiff
path: root/testsuite/tests/plugins
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-11-17 13:03:13 +0000
committerIan Lynagh <ian@well-typed.com>2012-11-17 13:03:13 +0000
commit393939e84d71531d9319ecd6777e35c444a9df3a (patch)
tree462d7e45a4a7b303750ef9bf6096d0289d7dacf9 /testsuite/tests/plugins
parentdbb8d7502c68511fbed57430b01be618279c1b4d (diff)
downloadhaskell-393939e84d71531d9319ecd6777e35c444a9df3a.tar.gz
Make the plugin tests standalone
Diffstat (limited to 'testsuite/tests/plugins')
-rw-r--r--testsuite/tests/plugins/Makefile14
-rw-r--r--testsuite/tests/plugins/all.T29
-rw-r--r--testsuite/tests/plugins/simple-plugin/Makefile29
3 files changed, 36 insertions, 36 deletions
diff --git a/testsuite/tests/plugins/Makefile b/testsuite/tests/plugins/Makefile
index 4e67fe1e7a..6cd46b7aef 100644
--- a/testsuite/tests/plugins/Makefile
+++ b/testsuite/tests/plugins/Makefile
@@ -2,19 +2,9 @@ TOP=../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
-.PHONY: plugins01 clean
+.PHONY: plugins01
plugins01:
- # This test is extremely fragile because any change in the output of the following
- # commands invalidates the output of the run. In fact, we really want to ignore the
- # output resulting from building the simple-plugin, and only look at a few lines of
- # the output of the call to the TEST_HC (probably just the last 2).
- #
- # Suggestions to make this better gratefully recieved.
- (cd simple-plugin; $(MAKE) package)
- $(RM) plugins01.hi plugins01.o
- "$(TEST_HC)" $(HC_OPTS) --make -v0 plugins01.hs -package-db simple-plugin/local.package.conf -fplugin Simple.Plugin -fplugin-opt Simple.Plugin:Irrelevant_Option -package simple-plugin
+ "$(TEST_HC)" $(HC_OPTS) --make -v0 plugins01.hs -package-db simple-plugin/pkg.plugins01/local.package.conf -fplugin Simple.Plugin -fplugin-opt Simple.Plugin:Irrelevant_Option -package simple-plugin
./plugins01
-clean:
- cd simple-plugin && $(MAKE) clean
diff --git a/testsuite/tests/plugins/all.T b/testsuite/tests/plugins/all.T
index ccbe011d1f..68225aed7b 100644
--- a/testsuite/tests/plugins/all.T
+++ b/testsuite/tests/plugins/all.T
@@ -3,13 +3,30 @@ def f(opts):
opts.skip = 1
setTestOpts(f)
-setTestOpts(compose(alone, if_compiler_lt('ghc', '7.1', skip)))
+setTestOpts(if_compiler_lt('ghc', '7.1', skip))
-test('plugins01', normal, run_command, ['$MAKE -s --no-print-directory plugins01'])
-test('plugins02', normal, compile_fail, ['-package-db simple-plugin/local.package.conf -fplugin Simple.BadlyTypedPlugin -package simple-plugin'])
-test('plugins03', normal, compile_fail, ['-package-db simple-plugin/local.package.conf -fplugin Simple.NonExistantPlugin -package simple-plugin'])
+test('plugins01',
+ [pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins01'),
+ clean_cmd('$MAKE -s --no-print-directory -C simple-plugin clean.plugins01')],
+ run_command,
+ ['$MAKE -s --no-print-directory plugins01'])
+test('plugins02',
+ [pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins02'),
+ clean_cmd('$MAKE -s --no-print-directory -C simple-plugin clean.plugins02')],
+ compile_fail,
+ ['-package-db simple-plugin/pkg.plugins02/local.package.conf -fplugin Simple.BadlyTypedPlugin -package simple-plugin'])
+
+test('plugins03',
+ [pre_cmd('$MAKE -s --no-print-directory -C simple-plugin package.plugins03'),
+ clean_cmd('$MAKE -s --no-print-directory -C simple-plugin clean.plugins03')],
+ compile_fail,
+ ['-package-db simple-plugin/pkg.plugins03/local.package.conf -fplugin Simple.NonExistantPlugin -package simple-plugin'])
+
+test('plugins04',
+ extra_clean(['HomePackagePlugin.hi', 'HomePackagePlugin.o']),
+ multimod_compile_fail,
+ ['plugins04', '-package ghc -fplugin HomePackagePlugin'])
-test('plugins04', extra_clean(['HomePackagePlugin.hi', 'HomePackagePlugin.o']), multimod_compile_fail, ['plugins04', '-package ghc -fplugin HomePackagePlugin'])
test('plugins05',
[ extra_clean(['HomePackagePlugin.hi', 'HomePackagePlugin.o']),
expect_fail_for(['dyn'] + prof_ways) ],
@@ -20,5 +37,3 @@ test('plugins06',
expect_fail_for(['dyn'] + prof_ways) ],
multimod_compile_and_run, ['plugins06', '-package ghc'])
-if default_testopts.cleanup != '':
- runCmd('$MAKE -C ' + in_testdir('') + ' clean')
diff --git a/testsuite/tests/plugins/simple-plugin/Makefile b/testsuite/tests/plugins/simple-plugin/Makefile
index 6d4d2eaba1..e452f91374 100644
--- a/testsuite/tests/plugins/simple-plugin/Makefile
+++ b/testsuite/tests/plugins/simple-plugin/Makefile
@@ -2,24 +2,19 @@ TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
-LOCAL_PKGCONF=local.package.conf
-PKG_NAME=simple-plugin
+clean.%:
+ rm -rf pkg.$*
-clean:
- rm -f setup
- rm -f $(LOCAL_PKGCONF)
- rm -rf dist
- rm -rf install
- rm -f Setup.hi Setup.o
+HERE := $(abspath .)
+$(eval $(call canonicalise,HERE))
-PREFIX := $(abspath install)
-$(eval $(call canonicalise,PREFIX))
-
-package:
- "$(TEST_HC)" --make -v0 -o setup Setup.hs
+package.%:
+ $(MAKE) clean.$*
+ mkdir pkg.$*
+ "$(TEST_HC)" -outputdir pkg.$* --make -v0 -o pkg.$*/setup Setup.hs
- echo "[]" >$(LOCAL_PKGCONF)
+ echo "[]" > pkg.$*/local.package.conf
- ./setup configure $(CABAL_MINIMAL_BUILD) -v0 --prefix="$(PREFIX)" --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=$(LOCAL_PKGCONF)
- ./setup build -v0
- ./setup install -v0
+ pkg.$*/setup configure --distdir pkg.$*/dist -v0 $(CABAL_MINIMAL_BUILD) --prefix="$(HERE)/pkg.$*/install" --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=pkg.$*/local.package.conf
+ pkg.$*/setup build --distdir pkg.$*/dist -v0
+ pkg.$*/setup install --distdir pkg.$*/dist -v0