2005-06-09 Lluis Sanchez Gual <lluis@novell.com>
[mono.git] / mono / tests / Makefile.am
index 5e001c79c2205185229a48f920578f9914759554..7b3f5b4e54c009d3b5c4a405f3ab20ce46d13999 100644 (file)
@@ -1,12 +1,29 @@
+check-local: test
+
+TEST_PROG = ../interpreter/mint
+JITTEST_PROG = ../mini/mono
+
+TEST_PROG_RUN = MONO_PATH=$(mcs_topdir)/class/lib/default MONO_SHARED_DIR=$(mono_build_root)/runtime $(LIBTOOL) --mode=execute $(TEST_PROG)
+JITTEST_PROG_RUN = MONO_PATH=$(mcs_topdir)/class/lib/default MONO_SHARED_DIR=$(mono_build_root)/runtime $(LIBTOOL) --mode=execute $(JITTEST_PROG)
 
-TEST_PROG=../interpreter/mint
-JITTEST_PROG=../mini/mono
 RUNTIME_ARGS=--config tests-config --optimize=all
-#CSC=csc /unsafe
-CSC=mcs --unsafe -nowarn:0162
+
+RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/default $(top_builddir)/runtime/mono-wrapper
+
+CSC = $(RUNTIME) $(mcs_topdir)/class/lib/default/mcs.exe -unsafe -nowarn:0162 -nowarn:0168 -nowarn:0219
+ILASM = $(RUNTIME) $(mcs_topdir)/ilasm/ilasm.exe
 
 BENCHSRC=fib.cs random.cs nested-loops.cs ackermann.cs tight-loop.cs sieve.cs
 
+STRESS_TESTS_SRC=      \
+       abort-stress-1.cs       \
+       abort-stress-2.cs       \
+       domain-stress.cs        \
+       gchandle-stress.cs      \
+       monitor-stress.cs       \
+       thread-stress.cs        \
+       gc-stress.cs
+
 TEST_CS_SRC=                   \
        array-init.cs           \
        arraylist.cs            \
@@ -41,22 +58,20 @@ TEST_CS_SRC=                        \
        exception16.cs          \
        struct.cs               \
        valuetype-gettype.cs    \
+       typeof-ptr.cs           \
        static-constructor.cs   \
        pinvoke.cs              \
        pinvoke1.cs             \
        pinvoke2.cs             \
        pinvoke3.cs             \
-       pinvoke9.cs             \
-       pinvoke10.cs            \
        pinvoke11.cs            \
        pinvoke13.cs            \
-       pinvoke14.cs            \
-       pinvoke15.cs            \
-       pinvoke16.cs            \
        pinvoke17.cs            \
        pinvoke18.cs            \
        invoke.cs               \
        invoke2.cs              \
+       runtime-invoke.cs               \
+       invoke-string-ctors.cs          \
        reinit.cs               \
        box.cs                  \
        array.cs                \
@@ -84,6 +99,7 @@ TEST_CS_SRC=                  \
        reflection-prop.cs      \
        reflection4.cs          \
        reflection5.cs          \
+       reflection-const-field.cs \
        many-locals.cs          \
        string-compare.cs       \
        test-prime.cs           \
@@ -114,16 +130,16 @@ TEST_CS_SRC=                      \
        appdomain3.cs           \
        appdomain-client.cs     \
        appdomain-unload.cs \
+       loader.cs       \
        pointer.cs              \
-       rounding.cs             \
        hashcode.cs             \
        delegate1.cs            \
        delegate2.cs            \
        delegate3.cs            \
-       delegate4.cs            \
        delegate5.cs            \
        delegate6.cs            \
        delegate7.cs            \
+       delegate8.cs            \
        remoting1.cs            \
        remoting2.cs            \
        remoting3.cs            \
@@ -139,6 +155,7 @@ TEST_CS_SRC=                        \
        array-invoke.cs         \
        decimal.cs              \
        decimal-array.cs        \
+       marshal.cs              \
        marshal1.cs             \
        marshal2.cs             \
        marshal3.cs             \
