summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarry Garrood harry@garrood.me <harry@garrood.me>2021-03-01 21:19:23 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-05-03 19:48:21 -0400
commit1b9df11115467c1e00d97a50d488a73bd2439eba (patch)
tree77a37107855c7fee7ef27ad6cac636fd746b4318
parente61d2d47c4942c829ec98016be5aa5ae36982524 (diff)
downloadhaskell-1b9df11115467c1e00d97a50d488a73bd2439eba.tar.gz
Add test case for #8144
Fixes #8144
-rw-r--r--testsuite/tests/driver/T8144/Makefile20
-rw-r--r--testsuite/tests/driver/T8144/T8144.stdout1
-rw-r--r--testsuite/tests/driver/T8144/Test.hs3
-rw-r--r--testsuite/tests/driver/T8144/cabal_macros.h1
-rw-r--r--testsuite/tests/driver/T8144/test.T1
5 files changed, 26 insertions, 0 deletions
diff --git a/testsuite/tests/driver/T8144/Makefile b/testsuite/tests/driver/T8144/Makefile
new file mode 100644
index 0000000000..f5df0dc22e
--- /dev/null
+++ b/testsuite/tests/driver/T8144/Makefile
@@ -0,0 +1,20 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+# Test that iface hashes are reproducible, and in particular don't include
+# timestamps of dependent files. This test case was originally written by Niklas
+# Hambüchen; see
+# https://github.com/nh2/ghc-bug-time-dependent-interface-hashes/
+#
+clean ::
+ rm -f *.o *.hi *.show-iface
+
+dotest ::
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c Test.hs -optP-include -optPcabal_macros.h
+ '$(TEST_HC)' $(TEST_HC_OPTS) --show-iface Test.hi > before.show-iface
+ sleep 1 # because some systems have a 1-second resolution for file timestamps
+ touch cabal_macros.h
+ '$(TEST_HC)' $(TEST_HC_OPTS) -c Test.hs -optP-include -optPcabal_macros.h
+ '$(TEST_HC)' $(TEST_HC_OPTS) --show-iface Test.hi > after.show-iface
+ diff before.show-iface after.show-iface
diff --git a/testsuite/tests/driver/T8144/T8144.stdout b/testsuite/tests/driver/T8144/T8144.stdout
new file mode 100644
index 0000000000..ae02c1f7a8
--- /dev/null
+++ b/testsuite/tests/driver/T8144/T8144.stdout
@@ -0,0 +1 @@
+compilation IS NOT required
diff --git a/testsuite/tests/driver/T8144/Test.hs b/testsuite/tests/driver/T8144/Test.hs
new file mode 100644
index 0000000000..5c8df5383c
--- /dev/null
+++ b/testsuite/tests/driver/T8144/Test.hs
@@ -0,0 +1,3 @@
+{-# LANGUAGE CPP #-}
+
+module Test () where
diff --git a/testsuite/tests/driver/T8144/cabal_macros.h b/testsuite/tests/driver/T8144/cabal_macros.h
new file mode 100644
index 0000000000..445e735c91
--- /dev/null
+++ b/testsuite/tests/driver/T8144/cabal_macros.h
@@ -0,0 +1 @@
+/* This comment is here to please the whitespace linter */
diff --git a/testsuite/tests/driver/T8144/test.T b/testsuite/tests/driver/T8144/test.T
new file mode 100644
index 0000000000..0712d0cffc
--- /dev/null
+++ b/testsuite/tests/driver/T8144/test.T
@@ -0,0 +1 @@
+test('T8144', [extra_files(['Test.hs', 'cabal_macros.h'])], makefile_test, ['dotest'])