Add test to ensure that SPEC rules are named deterministically
authorBen Gamari <bgamari.foss@gmail.com>
Fri, 3 Mar 2017 20:50:41 +0000 (15:50 -0500)
committerBen Gamari <ben@smart-cactus.org>
Fri, 3 Mar 2017 20:50:48 +0000 (15:50 -0500)
Test Plan: Validate

Reviewers: niteria, austin, dfeuer

Reviewed By: dfeuer

Subscribers: simonpj, thomie

Differential Revision: https://phabricator.haskell.org/D3220

testsuite/tests/determinism/determ022/A.hs [new file with mode: 0644]
testsuite/tests/determinism/determ022/Makefile [new file with mode: 0644]
testsuite/tests/determinism/determ022/all.T [new file with mode: 0644]
testsuite/tests/determinism/determ022/determ022.stdout [new file with mode: 0644]

diff --git a/testsuite/tests/determinism/determ022/A.hs b/testsuite/tests/determinism/determ022/A.hs
new file mode 100644 (file)
index 0000000..5b12e27
--- /dev/null
@@ -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 (file)
index 0000000..1bd543e
--- /dev/null
@@ -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 (file)
index 0000000..3ecdf3c
--- /dev/null
@@ -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 (file)
index 0000000..60c2bc3
--- /dev/null
@@ -0,0 +1,2 @@
+[1 of 1] Compiling A                ( A.hs, A.o )
+[1 of 1] Compiling A                ( A.hs, A.o )