Merge pull request #4998 from kumpera/fix_56684
[mono.git] / mono / tests / exiting / Makefile
1 check-local: test
2
3 mcs_topdir = ../../../../mcs
4 mono_build_root = ../../..
5 top_builddir = $(mono_build_root)
6 srcdir = .
7 TEST_PROG = ../../interpreter/mint
8 JITTEST_PROG = ../../mini/mono
9
10 TEST_PROG_RUN = MONO_PATH=$(mcs_topdir)/class/lib/default $(TEST_PROG)
11 JITTEST_PROG_RUN = MONO_PATH=$(mcs_topdir)/class/lib/default $(JITTEST_PROG)
12
13 RUNTIME_ARGS=--config tests-config --optimize=all
14
15 RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/default $(top_builddir)/runtime/mono-wrapper
16
17 CSC = $(RUNTIME) $(mcs_topdir)/class/lib/default/mcs.exe --unsafe -nowarn:0162
18 ILASM = $(RUNTIME) $(mcs_topdir)/ilasm/ilasm.exe
19
20 # notes on programs that fail:
21 # delegate-async-exception.cs returns 1 on mono, 0 on MS 1.1
22 # delegate-delegate-exception.cs returns 1 on mono, hangs on MS 1.1
23 # finalizer-exception.cs returns 42 on mono and MS 1.1: on MS prints stack trace
24 #
25 # changing to run in the main thread:
26 # delegate-async-exception.cs hangs
27 # delegate-delegate-exception.cs hangs
28 # finalizer-exception.cs same as above
29 # main-returns-abort-resetabort.exe crashes randomly
30 # main-returns.exe doesn't wait the threads
31
32 #       delegate-async-exception.cs     \
33 #       delegate-delegate-exception.cs  \
34
35 TEST_CS_SRC=                    \
36         appdomain.cs    \
37         delegate-async-exit.cs  \
38         delegate-delegate-exit.cs       \
39         delegate.cs     \
40         finalizer-abort.cs      \
41         finalizer-exception.cs  \
42         finalizer-exit.cs       \
43         main-exit.cs    \
44         main-returns-abort-resetabort.cs        \
45         main-returns-background-abort-resetabort.cs     \
46         main-returns-background-resetabort.cs   \
47         main-returns-background.cs      \
48         main-returns.cs \
49         subthread-exit.cs
50
51 DISABLED_TESTS=                 \
52         $(PLATFORM_DISABLED_TESTS)
53
54 TESTSI_CS=$(TEST_CS_SRC:.cs=.exe)
55
56 %.exe: %.cs 
57         $(CSC) -out:$@ $<
58
59 test:   testjit
60
61 test_cs: $(TEST_PROG) $(TESTSI_CS)
62         @failed=0; \
63         passed=0; \
64         export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
65         for i in $(TESTSI_CS); do       \
66                 if $(srcdir)/../test-driver '$(TEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
67                 then \
68                         passed=`expr $${passed} + 1`; \
69                 else \
70                         if [ $$? = 2 ]; then break; fi; \
71                         failed=`expr $${failed} + 1`; \
72                 fi \
73         done; \
74         echo; echo ".cs: $${passed} test(s) passed. $${failed} test(s) failed."; echo
75
76 testjit: $(TESTSI_CS)
77         @failed=0; \
78         passed=0; \
79         failed_tests="";\
80         for i in $(TESTSI_CS); do       \
81                 rm -f $${i}.so; \
82                 if $(srcdir)/../test-driver '$(JITTEST_PROG_RUN)' $$i '$(DISABLED_TESTS)' $(RUNTIME_ARGS); \
83                 then \
84                         passed=`expr $${passed} + 1`; \
85                 else \
86                         if [ $$? = 2 ]; then break; fi; \
87                         failed=`expr $${failed} + 1`; \
88                         failed_tests="$${failed_tests} $$i"; \
89                 fi \
90         done; \
91         echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
92         if [ $${failed} != 0 ]; then echo -e "\nFailed tests:\n"; \
93           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
94
95 testinterp: $(TESTSI_CS)
96         @failed=0; \
97         passed=0; \
98         failed_tests="";\
99         export LD_LIBRARY_PATH="`pwd`/.libs:$${LD_LIBRARY_PATH}"; \
100         for i in $(TESTSI_CS); do \
101                 if $(srcdir)/../test-driver '$(TEST_PROG_RUN)' $$i "$(DISABLED_TESTS)" $(RUNTIME_ARGS); \
102                 then \
103                         passed=`expr $${passed} + 1`; \
104                 else \
105                         if [ $$? = 2 ]; then break; fi; \
106                         failed=`expr $${failed} + 1`; \
107                         failed_tests="$${failed_tests} $$i"; \
108                 fi \
109         done; \
110         echo "$${passed} test(s) passed. $${failed} test(s) failed."; \
111         if [ $$failed != 0 ]; then echo -e "\nFailed tests:\n"; \
112           for i in $${failed_tests}; do echo $${i}; done; exit 1; fi
113
114 CLEANFILES = $(TESTSI_CS) $(TESTSI_IL) *.dll *.stdout *.exe stest.dat