Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/813344edacf03138a2dd4d0102fc0a32a5fdd37e

>---------------------------------------------------------------

commit 813344edacf03138a2dd4d0102fc0a32a5fdd37e
Author: Ian Lynagh <i...@well-typed.com>
Date:   Sat Nov 17 13:03:13 2012 +0000

    Make the plugin tests standalone

>---------------------------------------------------------------

 tests/plugins/Makefile               |   14 ++------------
 tests/plugins/all.T                  |   29 ++++++++++++++++++++++-------
 tests/plugins/simple-plugin/Makefile |   29 ++++++++++++-----------------
 3 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/tests/plugins/Makefile b/tests/plugins/Makefile
index 4e67fe1..6cd46b7 100644
--- a/tests/plugins/Makefile
+++ b/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/tests/plugins/all.T b/tests/plugins/all.T
index ccbe011..68225ae 100644
--- a/tests/plugins/all.T
+++ b/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/tests/plugins/simple-plugin/Makefile 
b/tests/plugins/simple-plugin/Makefile
index 6d4d2ea..e452f91 100644
--- a/tests/plugins/simple-plugin/Makefile
+++ b/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.%:
+       $(MAKE) clean.$*
+       mkdir pkg.$*
+       "$(TEST_HC)" -outputdir pkg.$* --make -v0 -o pkg.$*/setup Setup.hs
 
-package:
-       "$(TEST_HC)" --make -v0 -o setup Setup.hs
+       echo "[]" > pkg.$*/local.package.conf
        
-       echo "[]" >$(LOCAL_PKGCONF)
-       
-       ./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



_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to