878649f7282eb51ce5172b632c8f0403f9aa5ba8
[mono.git] / mcs / tests / makefile
1 #
2 # You can change "RUNTIME" to control what runtime to use
3 # ie, make vs make RUNTIME=mono
4
5 CSC=csc.exe
6
7 MCS=../mcs/mcs.exe
8 MCS2=mono ../mcs/mcs.exe
9 VERIFY=../tools/verifier.exe
10
11 ##
12 ## If you add any tests here, please do also add them to README.Tests !
13 ##
14
15 TEST_SOURCES = \
16         test-1   test-2   test-3   test-4   test-5   test-6   test-7   test-8   test-9   test-10 \
17         test-11  test-12  test-13  test-14           test-16  test-17  test-18  test-19  test-20 \
18         test-21  test-22  test-23  test-24  test-25  test-26  test-27  test-28  test-29  test-30 \
19         test-31  test-32  test-33  test-34  test-35  test-36  test-37  test-38  test-39  test-40 \
20         test-41  test-42  test-43  test-44           test-46  test-47  test-48  test-49  \
21         test-51  test-52           test-54  test-55  test-56  test-57           test-59  test-60 \
22         test-61  test-62  test-63  test-64  test-65  test-66           test-68  test-69  test-70 \
23         test-71  test-72  test-73  test-74  test-75  test-76  test-77  test-78  test-79  test-80 \
24         test-81  test-82  test-83  test-84  test-85  test-86  test-87  test-88  test-89  test-90 \
25                  test-92  test-93  test-94  test-95  test-96  test-97  test-98  test-99  test-100\
26         test-101 test-102 test-103 test-104 test-105                   test-108 test-109 test-110\
27         test-111 test-112 test-113 test-114 test-115 test-116 test-117 test-118 test-119 \
28         test-121          test-123          test-125 test-126 test-127 test-128 test-129 test-130 \
29         test-131                   test-134 test-135 test-136 test-137 test-138 test-139 test-140 \
30         test-141 test-142 test-143 test-144 test-145 test-146 test-147 test-148 test-149 test-150 \
31                           test-153 test-154 test-155 test-156 test-157 test-158 test-159 test-160 \
32         test-161 test-162 test-163 test-164 test-165 test-166 test-167 test-168 test-169 test-170 \
33                  test-172 test-173 test-174 test-175 test-176 test-177          test-179\
34         test-180 test-181 test-182 test-183 test-184 test-185 test-186 test-187 \
35         test-188 test-189 test-190 test-191 test-192 test-193
36
37
38 # NOTE: Slot test-178 is free, turns out it was an unsafe test.
39 #
40 #
41 UNSAFE_SOURCES = \
42         unsafe-1 unsafe-2 unsafe-3 test-58 test-171 unsafe-5 unsafe-6
43
44 WINDOWS_SOURCES = \
45         test-50 test-67
46
47 # A test is a 'no pass' if it fails on either windows or linux
48 # Test 120 does not pass because the MS.NET runtime is buggy.
49 TEST_NOPASS = \
50         test-45  test-53  test-91  test-106 test-107 test-120 test-122 test-132 test-133 test-66 test-177
51
52 all: 
53         if test x$(OS) = xWindows_NT; then make all-windows; else make all-linux; fi
54
55 all-windows: test-compiler test-unsafe test-windows
56
57 all-linux: test-compiler-mono test-unsafe-mono
58
59 # Compile with mono, run with MS jit
60 test-compiler:
61         @rm -f *.exe; \
62         for i in $(TEST_SOURCES); do \
63                 echo -n "Running $$i ... "; \
64                 if $(MCS) $$i.cs > /dev/null; then \
65                         if $(RUNTIME) ./$$i.exe > /dev/null; then \
66                                 echo $$i: ok; \
67                         else \
68                                 echo FAILED; \
69                         fi; \
70                 else \
71                         echo FAILED TO COMPILE; exit 1; \
72                 fi \
73         done
74
75 # Compile with mono, run with MS jit
76 test-unsafe:
77         @for i in $(UNSAFE_SOURCES); do \
78                 echo -n "Running (unsafe) $$i ... "; \
79                 if $(MCS) --unsafe $$i.cs > /dev/null; then \
80                         if $(RUNTIME) ./$$i.exe > /dev/null; then \
81                                 echo OK; \
82                         else \
83                                 echo FAILED; exit 1; \
84                         fi; \
85                 else \
86                         echo FAILED WHILE COMPILING; exit 1; \
87                 fi \
88         done
89
90 # Compiled (previously) with mono, run with mono jit
91 test-jit:
92         @for i in $(TEST_SOURCES:.cs=.exe); do \
93                 echo -n "Running jit $$i ... "; \
94                 if $(RUNTIME) ./$$i.exe > /dev/null; then \
95                         echo OK; \
96                 else \
97                         echo FAILED; \
98                 fi \
99         done
100
101 # Compiled with mono, run with MS jit
102 test-windows:
103         @echo Running windows-only tests - these will fail on linux; \
104         for i in $(WINDOWS_SOURCES); do \
105                 echo -n "Running $$i ... "; \
106                 if $(MCS) $$i.cs > /dev/null; then \
107                         if ./$$i.exe > /dev/null; then \
108                                 echo OK; \
109                         else \
110                                 echo FAILED; exit 1; \
111                         fi; \
112                 else \
113                         echo FAILED TO COMPILE; exit 1; \
114                 fi \
115         done
116
117 # Compile with mono, run with mono jit
118 test-compiler-mono:
119         @rm -f *.exe; \
120         for i in $(TEST_SOURCES); do \
121                 echo -n "Running $$i ... "; \
122                 if $(MCS2) $$i.cs > /dev/null; then \
123                         if mono ./$$i.exe > /dev/null; then \
124                                 echo OK; \
125                         else \
126                                 echo FAILED; exit 1; \
127                         fi; \
128                 else \
129                         echo FAILED TO COMPILE; exit 1; \
130                 fi \
131         done
132         echo "Running NO_PASS tests ..."
133         for i in $(TEST_NOPASS); do \
134                 echo -n "Running $$i ... "; \
135                 if $(MCS2) $$i.cs > /dev/null; then \
136                         echo OK; \
137                 else \
138                         echo FAILED TO COMPILE; exit 1; \
139                 fi \
140         done
141
142 # Compile with mono, run with mono jit
143 test-unsafe-mono:
144         @rm -f *.exe; \
145         for i in $(UNSAFE_SOURCES); do \
146                 echo -n "Running $$i ... "; \
147                 if $(MCS2) --unsafe $$i.cs > /dev/null; then \
148                         if mono ./$$i.exe > /dev/null; then \
149                                 echo OK; \
150                         else \
151                                 echo FAILED; exit 1; \
152                         fi; \
153                 else \
154                         echo FAILED TO COMPILE; exit 1; \
155                 fi \
156         done
157
158 verify:
159         @for i in $(TEST_SOURCES); do \
160                 if $(MCS) -o mcs-gen-code.exe $$i.cs > /dev/null; then \
161                         if $(CSC) /out:csc-gen-code.exe $$i.cs > /dev/null; then \
162                                 if $(VERIFY) mcs-gen-code.exe csc-gen-code.exe > /dev/null; then \
163                                         echo $$i: identical assemblies; \
164                                 else \
165                                         echo $$i: unidentical assemblies; exit; \
166                                 fi; \
167                         fi \
168                 fi \
169         done; \
170         echo Verification passed
171
172
173 casts.cs: gen-cast-test.cs
174         $(CSC) /out:csc-cast.exe gen-cast-test.cs
175         ./csc-cast > casts.cs
176
177 casts-csc.exe: casts.cs
178         $(CSC) /out:casts-csc.exe casts.cs
179
180 casts.exe: casts.cs
181         $(MCS) casts.cs
182
183 csc-casts.out: casts-csc.exe
184         ./casts-csc.exe > csc-casts.out
185
186 msc-casts.out: casts.exe
187         ./casts.exe > msc-casts.out
188
189 test-casts: csc-casts.out msc-casts.out
190         cmp csc-casts.out msc-casts.out
191
192 clean:
193         rm *.exe
194         rm *.out
195         rm casts.cs
196