summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/driver/recomp019/B1.hs4
-rw-r--r--testsuite/tests/driver/recomp019/B2.hs4
-rw-r--r--testsuite/tests/driver/recomp019/C.hs4
-rw-r--r--testsuite/tests/driver/recomp019/Main.hs6
-rw-r--r--testsuite/tests/driver/recomp019/Makefile26
-rw-r--r--testsuite/tests/driver/recomp019/all.T6
-rw-r--r--testsuite/tests/driver/recomp019/recomp019.stdout11
7 files changed, 61 insertions, 0 deletions
diff --git a/testsuite/tests/driver/recomp019/B1.hs b/testsuite/tests/driver/recomp019/B1.hs
new file mode 100644
index 0000000000..9943eab231
--- /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 0000000000..bed169b09c
--- /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 0000000000..365ddd9655
--- /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 0000000000..084ba0a49a
--- /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 0000000000..8e66f82abb
--- /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 0000000000..9b2481eab1
--- /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 0000000000..f1e4cd4d73
--- /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