Commit 93b549fa authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Testsuite cleaning fixes

parent 188e2821
local.package.conf:
local1750.package.conf:
{1750A-1}, {1750B-1}
......@@ -2,83 +2,91 @@ TOP=../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
PKGCONF=local.package.conf
LOCAL_GHC_PKG= $(GHC_PKG_INPLACE) -f $(PKGCONF)
PKGCONF01=local01.package.conf
LOCAL_GHC_PKG01 = $(GHC_PKG_INPLACE) -f $(PKGCONF01)
# a bunch of tests for ghc-pkg
ghcpkg01 :
@rm -f $(PKGCONF)
echo "[]" >$(PKGCONF)
$(LOCAL_GHC_PKG) list
$(LOCAL_GHC_PKG) register --force test.pkg
$(LOCAL_GHC_PKG) describe testpkg
$(LOCAL_GHC_PKG) describe testpkg-1.2.3.4
$(LOCAL_GHC_PKG) field testpkg-1.2.3.4 import-dirs
@rm -f $(PKGCONF01)
echo "[]" >$(PKGCONF01)
$(LOCAL_GHC_PKG01) list
$(LOCAL_GHC_PKG01) register --force test.pkg
$(LOCAL_GHC_PKG01) describe testpkg
$(LOCAL_GHC_PKG01) describe testpkg-1.2.3.4
$(LOCAL_GHC_PKG01) field testpkg-1.2.3.4 import-dirs
@: # test2.pkg is a later version of testpkg-1.2.3.4
$(LOCAL_GHC_PKG) register --force test2.pkg
$(LOCAL_GHC_PKG) list
$(LOCAL_GHC_PKG) describe testpkg-2.0
$(LOCAL_GHC_PKG) describe testpkg-*
$(LOCAL_GHC_PKG) field testpkg-* version
$(LOCAL_GHC_PKG01) register --force test2.pkg
$(LOCAL_GHC_PKG01) list
$(LOCAL_GHC_PKG01) describe testpkg-2.0
$(LOCAL_GHC_PKG01) describe testpkg-*
$(LOCAL_GHC_PKG01) field testpkg-* version
@: # test hiding/exposing
$(LOCAL_GHC_PKG) hide testpkg-1.2.3.4
$(LOCAL_GHC_PKG) field testpkg-1.2.3.4 exposed | grep False
$(LOCAL_GHC_PKG) expose testpkg-2.0
$(LOCAL_GHC_PKG) field testpkg-2.0 exposed | grep True
$(LOCAL_GHC_PKG) hide testpkg-*
$(LOCAL_GHC_PKG) field testpkg-* exposed
$(LOCAL_GHC_PKG01) hide testpkg-1.2.3.4
$(LOCAL_GHC_PKG01) field testpkg-1.2.3.4 exposed | grep False
$(LOCAL_GHC_PKG01) expose testpkg-2.0
$(LOCAL_GHC_PKG01) field testpkg-2.0 exposed | grep True
$(LOCAL_GHC_PKG01) hide testpkg-*
$(LOCAL_GHC_PKG01) field testpkg-* exposed
@: # test3.pkg depends on testpkg-2.0
$(LOCAL_GHC_PKG) register test3.pkg
$(LOCAL_GHC_PKG) unregister testpkg-3.0
$(LOCAL_GHC_PKG01) register test3.pkg
$(LOCAL_GHC_PKG01) unregister testpkg-3.0
$(LOCAL_GHC_PKG) unregister testpkg-2.0
$(LOCAL_GHC_PKG) describe testpkg
$(LOCAL_GHC_PKG) unregister testpkg-*
$(LOCAL_GHC_PKG) list
$(LOCAL_GHC_PKG01) unregister testpkg-2.0
$(LOCAL_GHC_PKG01) describe testpkg
$(LOCAL_GHC_PKG01) unregister testpkg-*
$(LOCAL_GHC_PKG01) list
@: # registering test3.pkg should fail now, its dependency has gone
if $(LOCAL_GHC_PKG) register test3.pkg; then false; else true; fi
if $(LOCAL_GHC_PKG01) register test3.pkg; then false; else true; fi
PKGCONF03=local03.package.conf
LOCAL_GHC_PKG03 = $(GHC_PKG_INPLACE) -f $(PKGCONF03)
ghcpkg03 :
@rm -f $(PKGCONF)
echo "[]" >$(PKGCONF)
@rm -f $(PKGCONF03)
echo "[]" >$(PKGCONF03)
@: # update should hide conflicting packages
$(LOCAL_GHC_PKG) register --force test.pkg
$(LOCAL_GHC_PKG) register --force test2.pkg
$(LOCAL_GHC_PKG03) register --force test.pkg
$(LOCAL_GHC_PKG03) register --force test2.pkg
@: # test4.pkg depends on testpkg-2.0, which conflicts with testpkg-1.2.3.4,
@: # ghc-pkg will happily register it now (it didn't in GHC 6.4)
$(LOCAL_GHC_PKG) register test4.pkg
$(LOCAL_GHC_PKG) update test4.pkg
$(LOCAL_GHC_PKG03) register test4.pkg
$(LOCAL_GHC_PKG03) update test4.pkg
@: # and another update of test.pkg will now hide dep-2.0
$(LOCAL_GHC_PKG) update --force test.pkg
$(LOCAL_GHC_PKG03) update --force test.pkg
PKGCONF04=local04.package.conf
LOCAL_GHC_PKG04 = $(GHC_PKG_INPLACE) -f $(PKGCONF04)
# Test that importing a module exposed by two packages reports a conflict
ghcpkg04 :
@rm -f $(PKGCONF)
@echo "[]" >$(PKGCONF)
@$(LOCAL_GHC_PKG) register --force test.pkg >/dev/null 2>&1
@$(LOCAL_GHC_PKG) update --force test5.pkg >/dev/null 2>&1
@$(LOCAL_GHC_PKG) expose testpkg-1.2.3.4 >/dev/null 2>&1
@rm -f $(PKGCONF04)
@echo "[]" >$(PKGCONF04)
@$(LOCAL_GHC_PKG04) register --force test.pkg >/dev/null 2>&1
@$(LOCAL_GHC_PKG04) update --force test5.pkg >/dev/null 2>&1
@$(LOCAL_GHC_PKG04) expose testpkg-1.2.3.4 >/dev/null 2>&1
@: # testpkg-1.2.3.4 and newtestpkg-2.0 are both exposed now
@$(TEST_HC) -package-conf $(PKGCONF) -c ghcpkg04.hs || true
@$(TEST_HC) -package-conf $(PKGCONF04) -c ghcpkg04.hs || true
PKGCONF1750=local1750.package.conf
LOCAL_GHC_PKG1750 = $(GHC_PKG_INPLACE) -f $(PKGCONF1750)
1750:
@rm -f $(PKGCONF) 1750.hs 1750.o 1750.hi 1750.out
@echo "[]" >$(PKGCONF)
@$(LOCAL_GHC_PKG) register --force 1750A.pkg >1750.out 2>&1
@$(LOCAL_GHC_PKG) register --force 1750B.pkg >1750.out 2>&1
@GHC_PACKAGE_PATH=$(PKGCONF) $(GHC_PKG_INPLACE) list
rm -f $(PKGCONF1750) 1750.hs 1750.o 1750.hi 1750.out
echo "[]" >$(PKGCONF1750)
$(LOCAL_GHC_PKG1750) register --force 1750A.pkg >1750.out 2>&1
$(LOCAL_GHC_PKG1750) register --force 1750B.pkg >1750.out 2>&1
GHC_PACKAGE_PATH=$(PKGCONF1750) $(GHC_PKG_INPLACE) list
# GHC_PACKAGE_PATH trick is to make this work with 6.8.2 which doesn't have
# the patch "Change the command-line semantics for query commands" to
# ghc-pkg
@echo "main = return ()" >1750.hs
@$(TEST_HC) -package-conf $(PKGCONF) -package 1750A 1750.hs || true
echo "main = return ()" >1750.hs
$(TEST_HC) -package-conf $(PKGCONF1750) -package 1750A 1750.hs || true
# -----------------------------------------------------------------------------
# Try piping the output of "ghc-pkg describe" into "ghc-pkg update" for
......
......@@ -2,19 +2,34 @@ setTestOpts(compose(alone,only_compiler_types(['ghc'])))
test('ghcpkg01',
composes([ignore_output,
extra_clean(['local01.package.conf',
'local01.package.conf.old']),
skip_if_fast,
if_compiler_lt('ghc', '6.9', skip)]),
run_command, ['$MAKE ghcpkg01'])
clean(['local.package.conf', 'local.package.conf.old'])
test('ghcpkg02', compose(ignore_output, skip_if_fast), run_command, ['$MAKE ghcpkg02'])
clean(['package.conf.copy', 'package.conf.copy.old'])
test('ghcpkg03', ignore_output, run_command, ['$MAKE ghcpkg03'])
test('ghcpkg03',
[ignore_output, extra_clean(['local03.package.conf',
'local03.package.conf.old'])],
run_command,
['$MAKE ghcpkg03'])
clean(['local.package.conf', 'local.package.conf.old'])
test('ghcpkg04', ignore_output, run_command, ['$MAKE --no-print-directory ghcpkg04'])
test('ghcpkg04',
[ignore_output, extra_clean(['local04.package.conf',
'local04.package.conf.old'])],
run_command,
['$MAKE --no-print-directory ghcpkg04'])
clean(['local.package.conf', 'local.package.conf.old'])
# Test that we *can* compile a module that also belongs to a package
# (this was disallowed in GHC 6.4 and earlier)
test('pkg01', normal, compile, [''])
test('1750', normal, run_command, ['$MAKE --no-print-directory 1750'])
test('1750',
extra_clean(['1750.hs',
'local1750.package.conf',
'local1750.package.conf.old']),
run_command, ['$MAKE -s --no-print-directory 1750'])
test('1959', normal, run_command, ['$MAKE -s --no-print-directory dotest'])
test('1959',
extra_clean(['E.hs', 'prog']),
run_command,
['$MAKE -s --no-print-directory dotest'])
test('recomp003', ignore_output, run_command, ['$MAKE recomp003'])
test('recomp003',
extra_clean(['Char.hs', 'err']),
run_command,
['$MAKE -s --no-print-directory recomp003'])
test('recomp004', normal, run_command, ['$MAKE -s --no-print-directory recomp004'])
test('recomp004',
extra_clean(['Main', 'Main.exe', 'c.c']),
run_command,
['$MAKE -s --no-print-directory recomp004'])
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