@@ -147,11 +164,12 @@ TEST_CS_SRC=                      \
        marshal7.cs             \
        marshal8.cs             \
        marshal9.cs             \
-       marshal10.cs            \
+       test-byval-in-struct.cs \
        thread.cs               \
        thread5.cs              \
        thread6.cs              \
        thread-static.cs        \
+       thread-static-init.cs   \
        context-static.cs       \
        float-pop.cs            \
        interfacecast.cs        \
@@ -167,16 +185,39 @@ TEST_CS_SRC=                      \
        bug-47295.cs            \
        bug-46781.cs            \
        bug-48015.cs            \
-       bug-42136.cs
+       bug-42136.cs            \
+       interlocked.cs          \
+       cross-domain.cs         \
+       appdomain-exit.cs       \
+       delegate-async-exit.cs  \
+       delegate-delegate-exit.cs       \
+       delegate-exit.cs        \
+       finalizer-abort.cs      \
+       finalizer-exception.cs  \
+       finalizer-exit.cs       \
+       main-exit.cs    \
+       main-returns-abort-resetabort.cs        \
+       main-returns-background-abort-resetabort.cs     \
+       main-returns-background-resetabort.cs   \
+       main-returns-background.cs      \
+       main-returns-background-change.cs       \
+       main-returns.cs \
+       subthread-exit.cs       \
+       desweak.cs
 
 if X86
-PLATFORM_DISABLED_TESTS=thread6.exe
+# bug #71274
+PLATFORM_DISABLED_TESTS=finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
+endif
+
+if AMD64
+# bug #71273
+PLATFORM_DISABLED_TESTS=appdomain-unload.exe
 endif
 
 DISABLED_TESTS=                        \
-       remoting2.exe           \
-       remoting3.exe           \
-       appdomain-unload.exe    \
+       delegate-async-exception.cs     \
+       delegate-delegate-exception.cs  \
        $(PLATFORM_DISABLED_TESTS)
 
 # These only compile with MS CSC
@@ -193,17 +234,19 @@ TEST_IL_SRC=                      \
        qt-instance.il          \
        vararg.il                       \
        bug-29859.il            \
+       static-fields-nonconst.il       \
        even-odd.il
 
 
 TESTSI_CS=$(TEST_CS_SRC:.cs=.exe)
 TESTSI_IL=$(TEST_IL_SRC:.il=.exe)
 TESTBS=$(BENCHSRC:.cs=.exe)
+STRESS_TESTS=$(STRESS_TESTS_SRC:.cs=.exe)
 
-EXTRA_DIST=test-driver $(TEST_CS_SRC) $(TEST_IL_SRC)
+EXTRA_DIST=test-driver $(TEST_CS_SRC) $(TEST_IL_SRC) $(BENCHSRC) $(STRESS_TESTS_SRC) stress-runner.pl
 
 %.exe: %.il
-       ilasm -out:$@ $<
+       $(ILASM) -out:$@ $<
 
 %.exe: %.cs TestDriver.dll
        $(CSC) -r:TestDriver.dll -out:$@ $<
@@ -211,14 +254,14 @@ EXTRA_DIST=test-driver $(TEST_CS_SRC) $(TEST_IL_SRC)
 test:  testjit
 
 TestDriver.dll:
-       $(CSC) -target:library -o $@ $(srcdir)/../mini/TestDriver.cs
+       $(CSC) -target:library -out:$@ $(srcdir)/../mini/TestDriver.cs
 
 test_cs: $(TEST_PROG) $(TESTSI_CS) libtest.la
        @failed=0; \
        passed=0; \
        export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
        for i in $(TESTSI_CS); do       \
-               if $(srcdir)/test-driver $(TEST_PROG) $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -233,7 +276,7 @@ test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
        passed=0; \
        export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
        for i in $(TESTSI_IL); do       \
-               if $(srcdir)/test-driver $(TEST_PROG) $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -245,17 +288,16 @@ test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
 
 testb: $(TEST_PROG) $(TESTBS)
        for i in $(TESTBS); do  \
