2005-06-09 Lluis Sanchez Gual <lluis@novell.com>
[mono.git] / mono / tests / Makefile.am
index 432ee1fe076b2430dc188731a2791b1d3da12cf1..7b3f5b4e54c009d3b5c4a405f3ab20ce46d13999 100644 (file)
@@ -1,13 +1,29 @@
+check-local: test
 
-TEST_PROG=../interpreter/mint
-JITTEST_PROG=../mini/mono
-RUNTIME_ARGS=--config tests-config
+TEST_PROG = ../interpreter/mint
+JITTEST_PROG = ../mini/mono
 
-#CSC=csc /unsafe
-CSC=mcs --unsafe -nowarn:0162
+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)
+
+RUNTIME_ARGS=--config tests-config --optimize=all
+
+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            \
@@ -42,27 +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             \
-       pinvoke4.cs             \
-       pinvoke5.cs             \
-       pinvoke6.cs             \
-       pinvoke7.cs             \
-       pinvoke8.cs             \
-       pinvoke9.cs             \
-       pinvoke10.cs            \
        pinvoke11.cs            \
-       pinvoke12.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                \
@@ -90,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           \
@@ -119,16 +129,17 @@ TEST_CS_SRC=                      \
        appdomain2.cs           \
        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            \
@@ -144,67 +155,117 @@ TEST_CS_SRC=                     \
        array-invoke.cs         \
        decimal.cs              \
        decimal-array.cs        \
+       marshal.cs              \
        marshal1.cs             \
        marshal2.cs             \
        marshal3.cs             \
-       marshal4.cs             \
        marshal5.cs             \
        marshal6.cs             \
        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        \
        array3.cs               \
        classinit.cs            \
        classinit2.cs           \
        synchronized.cs         \
-       vararg.cs               \
        async_read.cs           \
        threadpool.cs           \
-       threadpool1.cs
+       threadpool1.cs          \
+       base-definition.cs      \
+       bug-27420.cs            \
+       bug-47295.cs            \
+       bug-46781.cs            \
+       bug-48015.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
+# 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=                        \
+       delegate-async-exception.cs     \
+       delegate-delegate-exception.cs  \
+       $(PLATFORM_DISABLED_TESTS)
 
+# These only compile with MS CSC
+TEST_CSC_SRC=                  \
+       vararg.cs
 
 TEST_IL_SRC=                   \
        cpblkTest.il            \
-       jmpTest.il              \
+       jmpTest.il                      \
        calliTest.il            \
        ckfiniteTest.il         \
        locallocTest.il         \
        initblkTest.il          \
-       even-odd.il             \
        qt-instance.il          \
-       bug-29859.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 $< /OUTPUT=$@
+       $(ILASM) -out:$@ $<
 
-%.exe: %.cs
-       $(CSC) $<
+%.exe: %.cs TestDriver.dll
+       $(CSC) -r:TestDriver.dll -out:$@ $<
 
 test:  testjit
 
+TestDriver.dll:
+       $(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 ./test-driver $(TEST_PROG) $$i $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
+                       if [ $$? = 2 ]; then break; fi; \
                        failed=`expr $${failed} + 1`; \
                fi \
        done; \
@@ -215,10 +276,11 @@ 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 ./test-driver $(TEST_PROG) $$i $(RUNTIME_ARGS); \
+               if $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
+                       if [ $$? = 2 ]; then break; fi; \
                        failed=`expr $${failed} + 1`; \
                fi \
        done; \
@@ -226,16 +288,37 @@ test_il: $(TEST_PROG) $(TESTSI_IL) libtest.la
 
 testb: $(TEST_PROG) $(TESTBS)
        for i in $(TESTBS); do  \
-               ./test-driver $(TEST_PROG) $$i $(RUNTIME_ARGS); \
+               $(srcdir)/test-driver '$(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS);       \
        done
 
-testjit: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS)
+testjit: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la
+       @failed=0; \
+       passed=0; \
+       failed_tests="";\
+       for i in $(TESTSI_CS) $(TESTBS) $(TESTSI_IL); do        \
+               rm -f $${i}.so; \
+               if $(srcdir)/test-driver '$(JITTEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(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
+
+testaot: $(TESTSI_CS) $(TESTBS) libtest.la
        @failed=0; \
        passed=0; \
        failed_tests="";\
        export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
-       for i in $(TESTSI_CS) $(TESTSI_IL) $(TESTBS); do        \
-               if ./test-driver $(JITTEST_PROG) $$i $(RUNTIME_ARGS); \
+       for i in $(TESTSI_CS) $(TESTBS); do     \
+               rm -f $${i}.so; \
+               $(JITTEST_PROG) --aot $${i} > /dev/null; \
+               if $(srcdir)/test-driver '$(JITTEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
                then \
                        passed=`expr $${passed} + 1`; \
                else \
@@ -245,7 +328,30 @@ testjit: $(TESTSI_CS) $(TESTSI_IL) $(TESTBS)
                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; \
+       passed=0; \
+       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_RUN)' $$i "$(DISABLED_TESTS)" $(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
 
 testjitspeed: $(JITTEST_PROG) $(TESTBS)
        for i in $(TESTBS); do  \
@@ -253,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)
-
+CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) $(STRESS_TESTS) *.dll *.stdout *.exe stest.dat