diff options
Diffstat (limited to 'testsuite/tests/driver')
36 files changed, 505 insertions, 0 deletions
diff --git a/testsuite/tests/driver/recomp014/Makefile b/testsuite/tests/driver/recomp014/Makefile new file mode 100644 index 0000000000..58c6f2a833 --- /dev/null +++ b/testsuite/tests/driver/recomp014/Makefile @@ -0,0 +1,27 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +# -fforce-recomp makes lots of driver tests trivially pass, so we +# filter it out from $(TEST_HC_OPTS). +TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) + +# Recompilation tests + +clean: + rm -f *.o *.hi + +recomp014: clean + echo 'module A where a = False' > A.hs + echo 'module A1 where a = False' > A1.hs + echo 'module B where a :: Bool' > B.hsig + echo 'first run' + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c A.hs + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c A1.hs + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c B.hsig -sig-of main:A + echo 'second run' + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c B.hsig -sig-of main:A1 + echo 'import B; main = print a' > C.hs + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c C.hs + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) A1.o C.o -o recomp014 + ./recomp014 diff --git a/testsuite/tests/driver/recomp014/all.T b/testsuite/tests/driver/recomp014/all.T new file mode 100644 index 0000000000..affccd2f7f --- /dev/null +++ b/testsuite/tests/driver/recomp014/all.T @@ -0,0 +1,4 @@ +test('recomp014', + [ clean_cmd('$MAKE -s clean') ], + run_command, + ['$MAKE -s --no-print-directory recomp014']) diff --git a/testsuite/tests/driver/recomp014/recomp014.stdout b/testsuite/tests/driver/recomp014/recomp014.stdout new file mode 100644 index 0000000000..2f899ed73e --- /dev/null +++ b/testsuite/tests/driver/recomp014/recomp014.stdout @@ -0,0 +1,3 @@ +first run +second run +False diff --git a/testsuite/tests/driver/sigof01/A.hs b/testsuite/tests/driver/sigof01/A.hs new file mode 100644 index 0000000000..644432a283 --- /dev/null +++ b/testsuite/tests/driver/sigof01/A.hs @@ -0,0 +1,10 @@ +module A where +data T = T + deriving (Show) +x = True +y = False +mkT = T +class Foo a where + foo :: a -> a +instance Foo Bool where + foo = not diff --git a/testsuite/tests/driver/sigof01/B.hsig b/testsuite/tests/driver/sigof01/B.hsig new file mode 100644 index 0000000000..289d3bcb18 --- /dev/null +++ b/testsuite/tests/driver/sigof01/B.hsig @@ -0,0 +1,6 @@ +module B where +data T +x :: Bool +mkT :: T +class Foo a where + foo :: a -> a diff --git a/testsuite/tests/driver/sigof01/Main.hs b/testsuite/tests/driver/sigof01/Main.hs new file mode 100644 index 0000000000..c90cfaf1db --- /dev/null +++ b/testsuite/tests/driver/sigof01/Main.hs @@ -0,0 +1,6 @@ +import B +y = foo x +main = do + print y + print mkT + print (foo y) diff --git a/testsuite/tests/driver/sigof01/Makefile b/testsuite/tests/driver/sigof01/Makefile new file mode 100644 index 0000000000..a54a1b97e4 --- /dev/null +++ b/testsuite/tests/driver/sigof01/Makefile @@ -0,0 +1,23 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +# -fforce-recomp makes lots of driver tests trivially pass, so we +# filter it out from $(TEST_HC_OPTS). +TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) + +S01_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof01 -i -itmp_sigof01 +sigof01: + rm -rf tmp_sigof01 + mkdir tmp_sigof01 + '$(TEST_HC)' $(S01_OPTS) -c A.hs + '$(TEST_HC)' $(S01_OPTS) -c B.hsig -sig-of main:A + '$(TEST_HC)' $(S01_OPTS) -c Main.hs + '$(TEST_HC)' $(S01_OPTS) tmp_sigof01/A.o tmp_sigof01/Main.o -o tmp_sigof01/Main + tmp_sigof01/Main + +sigof01m: + rm -rf tmp_sigof01m + mkdir tmp_sigof01m + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof01m --make Main.hs -sig-of "B is main:A" -o tmp_sigof01m/Main + tmp_sigof01m/Main diff --git a/testsuite/tests/driver/sigof01/all.T b/testsuite/tests/driver/sigof01/all.T new file mode 100644 index 0000000000..d0cdc3c02c --- /dev/null +++ b/testsuite/tests/driver/sigof01/all.T @@ -0,0 +1,9 @@ +test('sigof01', + [ clean_cmd('rm -rf tmp_sigof01') ], + run_command, + ['$MAKE -s --no-print-directory sigof01']) + +test('sigof01m', + [ clean_cmd('rm -rf tmp_sigof01m') ], + run_command, + ['$MAKE -s --no-print-directory sigof01m']) diff --git a/testsuite/tests/driver/sigof01/sigof01.stdout b/testsuite/tests/driver/sigof01/sigof01.stdout new file mode 100644 index 0000000000..bb614cd2a0 --- /dev/null +++ b/testsuite/tests/driver/sigof01/sigof01.stdout @@ -0,0 +1,3 @@ +False +T +True diff --git a/testsuite/tests/driver/sigof01/sigof01m.stdout b/testsuite/tests/driver/sigof01/sigof01m.stdout new file mode 100644 index 0000000000..a7fdd8298e --- /dev/null +++ b/testsuite/tests/driver/sigof01/sigof01m.stdout @@ -0,0 +1,7 @@ +[1 of 3] Compiling A ( A.hs, tmp_sigof01m/A.o ) +[2 of 3] Compiling B[sig of A] ( B.hsig, nothing ) +[3 of 3] Compiling Main ( Main.hs, tmp_sigof01m/Main.o ) +Linking tmp_sigof01m/Main ... +False +T +True diff --git a/testsuite/tests/driver/sigof02/Double.hs b/testsuite/tests/driver/sigof02/Double.hs new file mode 100644 index 0000000000..8111b1cc0f --- /dev/null +++ b/testsuite/tests/driver/sigof02/Double.hs @@ -0,0 +1,13 @@ +import Map +import MapAsSet + +main = do + let x = insert 0 "foo" + . delete 1 + . insert 1 undefined + . insert (6 :: Int) "foo" + $ empty + print (member 1 x) + print (keysSet x) + print (toList x) + print x diff --git a/testsuite/tests/driver/sigof02/Main.hs b/testsuite/tests/driver/sigof02/Main.hs new file mode 100644 index 0000000000..b6f41da773 --- /dev/null +++ b/testsuite/tests/driver/sigof02/Main.hs @@ -0,0 +1,11 @@ +import Map + +main = do + let x = insert 0 "foo" + . delete 1 + . insert 1 undefined + . insert (6 :: Int) "foo" + $ empty + print (member 1 x) + print (toList x) + print x diff --git a/testsuite/tests/driver/sigof02/Makefile b/testsuite/tests/driver/sigof02/Makefile new file mode 100644 index 0000000000..b61fe612ce --- /dev/null +++ b/testsuite/tests/driver/sigof02/Makefile @@ -0,0 +1,75 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +# -fforce-recomp makes lots of driver tests trivially pass, so we +# filter it out from $(TEST_HC_OPTS). +TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) + +S02_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02 -i -itmp_sigof02 +sigof02: + rm -rf tmp_sigof02 + mkdir tmp_sigof02 + '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02/containers + '$(TEST_HC)' $(S02_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02/containers`:Data.Map.Strict" + '$(TEST_HC)' $(S02_OPTS) -c Main.hs + '$(TEST_HC)' $(S02_OPTS) -package containers tmp_sigof02/Main.o -o tmp_sigof02/StrictMain + ! ./tmp_sigof02/StrictMain + '$(TEST_HC)' $(S02_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02/containers`:Data.Map.Lazy" + '$(TEST_HC)' $(S02_OPTS) -c Main.hs + '$(TEST_HC)' $(S02_OPTS) -package containers tmp_sigof02/Main.o -o tmp_sigof02/LazyMain + ./tmp_sigof02/LazyMain + +S02T_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -fno-code -fwrite-interface -outputdir tmp_sigof02t -i -itmp_sigof02t +sigof02t: + rm -rf tmp_sigof02t + mkdir tmp_sigof02t + '$(TEST_HC)' $(S02T_OPTS) -c Map.hsig + '$(TEST_HC)' $(S02T_OPTS) -c Main.hs + +S02M_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02m +sigof02m: + rm -rf tmp_sigof02m + mkdir tmp_sigof02m + '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02m/containers + '$(TEST_HC)' $(S02M_OPTS) --make Main.hs -sig-of "Map is `cat tmp_sigof02m/containers`:Data.Map.Strict" -o tmp_sigof02m/StrictMain + ! ./tmp_sigof02m/StrictMain + '$(TEST_HC)' $(S02M_OPTS) --make Main.hs -sig-of "Map is `cat tmp_sigof02m/containers`:Data.Map.Lazy" -o tmp_sigof02m/LazyMain + ./tmp_sigof02m/LazyMain + +sigof02mt: + rm -rf tmp_sigof02mt + mkdir tmp_sigof02mt + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02mt --make Main.hs -fno-code -fwrite-interface + +S02D_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02d -i -itmp_sigof02d +sigof02d: + rm -rf tmp_sigof02d + mkdir tmp_sigof02d + '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02d/containers + '$(TEST_HC)' $(S02D_OPTS) -c Map.hsig -sig-of "`cat tmp_sigof02d/containers`:Data.Map.Lazy" + '$(TEST_HC)' $(S02D_OPTS) -c MapAsSet.hsig -sig-of "`cat tmp_sigof02d/containers`:Data.Map.Lazy" + '$(TEST_HC)' $(S02D_OPTS) -c Double.hs + '$(TEST_HC)' $(S02D_OPTS) -package containers tmp_sigof02d/Main.o -o tmp_sigof02d/Double + ./tmp_sigof02d/Double + +S02DT_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02dt -i -itmp_sigof02dt -fno-code -fwrite-interface +sigof02dt: + rm -rf tmp_sigof02dt + mkdir tmp_sigof02dt + '$(TEST_HC)' $(S02DT_OPTS) -c Map.hsig + '$(TEST_HC)' $(S02DT_OPTS) -c MapAsSet.hsig + ! '$(TEST_HC)' $(S02DT_OPTS) -c Double.hs + +sigof02dm: + rm -rf tmp_sigof02dm + mkdir tmp_sigof02dm + '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > tmp_sigof02dm/containers + '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02dm --make Double.hs -sig-of "Map is `cat tmp_sigof02dm/containers`:Data.Map.Lazy, MapAsSet is `cat tmp_sigof02dm/containers`:Data.Map.Lazy" -o tmp_sigof02dm/Double + ./tmp_sigof02dm/Double + +sigof02dmt: + rm -rf tmp_sigof02dmt + mkdir tmp_sigof02dmt + # doesn't typecheck due to lack of alias + ! '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof02dmt -fno-code -fwrite-interface --make Double.hs -o tmp_sigof02dm/Double diff --git a/testsuite/tests/driver/sigof02/Map.hsig b/testsuite/tests/driver/sigof02/Map.hsig new file mode 100644 index 0000000000..cd094df17f --- /dev/null +++ b/testsuite/tests/driver/sigof02/Map.hsig @@ -0,0 +1,133 @@ +{-# LANGUAGE RoleAnnotations #-} +module Map where + +import Data.Typeable +import Data.Data +import Data.Traversable +import Data.Foldable +import Data.Monoid +import Control.DeepSeq +import Control.Applicative + +infixl 9 !,\\ + +type role Map nominal representational +data Map k a + +instance Typeable Map +instance Functor (Map k) +instance Foldable (Map k) +instance Traversable (Map k) +instance (Eq k, Eq a) => Eq (Map k a) +instance (Data k, Data a, Ord k) => Data (Map k a) +instance (Ord k, Ord v) => Ord (Map k v) +instance (Ord k, Read k, Read e) => Read (Map k e) +instance (Show k, Show a) => Show (Map k a) +instance Ord k => Monoid (Map k v) +instance (NFData k, NFData a) => NFData (Map k a) + +(!) :: Ord k => Map k a -> k -> a +(\\) :: Ord k => Map k a -> Map k b -> Map k a +null :: Map k a -> Bool +size :: Map k a -> Int +member :: Ord k => k -> Map k a -> Bool +notMember :: Ord k => k -> Map k a -> Bool +lookup :: Ord k => k -> Map k a -> Maybe a +findWithDefault :: Ord k => a -> k -> Map k a -> a +lookupLT :: Ord k => k -> Map k v -> Maybe (k, v) +lookupGT :: Ord k => k -> Map k v -> Maybe (k, v) +lookupLE :: Ord k => k -> Map k v -> Maybe (k, v) +lookupGE :: Ord k => k -> Map k v -> Maybe (k, v) +empty :: Map k a +singleton :: k -> a -> Map k a +insert :: Ord k => k -> a -> Map k a -> Map k a +insertWith :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a +insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a +insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a) +delete :: Ord k => k -> Map k a -> Map k a +adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a +adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a +update :: Ord k => (a -> Maybe a) -> k -> Map k a -> Map k a +updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> Map k a +updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a) +alter :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a +union :: Ord k => Map k a -> Map k a -> Map k a +unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a +unionWithKey :: Ord k => (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a +unions :: Ord k => [Map k a] -> Map k a +unionsWith :: Ord k => (a -> a -> a) -> [Map k a] -> Map k a +difference :: Ord k => Map k a -> Map k b -> Map k a +differenceWith :: Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a +differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a +intersection :: Ord k => Map k a -> Map k b -> Map k a +intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c +intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c +mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (Map k a -> Map k c) -> (Map k b -> Map k c) -> Map k a -> Map k b -> Map k c +map :: (a -> b) -> Map k a -> Map k b +mapWithKey :: (k -> a -> b) -> Map k a -> Map k b +traverseWithKey :: Applicative t => (k -> a -> t b) -> Map k a -> t (Map k b) +mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) +mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) +mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c) +mapKeys :: Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a +mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a +mapKeysMonotonic :: (k1 -> k2) -> Map k1 a -> Map k2 a +foldr :: (a -> b -> b) -> b -> Map k a -> b +foldl :: (a -> b -> a) -> a -> Map k b -> a +foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b +foldlWithKey :: (a -> k -> b -> a) -> a -> Map k b -> a +foldMapWithKey :: Monoid m => (k -> a -> m) -> Map k a -> m +foldr' :: (a -> b -> b) -> b -> Map k a -> b +foldl' :: (a -> b -> a) -> a -> Map k b -> a +foldrWithKey' :: (k -> a -> b -> b) -> b -> Map k a -> b +foldlWithKey' :: (a -> k -> b -> a) -> a -> Map k b -> a +elems :: Map k a -> [a] +keys :: Map k a -> [k] +assocs :: Map k a -> [(k, a)] +toList :: Map k a -> [(k, a)] +fromList :: Ord k => [(k, a)] -> Map k a +fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> Map k a +fromListWithKey :: Ord k => (k -> a -> a -> a) -> [(k, a)] -> Map k a +toAscList :: Map k a -> [(k, a)] +toDescList :: Map k a -> [(k, a)] +fromAscList :: Eq k => [(k, a)] -> Map k a +fromAscListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> Map k a +fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a +fromDistinctAscList :: [(k, a)] -> Map k a +filter :: (a -> Bool) -> Map k a -> Map k a +filterWithKey :: (k -> a -> Bool) -> Map k a -> Map k a +partition :: (a -> Bool) -> Map k a -> (Map k a, Map k a) +partitionWithKey :: (k -> a -> Bool) -> Map k a -> (Map k a, Map k a) +mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b +mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b +mapEither :: (a -> Either b c) -> Map k a -> (Map k b, Map k c) +mapEitherWithKey :: (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c) +split :: Ord k => k -> Map k a -> (Map k a, Map k a) +splitLookup :: Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a) +splitRoot :: Map k b -> [Map k b] +isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool +isSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool +isProperSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool +isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool +lookupIndex :: Ord k => k -> Map k a -> Maybe Int +findIndex :: Ord k => k -> Map k a -> Int +elemAt :: Int -> Map k a -> (k, a) +updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a +deleteAt :: Int -> Map k a -> Map k a +findMin :: Map k a -> (k, a) +findMax :: Map k a -> (k, a) +deleteMin :: Map k a -> Map k a +deleteMax :: Map k a -> Map k a +deleteFindMin :: Map k a -> ((k, a), Map k a) +deleteFindMax :: Map k a -> ((k, a), Map k a) +updateMin :: (a -> Maybe a) -> Map k a -> Map k a +updateMax :: (a -> Maybe a) -> Map k a -> Map k a +updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a +updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a +minView :: Map k a -> Maybe (a, Map k a) +maxView :: Map k a -> Maybe (a, Map k a) +minViewWithKey :: Map k a -> Maybe ((k, a), Map k a) +maxViewWithKey :: Map k a -> Maybe ((k, a), Map k a) +showTree :: (Show k, Show a) => Map k a -> String +showTreeWith :: (k -> a -> String) -> Bool -> Bool -> Map k a -> String +valid :: Ord k => Map k a -> Bool diff --git a/testsuite/tests/driver/sigof02/MapAsSet.hsig b/testsuite/tests/driver/sigof02/MapAsSet.hsig new file mode 100644 index 0000000000..1defbc7717 --- /dev/null +++ b/testsuite/tests/driver/sigof02/MapAsSet.hsig @@ -0,0 +1,11 @@ +{-# LANGUAGE RoleAnnotations #-} +module MapAsSet where + +import Data.Set + +type role Map nominal representational +data Map k a +instance Functor (Map k) + +keysSet :: Map k a -> Set k +fromSet :: (k -> a) -> Set k -> Map k a diff --git a/testsuite/tests/driver/sigof02/all.T b/testsuite/tests/driver/sigof02/all.T new file mode 100644 index 0000000000..62f50a6aa8 --- /dev/null +++ b/testsuite/tests/driver/sigof02/all.T @@ -0,0 +1,41 @@ +test('sigof02', + [ clean_cmd('rm -rf tmp_sigof02') ], + run_command, + ['$MAKE -s --no-print-directory sigof02']) + +test('sigof02t', + [ clean_cmd('rm -rf tmp_sigof02t') ], + run_command, + ['$MAKE -s --no-print-directory sigof02t']) + +test('sigof02m', + [ clean_cmd('rm -rf tmp_sigof02m') ], + run_command, + ['$MAKE -s --no-print-directory sigof02m']) + +test('sigof02mt', + [ clean_cmd('rm -rf tmp_sigof02mt') ], + run_command, + ['$MAKE -s --no-print-directory sigof02mt']) + +test('sigof02d', + [ clean_cmd('rm -rf tmp_sigof02d') ], + run_command, + ['$MAKE -s --no-print-directory sigof02d']) + +test('sigof02dt', + [ clean_cmd('rm -rf tmp_sigof02dt') ], + run_command, + ['$MAKE -s --no-print-directory sigof02dt']) + + +test('sigof02dm', + [ clean_cmd('rm -rf tmp_sigof02dm') ], + run_command, + ['$MAKE -s --no-print-directory sigof02dm']) + +test('sigof02dmt', + [ clean_cmd('rm -rf tmp_sigof02dmt') ], + run_command, + ['$MAKE -s --no-print-directory sigof02dmt']) + diff --git a/testsuite/tests/driver/sigof02/sigof02.stderr b/testsuite/tests/driver/sigof02/sigof02.stderr new file mode 100644 index 0000000000..264efdacb0 --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02.stderr @@ -0,0 +1 @@ +StrictMain: Prelude.undefined diff --git a/testsuite/tests/driver/sigof02/sigof02.stdout b/testsuite/tests/driver/sigof02/sigof02.stdout new file mode 100644 index 0000000000..687b80c41d --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02.stdout @@ -0,0 +1,3 @@ +False +[(0,"foo"),(6,"foo")] +fromList [(0,"foo"),(6,"foo")] diff --git a/testsuite/tests/driver/sigof02/sigof02d.stdout b/testsuite/tests/driver/sigof02/sigof02d.stdout new file mode 100644 index 0000000000..0d0e0f9383 --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02d.stdout @@ -0,0 +1,4 @@ +False +fromList [0,6] +[(0,"foo"),(6,"foo")] +fromList [(0,"foo"),(6,"foo")] diff --git a/testsuite/tests/driver/sigof02/sigof02dm.stdout b/testsuite/tests/driver/sigof02/sigof02dm.stdout new file mode 100644 index 0000000000..14ee83789b --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02dm.stdout @@ -0,0 +1,8 @@ +[1 of 3] Compiling MapAsSet[sig of Data.Map.Lazy] ( MapAsSet.hsig, nothing ) +[2 of 3] Compiling Map[sig of Data.Map.Lazy] ( Map.hsig, nothing ) +[3 of 3] Compiling Main ( Double.hs, tmp_sigof02dm/Main.o ) +Linking tmp_sigof02dm/Double ... +False +fromList [0,6] +[(0,"foo"),(6,"foo")] +fromList [(0,"foo"),(6,"foo")] diff --git a/testsuite/tests/driver/sigof02/sigof02dmt.stderr b/testsuite/tests/driver/sigof02/sigof02dmt.stderr new file mode 100644 index 0000000000..1da04499ba --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02dmt.stderr @@ -0,0 +1,8 @@ + +Double.hs:11:20: + Couldn't match expected type ‘MapAsSet.Map k0 a0’ + with actual type ‘Map.Map Int [Char]’ + NB: ‘MapAsSet.Map’ is defined at MapAsSet.hsig:7:1-12 + ‘Map.Map’ is defined at Map.hsig:15:1-12 + In the first argument of ‘keysSet’, namely ‘x’ + In the first argument of ‘print’, namely ‘(keysSet x)’ diff --git a/testsuite/tests/driver/sigof02/sigof02dmt.stdout b/testsuite/tests/driver/sigof02/sigof02dmt.stdout new file mode 100644 index 0000000000..5df6557883 --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02dmt.stdout @@ -0,0 +1,3 @@ +[1 of 3] Compiling MapAsSet[abstract sig] ( MapAsSet.hsig, nothing ) +[2 of 3] Compiling Map[abstract sig] ( Map.hsig, nothing ) +[3 of 3] Compiling Main ( Double.hs, nothing ) diff --git a/testsuite/tests/driver/sigof02/sigof02dt.stderr b/testsuite/tests/driver/sigof02/sigof02dt.stderr new file mode 100644 index 0000000000..227a34f136 --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02dt.stderr @@ -0,0 +1,8 @@ + +Double.hs:11:20: + Couldn't match expected type ‘MapAsSet.Map k0 a0’ + with actual type ‘Map.Map Int [Char]’ + NB: ‘MapAsSet.Map’ is defined in ‘MapAsSet’ + ‘Map.Map’ is defined in ‘Map’ + In the first argument of ‘keysSet’, namely ‘x’ + In the first argument of ‘print’, namely ‘(keysSet x)’ diff --git a/testsuite/tests/driver/sigof02/sigof02m.stderr b/testsuite/tests/driver/sigof02/sigof02m.stderr new file mode 100644 index 0000000000..264efdacb0 --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02m.stderr @@ -0,0 +1 @@ +StrictMain: Prelude.undefined diff --git a/testsuite/tests/driver/sigof02/sigof02m.stdout b/testsuite/tests/driver/sigof02/sigof02m.stdout new file mode 100644 index 0000000000..41cc4a7bb3 --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02m.stdout @@ -0,0 +1,9 @@ +[1 of 2] Compiling Map[sig of Data.Map.Strict] ( Map.hsig, nothing ) +[2 of 2] Compiling Main ( Main.hs, tmp_sigof02m/Main.o ) +Linking tmp_sigof02m/StrictMain ... +[1 of 2] Compiling Map[sig of Data.Map.Lazy] ( Map.hsig, nothing ) [sig-of changed] +[2 of 2] Compiling Main ( Main.hs, tmp_sigof02m/Main.o ) [Map changed] +Linking tmp_sigof02m/LazyMain ... +False +[(0,"foo"),(6,"foo")] +fromList [(0,"foo"),(6,"foo")] diff --git a/testsuite/tests/driver/sigof02/sigof02mt.stdout b/testsuite/tests/driver/sigof02/sigof02mt.stdout new file mode 100644 index 0000000000..dd7a193aea --- /dev/null +++ b/testsuite/tests/driver/sigof02/sigof02mt.stdout @@ -0,0 +1,2 @@ +[1 of 2] Compiling Map[abstract sig] ( Map.hsig, nothing ) +[2 of 2] Compiling Main ( Main.hs, nothing ) diff --git a/testsuite/tests/driver/sigof03/A.hs b/testsuite/tests/driver/sigof03/A.hs new file mode 100644 index 0000000000..67435f038c --- /dev/null +++ b/testsuite/tests/driver/sigof03/A.hs @@ -0,0 +1,3 @@ +module A where +class C a where +instance C Bool where diff --git a/testsuite/tests/driver/sigof03/ASig1.hsig b/testsuite/tests/driver/sigof03/ASig1.hsig new file mode 100644 index 0000000000..9428e0cf04 --- /dev/null +++ b/testsuite/tests/driver/sigof03/ASig1.hsig @@ -0,0 +1,3 @@ +module ASig1 where +class C a +instance C Bool diff --git a/testsuite/tests/driver/sigof03/ASig2.hsig b/testsuite/tests/driver/sigof03/ASig2.hsig new file mode 100644 index 0000000000..6f278b0a89 --- /dev/null +++ b/testsuite/tests/driver/sigof03/ASig2.hsig @@ -0,0 +1,3 @@ +module ASig2 where +class C a +instance C Bool diff --git a/testsuite/tests/driver/sigof03/Main.hs b/testsuite/tests/driver/sigof03/Main.hs new file mode 100644 index 0000000000..9aae9cc798 --- /dev/null +++ b/testsuite/tests/driver/sigof03/Main.hs @@ -0,0 +1,3 @@ +import ASig1 +import ASig2 +main = return () diff --git a/testsuite/tests/driver/sigof03/Makefile b/testsuite/tests/driver/sigof03/Makefile new file mode 100644 index 0000000000..28c59805aa --- /dev/null +++ b/testsuite/tests/driver/sigof03/Makefile @@ -0,0 +1,30 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +# -fforce-recomp makes lots of driver tests trivially pass, so we +# filter it out from $(TEST_HC_OPTS). +TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) + +S03_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof03 -i -itmp_sigof03 +sigof03: + rm -rf tmp_sigof03 + mkdir tmp_sigof03 + '$(TEST_HC)' $(S03_OPTS) -c A.hs + '$(TEST_HC)' $(S03_OPTS) -c ASig1.hsig -sig-of main:A + '$(TEST_HC)' $(S03_OPTS) -c ASig2.hsig -sig-of main:A + '$(TEST_HC)' $(S03_OPTS) -c Main.hs + '$(TEST_HC)' $(S03_OPTS) tmp_sigof03/A.o tmp_sigof03/Main.o -o tmp_sigof03/Main + ./tmp_sigof03/Main + +S03M_OPTS=$(TEST_HC_OPTS_NO_RECOMP) -outputdir tmp_sigof03m +sigof03m: + rm -rf tmp_sigof03m + mkdir tmp_sigof03m + '$(TEST_HC)' $(S03M_OPTS) --make Main.hs -sig-of "ASig1 is main:A, ASig2 is main:A" + ./tmp_sigof03m/Main + +# Currently, the type-check tests are omitted, because we don't have a +# way of telling GHC that ASig1 and ASig2 have the same identities +# (sig-of is not right because it requires the target to have an hi +# file, but in general we won't have it.) diff --git a/testsuite/tests/driver/sigof03/all.T b/testsuite/tests/driver/sigof03/all.T new file mode 100644 index 0000000000..e8df3e10f4 --- /dev/null +++ b/testsuite/tests/driver/sigof03/all.T @@ -0,0 +1,11 @@ +test('sigof03', + [ clean_cmd('rm -rf tmp_sigof03') ], + run_command, + ['$MAKE -s --no-print-directory sigof03']) + +# This doesn't work yet, because the instances aren't found the +# right way (they don't go in the EPS, differently from one-shot) +test('sigof03m', + [ clean_cmd('rm -rf tmp_sigof03m'), expect_fail ], + run_command, + ['$MAKE -s --no-print-directory sigof03m']) diff --git a/testsuite/tests/driver/sigof04/Makefile b/testsuite/tests/driver/sigof04/Makefile new file mode 100644 index 0000000000..e68d7b6bfc --- /dev/null +++ b/testsuite/tests/driver/sigof04/Makefile @@ -0,0 +1,14 @@ +TOP=../../.. +include $(TOP)/mk/boilerplate.mk +include $(TOP)/mk/test.mk + +# -fforce-recomp makes lots of driver tests trivially pass, so we +# filter it out from $(TEST_HC_OPTS). +TEST_HC_OPTS_NO_RECOMP = $(filter-out -fforce-recomp,$(TEST_HC_OPTS)) + +clean: + rm -rf containers + +sigof04: + '$(GHC_PKG)' field containers key | sed 's/^.*: *//' > containers + ! '$(TEST_HC)' $(TEST_HC_OPTS_NO_RECOMP) -c Sig.hsig -sig-of "`cat containers`:Data.Map.Strict" diff --git a/testsuite/tests/driver/sigof04/Sig.hsig b/testsuite/tests/driver/sigof04/Sig.hsig new file mode 100644 index 0000000000..3110f28fff --- /dev/null +++ b/testsuite/tests/driver/sigof04/Sig.hsig @@ -0,0 +1,2 @@ +module Sig(insert) where +import Data.Map.Lazy (insert) diff --git a/testsuite/tests/driver/sigof04/all.T b/testsuite/tests/driver/sigof04/all.T new file mode 100644 index 0000000000..7844bf8a69 --- /dev/null +++ b/testsuite/tests/driver/sigof04/all.T @@ -0,0 +1,4 @@ +test('sigof04', + [ clean_cmd('$MAKE -s clean') ], + run_command, + ['$MAKE -s --no-print-directory sigof04']) diff --git a/testsuite/tests/driver/sigof04/sigof04.stderr b/testsuite/tests/driver/sigof04/sigof04.stderr new file mode 100644 index 0000000000..acb04679cd --- /dev/null +++ b/testsuite/tests/driver/sigof04/sigof04.stderr @@ -0,0 +1,3 @@ + +<no location info>: + insert is exported by the hsig file, but not exported by the module |