-               $(srcdir)/test-driver $(TEST_PROG) $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS);     \
+               $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS);       \
        done
 
 testjit: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la
        @failed=0; \
        passed=0; \
        failed_tests="";\
-       export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
        for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do        \
                rm -f $${i}.so; \
-               if $(srcdir)/test-driver $(JITTEST_PROG) $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(JITTEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -265,7 +307,8 @@ testjit: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la
                fi \
        done; \
        echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
-       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; for i in $${failed_tests}; do echo $${i}; done; fi; 
+       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
+         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
 
 testaot: $(TESTSI_CS) $(TESTBS) libtest.la
        @failed=0; \
@@ -275,7 +318,7 @@ testaot: $(TESTSI_CS) $(TESTBS) libtest.la
        for i in $(TESTSI_CS) $(TESTBS); do     \
                rm -f $${i}.so; \
                $(JITTEST_PROG) --aot $${i} > /dev/null; \
-               if $(srcdir)/test-driver $(JITTEST_PROG) $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(JITTEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -285,7 +328,11 @@ testaot: $(TESTSI_CS) $(TESTBS) libtest.la
                fi \
        done; \
        echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
-       if [ $$failed != 0 ]; then echo -e "\nFailed tests:\n"; for i in $${failed_tests}; do echo $${i}; done; fi; 
+       if [ $$failed != 0 ]; then echo -e "\nFailed tests:\n"; \
+         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
+
+testtrace:
+       $(MAKE) RUNTIME_ARGS="$${RUNTIME_ARGS} --trace" testjit
 
 testinterp: $(TESTSI_CS) $(TESTSI_IL) libtest.la
        @failed=0; \
@@ -293,7 +340,7 @@ testinterp: $(TESTSI_CS) $(TESTSI_IL) libtest.la
        failed_tests="";\
        export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
        for i in $(TESTSI_CS) $(TESTSI_IL); do \
-               if $(srcdir)/test-driver $(TEST_PROG) $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -303,7 +350,8 @@ testinterp: $(TESTSI_CS) $(TESTSI_IL) libtest.la
                fi \
        done; \
        echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
-       if [ $$failed != 0 ]; then echo -e "\nFailed tests:\n"; for i in $${failed_tests}; do echo $${i}; done; fi ;
+       if [ $$failed != 0 ]; then echo -e "\nFailed tests:\n"; \
+         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
 
 testjitspeed: $(JITTEST_PROG) $(TESTBS)
        for i in $(TESTBS); do  \
@@ -311,15 +359,36 @@ testjitspeed: $(JITTEST_PROG) $(TESTBS)
                time $(JITTEST_PROG) $$i;       \
        done
 
-check:
-       @echo no check yet
+stresstest: $(STRESS_TESTS)
+       @failed=0; \
+       passed=0; \
+       failed_tests="";\
+       for i in $(STRESS_TESTS); do    \
+               if $(srcdir)/stress-runner.pl $$i ../mini/mono $(RUNTIME_ARGS); \
+               then \
+                       passed=`expr $${passed} + 1`; \
+               else \
+                       if [ $$? = 2 ]; then break; fi; \
+                       failed=`expr $${failed} + 1`; \
+                       failed_tests="$${failed_tests} $$i"; \
+               fi \
+       done; \
+       echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
+       if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
+         for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
 
 noinst_LTLIBRARIES = libtest.la
 
 INCLUDES = $(GLIB_CFLAGS)
 
+if PLATFORM_WIN32
+# the exported names created by gcc for stdcall functions are missing the leading _, so MS.NET
+# can't find them. So we use --kill-at to remove the @ suffix as well.
+libtest_la_LDFLAGS=-no-undefined -rpath `pwd` -Wl,--kill-at
+else
 libtest_la_LDFLAGS = -rpath `pwd`
+endif
 libtest_la_SOURCES = libtest.c
+libtest_la_LIBADD = $(GLIB_LIBS)
 
-CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) TestDriver.dll
-
+CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) $(STRESS_TESTS) *.dll *.stdout *.exe stest.dat