diff --git a/testsuite/tests/driver/recomp019/B1.hs b/testsuite/tests/driver/recomp019/B1.hs new file mode 100644 index 0000000000000000000000000000000000000000..9943eab2317549b3cfa4e84a7bce3dd6911a162c --- /dev/null +++ b/testsuite/tests/driver/recomp019/B1.hs @@ -0,0 +1,4 @@ +module B where + +x :: Int +x = 2 diff --git a/testsuite/tests/driver/recomp019/B2.hs b/testsuite/tests/driver/recomp019/B2.hs new file mode 100644 index 0000000000000000000000000000000000000000..bed169b09c915a10a140ce16afe648fd35f642ae --- /dev/null +++ b/testsuite/tests/driver/recomp019/B2.hs @@ -0,0 +1,4 @@ +module B where + +x :: Int +x = 12 diff --git a/testsuite/tests/driver/recomp019/C.hs b/testsuite/tests/driver/recomp019/C.hs new file mode 100644 index 0000000000000000000000000000000000000000..365ddd96559c0cee3cecd89fa735a8632763777f --- /dev/null +++ b/testsuite/tests/driver/recomp019/C.hs @@ -0,0 +1,4 @@ +module C where + +x :: Int +x = 3 diff --git a/testsuite/tests/driver/recomp019/Main.hs b/testsuite/tests/driver/recomp019/Main.hs new file mode 100644 index 0000000000000000000000000000000000000000..084ba0a49a7db2ee16a06cf49183adbab86a186b --- /dev/null +++ b/testsuite/tests/driver/recomp019/Main.hs @@ -0,0 +1,6 @@ +module Main where + +import qualified B +import qualified C + +main = putStrLn $ show $ B.x + C.x diff --git a/testsuite/tests/driver/recomp019/Makefile b/testsuite/tests/driver/recomp019/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..8e66f82abb8182e8a726da77d9f1d3471b74414c --- /dev/null +++ b/testsuite/tests/driver/recomp019/Makefile @@ -0,0 +1,26 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +# Recompilation test for when .hi files are up to date but .o files are +# not + +clean: + rm -f Main *.o *.hi B.hs + +recomp019: clean + cp B1.hs B.hs + echo 'first run' + '$(TEST_HC)' $(TEST_HC_OPTS) --make Main + ./Main + + # Update B.hs + cp B2.hs B.hs + + # Update B.hi (but not B.o) + '$(TEST_HC)' $(TEST_HC_OPTS) --make B -fno-code -fwrite-interface + + # Recompile + echo 'second run' + '$(TEST_HC)' $(TEST_HC_OPTS) --make Main + ./Main diff --git a/testsuite/tests/driver/recomp019/all.T b/testsuite/tests/driver/recomp019/all.T new file mode 100644 index 0000000000000000000000000000000000000000..9b2481eab155af62546ecac3d40f8e70762b6478 --- /dev/null +++ b/testsuite/tests/driver/recomp019/all.T @@ -0,0 +1,6 @@ +# Recompilation test for when .hi files are up to date but .o files are +# not + +test('recomp019', + [extra_files(['Main.hs', 'B1.hs', 'B2.hs', 'C.hs'])], + makefile_test, []) diff --git a/testsuite/tests/driver/recomp019/recomp019.stdout b/testsuite/tests/driver/recomp019/recomp019.stdout new file mode 100644 index 0000000000000000000000000000000000000000..f1e4cd4d731cdb5810d41b447e03f5b394f8105c --- /dev/null +++ b/testsuite/tests/driver/recomp019/recomp019.stdout @@ -0,0 +1,11 @@ +first run +[1 of 3] Compiling B ( B.hs, B.o ) +[2 of 3] Compiling C ( C.hs, C.o ) +[3 of 3] Compiling Main ( Main.hs, Main.o ) +Linking Main ... +5 +[1 of 1] Compiling B ( B.hs, nothing ) +second run +[2 of 3] Compiling B ( B.hs, B.o ) +Linking Main ... +15