summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2021-06-23 11:18:01 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-06-25 05:19:53 -0400
commitf43a11d77720bfa38345f8d76938ec4ac34ec0b2 (patch)
tree8621c481d72f83125fa3c43d2ec9e50ee2f53d32
parent30afb381f380149eb98f80d96c9bfb082c9fac0e (diff)
downloadhaskell-f43a11d77720bfa38345f8d76938ec4ac34ec0b2.tar.gz
driver: Add test for #17481
Fixed in 25977ab542a30df4ae71d9699d015bcdd1ab7cfb Fixes #17481
-rw-r--r--testsuite/tests/driver/Makefile21
-rw-r--r--testsuite/tests/driver/T17481.stdout15
-rw-r--r--testsuite/tests/driver/all.T1
3 files changed, 37 insertions, 0 deletions
diff --git a/testsuite/tests/driver/Makefile b/testsuite/tests/driver/Makefile
index 0242b1aed4..b097ab6c96 100644
--- a/testsuite/tests/driver/Makefile
+++ b/testsuite/tests/driver/Makefile
@@ -685,3 +685,24 @@ OneShotTH:
"$(TEST_HC)" $(TEST_HC_OPTS) -c OneShotTH.hs
# The module should *not* be recompiled
"$(TEST_HC)" $(TEST_HC_OPTS) -c OneShotTH.hs
+
+T17481:
+ echo 'main = putStrLn "Hello from A"' > A.hs
+ echo 'main = putStrLn "Hello from B"' > B.hs
+
+ ln -f A.hs Main.hs
+ echo "Main.hs is now:"
+ cat Main.hs
+ echo "Compiling and running Main.hs:"
+ "$(TEST_HC)" $(TEST_HC_OPTS) Main.hs && ./Main
+
+ ln -f B.hs Main.hs
+ echo "Main.hs is now:"
+ cat Main.hs
+ echo "Compiling and running Main.hs:"
+ "$(TEST_HC)" $(TEST_HC_OPTS) Main.hs && ./Main
+
+ echo "Touching Main.hs"
+ touch Main.hs
+ echo "Compiling and running Main.hs:"
+ "$(TEST_HC)" $(TEST_HC_OPTS) Main.hs && ./Main
diff --git a/testsuite/tests/driver/T17481.stdout b/testsuite/tests/driver/T17481.stdout
new file mode 100644
index 0000000000..885dac3986
--- /dev/null
+++ b/testsuite/tests/driver/T17481.stdout
@@ -0,0 +1,15 @@
+Main.hs is now:
+main = putStrLn "Hello from A"
+Compiling and running Main.hs:
+[1 of 1] Compiling Main ( Main.hs, Main.o )
+Linking Main ...
+Hello from A
+Main.hs is now:
+main = putStrLn "Hello from B"
+Compiling and running Main.hs:
+[1 of 1] Compiling Main ( Main.hs, Main.o ) [Source file changed]
+Linking Main ...
+Hello from B
+Touching Main.hs
+Compiling and running Main.hs:
+Hello from B
diff --git a/testsuite/tests/driver/all.T b/testsuite/tests/driver/all.T
index 1c64f9905a..6fa78378ce 100644
--- a/testsuite/tests/driver/all.T
+++ b/testsuite/tests/driver/all.T
@@ -290,3 +290,4 @@ test('T17786', unless(opsys('mingw32'), skip), makefile_test, [])
test('T18369', normal, compile, ['-O'])
test('FullGHCVersion', normal, compile_and_run, ['-package ghc-boot'])
test('OneShotTH', normal, makefile_test, [])
+test('T17481', normal, makefile_test, [])