summaryrefslogtreecommitdiff
path: root/testsuite/tests/determinism
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-03-03 15:50:41 -0500
committerBen Gamari <ben@smart-cactus.org>2017-03-03 15:50:48 -0500
commit0ce11aedd404e2d1eabd362e5c3329960008de88 (patch)
treeefc5126ece9d8c9e97a5d150d3ec751e623f5efd /testsuite/tests/determinism
parentd5e0b4bd4a8623169e59a6de6d4d9f84ea94aa22 (diff)
downloadhaskell-0ce11aedd404e2d1eabd362e5c3329960008de88.tar.gz
Add test to ensure that SPEC rules are named deterministically
Test Plan: Validate Reviewers: niteria, austin, dfeuer Reviewed By: dfeuer Subscribers: simonpj, thomie Differential Revision: https://phabricator.haskell.org/D3220
Diffstat (limited to 'testsuite/tests/determinism')
-rw-r--r--testsuite/tests/determinism/determ022/A.hs6
-rw-r--r--testsuite/tests/determinism/determ022/Makefile11
-rw-r--r--testsuite/tests/determinism/determ022/all.T1
-rw-r--r--testsuite/tests/determinism/determ022/determ022.stdout2
4 files changed, 20 insertions, 0 deletions
diff --git a/testsuite/tests/determinism/determ022/A.hs b/testsuite/tests/determinism/determ022/A.hs
new file mode 100644
index 0000000000..5b12e27384
--- /dev/null
+++ b/testsuite/tests/determinism/determ022/A.hs
@@ -0,0 +1,6 @@
+-- | Test that SPEC rules are named deterministically.
+module A where
+
+test1 :: Num a => a -> a -> a
+test1 x y = x + 42 * y
+{-# SPECIALISE test1 :: Int -> Int -> Int #-}
diff --git a/testsuite/tests/determinism/determ022/Makefile b/testsuite/tests/determinism/determ022/Makefile
new file mode 100644
index 0000000000..1bd543ed2a
--- /dev/null
+++ b/testsuite/tests/determinism/determ022/Makefile
@@ -0,0 +1,11 @@
+TOP=../../..
+include $(TOP)/mk/boilerplate.mk
+include $(TOP)/mk/test.mk
+
+determ022:
+ $(RM) A.hi A.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) -O -dinitial-unique=0 -dunique-increment=1 A.hs
+ $(CP) A.hi A.normal.hi
+ $(RM) A.hi A.o
+ '$(TEST_HC)' $(TEST_HC_OPTS) -O -dinitial-unique=16777215 -dunique-increment=-1 A.hs
+ diff A.hi A.normal.hi
diff --git a/testsuite/tests/determinism/determ022/all.T b/testsuite/tests/determinism/determ022/all.T
new file mode 100644
index 0000000000..3ecdf3ca1c
--- /dev/null
+++ b/testsuite/tests/determinism/determ022/all.T
@@ -0,0 +1 @@
+test('determ022', [extra_files(['A.hs'])], run_command, ['$MAKE -s --no-print-directory determ022'])
diff --git a/testsuite/tests/determinism/determ022/determ022.stdout b/testsuite/tests/determinism/determ022/determ022.stdout
new file mode 100644
index 0000000000..60c2bc368d
--- /dev/null
+++ b/testsuite/tests/determinism/determ022/determ022.stdout
@@ -0,0 +1,2 @@
+[1 of 1] Compiling A ( A.hs, A.o )
+[1 of 1] Compiling A ( A.hs, A.o )