Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ian Lynagh
committed
Jun 21, 2013
1 parent
91e974f
commit 5be6042
Showing
11 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
TOP=../../../.. | ||
include $(TOP)/mk/boilerplate.mk | ||
include $(TOP)/mk/test.mk | ||
|
||
checkExists = [ -f $1 ] || echo $1 missing | ||
|
||
LOCAL_PKGCONF=local.package.conf | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -f Setup.o Setup.hi Setup Setup.exe | ||
rm -rf $(LOCAL_PKGCONF) | ||
rm -rf pkg1/dist | ||
rm -rf pkg1dyn/dist | ||
rm -rf pkg2/dist | ||
rm -f prog.o prog.hi progstatic progstatic.exe | ||
rm -f prog.dyn_o prog.dyn_hi progdynamic progdynamic.exe | ||
|
||
.PHONY: dynamicToo004 | ||
dynamicToo004: | ||
$(MAKE) clean | ||
|
||
"$(GHC_PKG)" init $(LOCAL_PKGCONF) | ||
"$(TEST_HC)" -v0 --make Setup.hs | ||
|
||
# First make the vanilla pkg1 | ||
cd pkg1 && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF) --enable-library-vanilla --disable-shared | ||
cd pkg1 && ../Setup build | ||
cd pkg1 && ../Setup register --inplace | ||
|
||
# Then the dynamic pkg1. This has different code in A.hs, so we get | ||
# a different hash. | ||
cd pkg1dyn && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF) --disable-library-vanilla --enable-shared | ||
cd pkg1dyn && ../Setup build | ||
|
||
# Now merge the dynamic outputs into the registered directory | ||
cp pkg1dyn/dist/build/A.dyn_hi pkg1/dist/build/ | ||
cp pkg1dyn/dist/build/A.dyn_o pkg1/dist/build/ | ||
cp pkg1dyn/dist/build/libHSpkg1* pkg1/dist/build/ | ||
|
||
# Next compile pkg2 both ways, which will use -dynamic-too | ||
cd pkg2 && ../Setup configure -v0 --with-compiler="$(TEST_HC)" --with-hc-pkg="$(GHC_PKG)" --package-db=../$(LOCAL_PKGCONF) --enable-library-vanilla --enable-shared | ||
cd pkg2 && ../Setup build | ||
cd pkg2 && ../Setup register --inplace | ||
|
||
# And then compile a program using the library both ways | ||
"$(TEST_HC)" -package-db $(LOCAL_PKGCONF) --make prog -o progstatic | ||
"$(TEST_HC)" -package-db $(LOCAL_PKGCONF) --make prog -o progdynamic -dynamic -osuf dyn_o -hisuf dyn_hi | ||
|
||
# Both should run, giving their respective outputs | ||
echo static | ||
./progstatic | ||
echo dynamic | ||
./progdynamic | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import Distribution.Simple | ||
main = defaultMain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
module A where | ||
|
||
a :: Char | ||
a = 'a' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Name: pkg1 | ||
Version: 1 | ||
|
||
Library | ||
Exposed-Modules: A | ||
Build-Depends: base | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
module A where | ||
|
||
a :: Char | ||
a = 'x' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Name: pkg1 | ||
Version: 1 | ||
|
||
Library | ||
Exposed-Modules: A | ||
Build-Depends: base | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
module B where | ||
|
||
b :: Char | ||
b = 'b' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
module C where | ||
|
||
import A | ||
import B | ||
|
||
c :: String | ||
c = [a, b] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Name: pkg2 | ||
Version: 1 | ||
|
||
Library | ||
Exposed-Modules: B, C | ||
Build-Depends: base, pkg1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
module Main (main) where | ||
|
||
import C | ||
|
||
main :: IO () | ||
main = putStrLn c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
test('dynamicToo004', | ||
[only_compiler_types(['ghc']), | ||
expect_broken(7665), | ||
unless(have_vanilla(), skip), | ||
unless(have_dynamic(), skip)], | ||
run_command, | ||
['$MAKE -s --no-print-directory dynamicToo004']) | ||
|