Allow users to ignore optimization changes
[ghc.git] / testsuite / tests / driver / Makefile
index c13665b..727cc44 100644 (file)
@@ -14,13 +14,15 @@ include $(TOP)/mk/test.mk
 
 OBJSUFFIX = .o
 
 
 OBJSUFFIX = .o
 
+TEST_HC_OPTS_NO_RTSOPTS = $(filter-out -rtsopts,$(TEST_HC_OPTS))
+
 # -----------------------------------------------------------------------------
 # One-shot compilations, non-hierarchical modules
 
 test011:
        $(RM) A011.hi
        $(RM) A011$(OBJSUFFIX)
 # -----------------------------------------------------------------------------
 # One-shot compilations, non-hierarchical modules
 
 test011:
        $(RM) A011.hi
        $(RM) A011$(OBJSUFFIX)
-       "$(TEST_HC)" $(TEST_HC_OPTS) $(TEST_HC_OPTS) -c A011.hs
+       "$(TEST_HC)" $(TEST_HC_OPTS) -c A011.hs
        test -f A011.hi
        test -f A011$(OBJSUFFIX)
 
        test -f A011.hi
        test -f A011$(OBJSUFFIX)
 
@@ -217,6 +219,14 @@ test042:
        "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make B042/C.hs -odir obj042
        test -f obj042/B042/C$(OBJSUFFIX)
 
        "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make B042/C.hs -odir obj042
        test -f obj042/B042/C$(OBJSUFFIX)
 
+# test -odir with stubs
+test042stub:
+       $(RM) -rf obj042stub
+       mkdir obj042stub
+       $(RM) B042stub/C.hi
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v0 --make B042stub/C.hs -odir obj042stub
+       test -f obj042stub/B042stub/C$(OBJSUFFIX)
+
 # test -hidir
 test043:
        $(RM) -f B043/C$(OBJSUFFIX)
 # test -hidir
 test043:
        $(RM) -f B043/C$(OBJSUFFIX)
@@ -398,16 +408,16 @@ DEPFILE200 = depend200
 # modify an existing dependency file.
 test200:
        $(RM) $(DEPFILE200)
 # modify an existing dependency file.
 test200:
        $(RM) $(DEPFILE200)
-       "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-makefile $(DEPFILE200) D200
+       "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-suffix "" -dep-makefile $(DEPFILE200) D200
        test -f $(DEPFILE200)
        test -f $(DEPFILE200)
-       "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-makefile $(DEPFILE200) D200 B200.C A200
+       "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-suffix "" -dep-makefile $(DEPFILE200) D200 B200.C A200
        test -f $(DEPFILE200)
        test -f $(DEPFILE200)
-       "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-makefile $(DEPFILE200) D200.hs B200/C.hs A200.hs
+       "$(TEST_HC)" $(TEST_HC_OPTS) -M -dep-suffix "" -dep-makefile $(DEPFILE200) D200.hs B200/C.hs A200.hs
        test -f $(DEPFILE200)
 
 # -----------------------------------------------------------------------------
 
        test -f $(DEPFILE200)
 
 # -----------------------------------------------------------------------------
 
-2566::
+T2566::
        if "$(TEST_HC)" $(TEST_HC_OPTS) -c foo2566.bar; then false else true; fi
 
 .PHONY: mode001
        if "$(TEST_HC)" $(TEST_HC_OPTS) -c foo2566.bar; then false else true; fi
 
 .PHONY: mode001
@@ -419,26 +429,36 @@ test200:
 #     ghc: <stdout>: hFlush: resource vanished (Broken pipe)
 # on OS X
 mode001:
 #     ghc: <stdout>: hFlush: resource vanished (Broken pipe)
 # on OS X
 mode001:
