summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2022-05-02 10:56:37 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-05-10 20:46:16 -0400
commitdcac383312cb4f2425eb412e72f632d6b484077b (patch)
tree72159cde91225c4b011e2024a48a7e0050943bd7 /testsuite/tests/driver
parentdf2e3373d534521d261e7b4fceee382c30974c0c (diff)
downloadhaskell-dcac383312cb4f2425eb412e72f632d6b484077b.tar.gz
driver: Make -no-keep-o-files -no-keep-hi-files work in --make mode
It seems like it was just an oversight to use the incorrect DynFlags (global rather than local) when implementing these two options. Using the local flags allows users to request these intermediate files get cleaned up, which works fine in --make mode because 1. Interface files are stored in memory 2. Object files are only cleaned at the end of session (after link) Fixes #21349
Diffstat (limited to 'testsuite/tests/driver')
-rw-r--r--testsuite/tests/driver/Makefile10
-rw-r--r--testsuite/tests/driver/T21349/A.hs5
-rw-r--r--testsuite/tests/driver/T21349/B.hs5
-rw-r--r--testsuite/tests/driver/T21349/Main.hs5
-rw-r--r--testsuite/tests/driver/all.T1
5 files changed, 24 insertions, 2 deletions
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index b30c8a77cb..30ca61b8e5 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -755,11 +755,11 @@ T16476b:
echo '-XCPP' >> unit-a
echo '-DTEST' >> unit-a
echo 'T16476b.hs' >> unit-a
-
+
echo '--make' > resp
echo '-unit' > resp
echo '@unit-a' > resp
-
+
"$(TEST_HC)" $(TEST_HC_OPTS) -v0 @resp
./T16476b
@@ -767,3 +767,9 @@ T16476b:
T20569:
"$(TEST_HC)" $(TEST_HC_OPTS) -c T20569/A.hs -i -iT20569 -hidir=interface
"$(TEST_HC)" $(TEST_HC_OPTS) -c T20569/B.hs -i -iT20569 -hidir=interface
+
+.PHONY: T21349
+T21349:
+ "$(TEST_HC)" $(TEST_HC_OPTS) -v0 Main -working-dir T21349
+ [ ! -f T21349/B.o ] || (echo "object file exists" && exit 2)
+ [ ! -f T21349/B.hi ] || (echo "interface file exists" && exit 2)
diff --git a/testsuite/tests/driver/T21349/A.hs b/testsuite/tests/driver/T21349/A.hs
new file mode 100644
index 0000000000..bc9832431c
--- /dev/null
+++ b/testsuite/tests/driver/T21349/A.hs
@@ -0,0 +1,5 @@
+module A where
+
+import B
+
+foo = b
diff --git a/testsuite/tests/driver/T21349/B.hs b/testsuite/tests/driver/T21349/B.hs
new file mode 100644
index 0000000000..30dbdafcc1
--- /dev/null
+++ b/testsuite/tests/driver/T21349/B.hs
@@ -0,0 +1,5 @@
+{-# OPTIONS_GHC -no-keep-hi-files #-}
+{-# OPTIONS_GHC -no-keep-o-files #-}
+module B where
+
+b = ()
diff --git a/testsuite/tests/driver/T21349/Main.hs b/testsuite/tests/driver/T21349/Main.hs
new file mode 100644
index 0000000000..ce96eb7408
--- /dev/null
+++ b/testsuite/tests/driver/T21349/Main.hs
@@ -0,0 +1,5 @@
+module Main where
+
+import A
+
+main = print foo
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 35ee56dc52..3dc704a19d 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -307,3 +307,4 @@ test('patch-level2', normal, compile, ['-Wcpp-undef'])
test('T16476a', normal, makefile_test, [])
test('T16476b', normal, makefile_test, [])
test('T20569', extra_files(["T20569/"]), makefile_test, [])
+test('T21349', extra_files(['T21349']), makefile_test, [])