diff options
author | Ben Gamari <ben@smart-cactus.org> | 2021-09-17 19:40:48 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2021-09-23 16:00:18 -0400 |
commit | 552b32f118e1d3a9b6250c979964c7f42f3f80aa (patch) | |
tree | 818a4ddc592eb31dd3cd380b9944be31a237e187 | |
parent | 316ac68fb88e2d61e2dc07c2a75bcfb6d43e0d43 (diff) | |
download | haskell-552b32f118e1d3a9b6250c979964c7f42f3f80aa.tar.gz |
testsuite: Pass CFLAGS to hsc2hs tests
-rw-r--r-- | hadrian/src/Oracles/TestSettings.hs | 2 | ||||
-rw-r--r-- | hadrian/src/Rules/Test.hs | 4 | ||||
-rw-r--r-- | testsuite/mk/ghc-config.hs | 1 | ||||
-rw-r--r-- | testsuite/tests/hsc2hs/Makefile | 22 |
4 files changed, 19 insertions, 10 deletions
diff --git a/hadrian/src/Oracles/TestSettings.hs b/hadrian/src/Oracles/TestSettings.hs index b5f197299b..6b08a43cd5 100644 --- a/hadrian/src/Oracles/TestSettings.hs +++ b/hadrian/src/Oracles/TestSettings.hs @@ -34,6 +34,7 @@ data TestSetting = TestHostOS | TestCLANG | TestLLC | TestTEST_CC + | TestTEST_CC_OPTS | TestGhcPackageDbFlag | TestMinGhcVersion711 | TestMinGhcVersion801 @@ -62,6 +63,7 @@ testSetting key = do TestCLANG -> "CLANG" TestLLC -> "LLC" TestTEST_CC -> "TEST_CC" + TestTEST_CC_OPTS -> "TEST_CC_OPTS" TestGhcPackageDbFlag -> "GhcPackageDbFlag" TestMinGhcVersion711 -> "MinGhcVersion711" TestMinGhcVersion801 -> "MinGhcVersion801" diff --git a/hadrian/src/Rules/Test.hs b/hadrian/src/Rules/Test.hs index eeddfd9c3b..c14d68e971 100644 --- a/hadrian/src/Rules/Test.hs +++ b/hadrian/src/Rules/Test.hs @@ -137,6 +137,8 @@ testRules = do [ "--interactive", "-v0", "-ignore-dot-ghci" , "-fno-ghci-history" ] + ccPath <- settingsFileSetting SettingsFileSetting_CCompilerCommand + ccFlags <- settingsFileSetting SettingsFileSetting_CCompilerFlags pythonPath <- builderPath Python need [ root -/- checkPprProgPath @@ -157,6 +159,8 @@ testRules = do setEnv "TEST_HC" ghcPath setEnv "TEST_HC_OPTS" ghcFlags setEnv "TEST_HC_OPTS_INTERACTIVE" ghciFlags + setEnv "TEST_CC" ccPath + setEnv "TEST_CC_OPTS" ccFlags setEnv "CHECK_PPR" (top -/- root -/- checkPprProgPath) setEnv "CHECK_EXACT" (top -/- root -/- checkExactProgPath) setEnv "COUNT_DEPS" (top -/- root -/- countDepsProgPath) diff --git a/testsuite/mk/ghc-config.hs b/testsuite/mk/ghc-config.hs index 8870a35f80..e4631f13ff 100644 --- a/testsuite/mk/ghc-config.hs +++ b/testsuite/mk/ghc-config.hs @@ -30,6 +30,7 @@ main = do getGhcFieldProgWithDefault fields "CLANG" "LLVM clang command" "clang" getGhcFieldProgWithDefault fields "LLC" "LLVM llc command" "llc" getGhcFieldProgWithDefault fields "TEST_CC" "C compiler command" "gcc" + getGhcFieldProgWithDefault fields "TEST_CC_OPTS" "C compiler flags" "" let pkgdb_flag = case lookup "Project version" fields of Just v diff --git a/testsuite/tests/hsc2hs/Makefile b/testsuite/tests/hsc2hs/Makefile index 9291e4bc74..d0b2d249c3 100644 --- a/testsuite/tests/hsc2hs/Makefile +++ b/testsuite/tests/hsc2hs/Makefile @@ -2,53 +2,55 @@ TOP=../.. include $(TOP)/mk/boilerplate.mk include $(TOP)/mk/test.mk +HSC2HS_OPTS = --cc="$(TEST_CC)" $(addprefix --cflag=,$(TEST_CC_OPTS)) --ld=$(TEST_CC) $(addprefix --lflag=,$(TEST_CC_OPTS)) + .PHONY: hsc2hs001 hsc2hs001: - '$(HSC2HS)' $@.hsc + '$(HSC2HS)' $(HSC2HS_OPTS) $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -c $@.hs .PHONY: hsc2hs002 hsc2hs002: - '$(HSC2HS)' $@.hsc + '$(HSC2HS)' $(HSC2HS_OPTS) $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -c $@.hs .PHONY: hsc2hs003 hsc2hs003: - '$(HSC2HS)' $@.hsc + '$(HSC2HS)' $(HSC2HS_OPTS) $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@ ./$@ .PHONY: hsc2hs004 hsc2hs004: - '$(HSC2HS)' --cross-compile $@.hsc + '$(HSC2HS)' $(HSC2HS_OPTS) --cross-compile $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@ ./$@ .PHONY: T3837 T3837: - LANG=C '$(HSC2HS)' $@.hsc + LANG=C '$(HSC2HS)' $(HSC2HS_OPTS) $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -c $@.hs .PHONY: T4340 T4340: - '$(HSC2HS)' $@.hsc + '$(HSC2HS)' $(HSC2HS_OPTS) $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@ ./$@ .PHONY: T10272 T10272: - '$(HSC2HS)' --cross-compile $@.hsc + '$(HSC2HS)' $(HSC2HS_OPTS) --cross-compile $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -v0 --make $@ ./$@ .PHONY: T11004 T11004: - LANG=C '$(HSC2HS)' $@.hsc + LANG=C '$(HSC2HS)' $(HSC2HS_OPTS) $@.hsc '$(TEST_HC)' $(TEST_HC_OPTS) -c $@.hs .PHONY: T12504 T12504: - '$(HSC2HS)' T12504/path/to/$@.hsc + '$(HSC2HS)' $(HSC2HS_OPTS) T12504/path/to/$@.hsc ifeq "$(WINDOWS)" "YES" grep '{-# LINE 1 \"T12504\\\\path\\\\to\\\\$@\.hsc\" #-}' T12504/path/to/$@.hs else @@ -57,5 +59,5 @@ endif .PHONY: T15758 T15758: - '$(HSC2HS)' $@.hsc @T15758.response + '$(HSC2HS)' $(HSC2HS_OPTS) $@.hsc @T15758.response '$(TEST_HC)' $(TEST_HC_OPTS) -c $@.a.hs |