-       "$(TEST_HC)" $(TEST_HC_OPTS) --make --help        | sed '2,$$d'
-       "$(TEST_HC)" $(TEST_HC_OPTS) --help --make        | sed '2,$$d'
-       "$(TEST_HC)" $(TEST_HC_OPTS) --interactive --help | sed '2,$$d'
-       "$(TEST_HC)" $(TEST_HC_OPTS) --help --interactive | sed '2,$$d'
-       "$(TEST_HC)" $(TEST_HC_OPTS) --version --help     | sed "s/, version.*//"
-       "$(TEST_HC)" $(TEST_HC_OPTS) --help --version        | sed '2,$$d'
-       "$(TEST_HC)" $(TEST_HC_OPTS) --interactive --version | sed "s/, version.*//"
-       "$(TEST_HC)" $(TEST_HC_OPTS) --version --interactive | sed "s/, version.*//"
+       "$(TEST_HC)" $(TEST_HC_OPTS) --make --help              | sed '2,$$d'
+       "$(TEST_HC)" $(TEST_HC_OPTS) --help --make              | sed '2,$$d'
+
+       "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) --help         | sed '2,$$d'
+       "$(TEST_HC)" --help $(TEST_HC_OPTS_INTERACTIVE)         | sed '2,$$d'
+
+       "$(TEST_HC)" $(TEST_HC_OPTS) --version --help           | sed "s/, version.*//"
+       "$(TEST_HC)" $(TEST_HC_OPTS) --help --version           | sed '2,$$d'
+
+       "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) --version      | sed "s/, version.*//"
+       "$(TEST_HC)" --version $(TEST_HC_OPTS_INTERACTIVE)      | sed "s/, version.*//"
+
+       "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) --show-options | grep -- --show-options | sed '2,$$d'
+       "$(TEST_HC)" --show-options $(TEST_HC_OPTS_INTERACTIVE) | grep -- --show-options | sed '2,$$d'
 
 # Test for building DLLs with ghc -shared, see #2745
 shared001:
        $(RM) Shared001.hi Shared001.o HSdll.dll.a HSdll.dll Shared001_stub.*
 
 # Test for building DLLs with ghc -shared, see #2745
 shared001:
        $(RM) Shared001.hi Shared001.o HSdll.dll.a HSdll.dll Shared001_stub.*
-       "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -shared Shared001.hs
+       "$(TEST_HC)" $(TEST_HC_OPTS_NO_RTSOPTS) -v0 -shared Shared001.hs
+
+static001:
+       $(RM) Static001.hi Static001.o liba.a Static001_stub.*
+       "$(TEST_HC)" $(TEST_HC_OPTS_NO_RTSOPTS) -v0 -staticlib Static001.hs
 
 # -----------------------------------------------------------------------------
 
 
 # -----------------------------------------------------------------------------
 
-3674:
-       $(RM) 3674*.o 3674*.hi 3674_pre
-       "$(TEST_HC)" $(TEST_HC_OPTS) --make 3674_pre.hs
-       "$(TEST_HC)" $(TEST_HC_OPTS) --make 3674.hs
+T3674:
+       $(RM) T3674*.o T3674*.hi T3674_pre
+       "$(TEST_HC)" $(TEST_HC_OPTS) --make -v0 T3674_pre.hs
+       "$(TEST_HC)" $(TEST_HC_OPTS) --make -v0 T3674.hs
 
 .PHONY: rtsopts001
 rtsopts001:
 
 .PHONY: rtsopts001
 rtsopts001:
@@ -481,13 +501,162 @@ T3364:
 .PHONY: T706
 T706:
        cp T706a.hs T706.hs
 .PHONY: T706
 T706:
        cp T706a.hs T706.hs
-       "$(TEST_HC)" $(TEST_HC_OPTS) -c T706.hs
+       "$(TEST_HC)" $(TEST_HC_OPTS) $(ghciWayFlags) -c T706.hs
        cp T706b.hs T706.hs
        cp T706b.hs T706.hs
