summaryrefslogtreecommitdiff
path: root/testsuite/tests/driver/recomp008
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/driver/recomp008')
-rw-r--r--testsuite/tests/driver/recomp008/A1.hs8
-rw-r--r--testsuite/tests/driver/recomp008/A2.hs8
-rw-r--r--testsuite/tests/driver/recomp008/B.hs4
-rw-r--r--testsuite/tests/driver/recomp008/Main.hs5
-rw-r--r--testsuite/tests/driver/recomp008/Makefile28
-rw-r--r--testsuite/tests/driver/recomp008/all.T7
-rw-r--r--testsuite/tests/driver/recomp008/recomp008.stdout2
7 files changed, 62 insertions, 0 deletions
diff --git a/testsuite/tests/driver/recomp008/A1.hs b/testsuite/tests/driver/recomp008/A1.hs
new file mode 100644
index 0000000000..224258034a
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/A1.hs
@@ -0,0 +1,8 @@
+module A (T,t) where
+
+data T = T
+t = T
+
+instance Eq T where
+ t1 == t2 = True
+
diff --git a/testsuite/tests/driver/recomp008/A2.hs b/testsuite/tests/driver/recomp008/A2.hs
new file mode 100644
index 0000000000..efc9207399
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/A2.hs
@@ -0,0 +1,8 @@
+module A (T,t) where
+
+data T = T
+t = T
+
+instance Eq T where
+ t1 == t2 = False
+
diff --git a/testsuite/tests/driver/recomp008/B.hs b/testsuite/tests/driver/recomp008/B.hs
new file mode 100644
index 0000000000..b1b7491b07
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/B.hs
@@ -0,0 +1,4 @@
+module B (T,t) where
+
+import A
+
diff --git a/testsuite/tests/driver/recomp008/Main.hs b/testsuite/tests/driver/recomp008/Main.hs
new file mode 100644
index 0000000000..df246a3303
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/Main.hs
@@ -0,0 +1,5 @@
+module Main where
+
+import B
+
+main = print (t == t)
diff --git a/testsuite/tests/driver/recomp008/Makefile b/testsuite/tests/driver/recomp008/Makefile
new file mode 100644
index 0000000000..3e598ae9f1
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/Makefile
@@ -0,0 +1,28 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+Main.o : B.hi
+B.o : A.hi
+
+%.o : %.hs
+ '$(TEST_HC)' $(TEST_HC_OPTS) -O -c $< -o $@
+
+# magic .hi rule: see rules/hi-rule.mk in the GHC source tree
+%.hi : %.o ;
+
+prog : A.o B.o Main.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) -o prog A.o B.o Main.o
+
+clean :
+ $(RM) *.hi *.o prog
+
+recomp008 :
+ $(MAKE) clean
+ cp A1.hs A.hs
+ $(MAKE) prog
+ ./prog
+ sleep 1
+ cp A2.hs A.hs
+ $(MAKE) prog
+ ./prog
diff --git a/testsuite/tests/driver/recomp008/all.T b/testsuite/tests/driver/recomp008/all.T
new file mode 100644
index 0000000000..a59b1512e0
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/all.T
@@ -0,0 +1,7 @@
+# Test for #4469, a recompilation bug related to instances
+
+test('recomp008',
+ [ skip_if_fast, clean_cmd('$MAKE -s clean'), normalise_slashes ],
+ run_command,
+ ['$MAKE -s --no-print-directory recomp008'])
+
diff --git a/testsuite/tests/driver/recomp008/recomp008.stdout b/testsuite/tests/driver/recomp008/recomp008.stdout
new file mode 100644
index 0000000000..1cc8b5e10d
--- /dev/null
+++ b/testsuite/tests/driver/recomp008/recomp008.stdout
@@ -0,0 +1,2 @@
+True
+False