summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-08-15 14:28:58 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-08-18 09:24:44 -0400
commita740a4c56416c7c1bc914a7a9207207e17833573 (patch)
treec92a65b22e6c25ce49cc51ff771291d2fac7ba05 /testsuite/tests
parent436867d6b07c69170e8e51283ac57ed3eab52ae4 (diff)
downloadhaskell-a740a4c56416c7c1bc914a7a9207207e17833573.tar.gz
driver: Honour -x option
The -x option is used to manually specify which phase a file should be started to be compiled from (even if it lacks the correct extension). I just failed to implement this when refactoring the driver. In particular Cabal calls GHC with `-E -cpp -x hs Foo.cpphs` to preprocess source files using GHC. I added a test to exercise this case. Fixes #22044
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/driver/Makefile8
-rw-r--r--testsuite/tests/driver/T22044.bazoo3
-rw-r--r--testsuite/tests/driver/all.T1
3 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 085ca668a4..7c9625570a 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -779,3 +779,11 @@ T21869:
"$(TEST_HC)" $(TEST_HC_OPTS) -v0 T21869.hs -S
[ -f T21869.s ] || (echo "assembly file does not exist" && exit 2)
[ ! -f T21869.o ] || (echo "object file exists" && exit 2)
+
+.PHONY: T22044
+T22044:
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -E -cpp -x hs T22044.bazoo -o T22044.hs -DBAZOO=1
+ # Test the file exists and is preprocessed
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 T22044.hs
+
+
diff --git a/testsuite/tests/driver/T22044.bazoo b/testsuite/tests/driver/T22044.bazoo
new file mode 100644
index 0000000000..a5a9837e23
--- /dev/null
+++ b/testsuite/tests/driver/T22044.bazoo
@@ -0,0 +1,3 @@
+module T22044 where
+
+bazoo = BAZOO
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index e57a6e2292..5603354282 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -311,3 +311,4 @@ test('T20569', extra_files(["T20569/"]), makefile_test, [])
test('T21866', normal, multimod_compile, ['T21866','-no-link'])
test('T21349', extra_files(['T21349']), makefile_test, [])
test('T21869', [normal, when(unregisterised(), skip)], makefile_test, [])
+test('T22044', normal, makefile_test, [])