-       "$(TEST_HC)" $(TEST_HC_OPTS) -c T706.hs
-       echo "test" | "$(TEST_HC)" $(TEST_HC_OPTS) --interactive -ignore-dot-ghci -v0 T706
+       "$(TEST_HC)" $(TEST_HC_OPTS) $(ghciWayFlags) -c T706.hs
+       echo "test" | "$(TEST_HC)" $(TEST_HC_OPTS_INTERACTIVE) T706
 
 .PHONY: T5584
 T5584:
        $(RM) -rf T5584_out
        mkdir T5584_out
 
 .PHONY: T5584
 T5584:
        $(RM) -rf T5584_out
        mkdir T5584_out
-       "$(TEST_HC)" -odir T5584_out -c T5584/A.hs-boot
+       "$(TEST_HC)" -odir T5584_out -c T5584_in/A.hs-boot
+
+.PHONY: T5198
+T5198:
+       $(RM) -rf T5198dump
+       [ ! -d T5198dump ]
+       "$(TEST_HC)" $(TEST_HC_OPTS) -c T5198.hs -dumpdir T5198dump -ddump-to-file -ddump-simpl
+       [ -f T5198dump/T5198.dump-simpl ]
+
+.PHONY: T7060a
+T7060a:
+       $(RM) -rf T7060dump
+       [ ! -d T7060dump ]
+       "$(TEST_HC)" $(TEST_HC_OPTS) -O -c T7060.hs -dumpdir T7060dump -ddump-to-file -ddump-rules
+       [ -f T7060dump/T7060.dump-rules ]
+
+.PHONY: T7060b
+T7060b:
+       $(RM) -rf T7060dump
+       [ ! -d T7060dump ]
+       "$(TEST_HC)" $(TEST_HC_OPTS) -O -c T7060.hs -dumpdir T7060dump -ddump-to-file -ddump-rule-firings
+       [ -f T7060dump/T7060.dump-rule-firings ]
+
+.PHONY: T7060c
+T7060c:
+       $(RM) -rf T7060dump
+       [ ! -d T7060dump ]
+       "$(TEST_HC)" $(TEST_HC_OPTS) -O -c T7060.hs -dumpdir T7060dump -ddump-to-file -ddump-rule-rewrites
+       [ -f T7060dump/T7060.dump-rule-rewrites ]
+
+.PHONY: T7060
+T7060: T7060a T7060b T7060c
+
+.PHONY: T7130
+T7130:
+       "$(TEST_HC)" $(TEST_HC_OPTS) -fflul-laziness
+
+.PHONY: T7563
+T7563:
+       -"$(TEST_HC)" $(TEST_HC_OPTS) -C T7563.hs
+
+# Below we set LC_ALL=C to request standard ASCII output in the resulting error
+# messages. Unfortunately, Mac OS X and Windows still use a Unicode encoding
+# even with LC_ALL=C, so we expect these tests to fail there.
+
+.PHONY: T6037
+T6037:
+       -LC_ALL=C "$(TEST_HC)" $(TEST_HC_OPTS) -c T6037.hs
+
+.PHONY: T2507
+T2507:
+       -LC_ALL=C "$(TEST_HC)" $(TEST_HC_OPTS) -c T2507.hs
+
+.PHONY: T8959a
+T8959a:
+       -LC_ALL=C "$(TEST_HC)" $(TEST_HC_OPTS) -c T8959a.hs -XUnicodeSyntax
+
+.PHONY: T703
+T703:
+       $(RM) -rf T703
+       [ ! -d T703 ]
+       "$(TEST_HC)" $(TEST_HC_OPTS) --make T703.hs -v0
+       ! readelf -W -l T703 2>/dev/null | grep 'GNU_STACK' | grep -q 'RWE'
+
+.PHONY: T2182
+T2182:
+       $(RM) T2182_A.hi T2182.hi
+       ! "$(TEST_HC)" $(TEST_HC_OPTS) --make T2182_A.hs T2182.hs -v0
+       ! "$(TEST_HC)" $(TEST_HC_OPTS) --make T2182.hs T2182_A.hs -v0
+
+.PHONY: write_interface_oneshot
+write_interface_oneshot:
+       $(RM) -rf write_interface_oneshot/A011.hi
+       "$(TEST_HC)" $(TEST_HC_OPTS) -hidir write_interface_oneshot_hidir -fno-code -fwrite-interface -c A011.hs
+       test -f write_interface_oneshot_hidir/A011.hi
+
+.PHONY: write_interface_make
+write_interface_make:
+       $(RM) -rf write_interface_make/A011.hi
+       "$(TEST_HC)" $(TEST_HC_OPTS) -hidir write_interface_make_hidir -fno-code -fwrite-interface --make A011.hs
+       test -f write_interface_make_hidir/A011.hi
+
+.PHONY: T9938
+T9938:
+       $(RM) -rf T9938.o T9938.hi T9938
+       "$(TEST_HC)" $(TEST_HC_OPTS) -O2 -c T9938.hs
+       "$(TEST_HC)" $(TEST_HC_OPTS) -O2 T9938.o -o T9938
+
+.PHONY: T9938B
+T9938B:
+       $(RM) -rf T9938B.o T9938B.hi T9938B
+       "$(TEST_HC)" $(TEST_HC_OPTS) -O2 -c T9938B.hs
+       "$(TEST_HC)" $(TEST_HC_OPTS) -O2 T9938B.o -o T9938B
+
+.PHONY: T10182
+T10182:
+       $(RM) -rf T10182.o T10182a.o T10182.o-boot T10182.hi T10182a.hi T10182.hi-boot
+       "$(TEST_HC)" $(TEST_HC_OPTS) -c T10182.hs-boot
+       "$(TEST_HC)" $(TEST_HC_OPTS) -c T10182a.hs
+       "$(TEST_HC)" $(TEST_HC_OPTS) -c T10182.hs
+
+.PHONY: T10320
+T10320:
+       $(RM) -rf T10320 T10320.dump-rule-rewrites T10320.hi T10320.o
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -ddump-to-file -ddump-rule-rewrites -fenable-rewrite-rules T10320.hs
+       [ -s T10320.dump-rule-rewrites ]
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v0 -fforce-recomp -ddump-to-file -ddump-rule-rewrites T10320.hs
+       [ -f T10320.dump-rule-rewrites ] && [ ! -s T10320.dump-rule-rewrites ]
+
+.PHONY: T12135
+T12135:
+       $(RM) -rf T12135.o T12135.hi T12135 T12135a T12135b
+       mkdir T12135a T12135b
+       cp T12135a.h T12135a/T12135.h
+       "$(TEST_HC)" $(TEST_HC_OPTS) -IT12135b -IT12135a --make T12135.hs
+       ./T12135
+       cp T12135b.h T12135b/T12135.h
+       "$(TEST_HC)" $(TEST_HC_OPTS) -IT12135b -IT12135a --make T12135.hs
+       ./T12135
+
+.PHONY: T10923
+T10923:
+       $(RM) -rf T10923.o T10923.hi
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O0 -c T10923.hs
+       # should NOT output "compilation is NOT required"
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O -c T10923.hs
+
+.PHONY: T13604
+T13604:
+       $(RM) -rf T13604.o T13604.hi
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O0 -c T13604.hs
+       # SHOULD output "compilation is NOT required"
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O -c -fignore-optim-changes T13604.hs
+
+.PHONY: T13604a
+T13604a:
+       $(RM) -rf T13604a.o T13604a.hi
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O0 -c -fhpc T13604a.hs
+       # SHOULD output "compilation is NOT required"
+       "$(TEST_HC)" $(TEST_HC_OPTS) -v1 -O0 -c -fignore-hpc-changes T13604a.hs
+
+.PHONY: T12955
+T12955:
+       ! "$(TEST_HC)" $(TEST_HC_OPTS) --make T12955
+       ! "$(TEST_HC)" $(TEST_HC_OPTS) --make T12955 -fbuilding-cabal-package
+
+.PHONY: T12971
+T12971:
+       mkdir -p ä
+       TMP=ä "$(TEST_HC)" $(TEST_HC_OPTS) --make T12971