2002-07-23 Martin Baulig <martin@gnome.org>
[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 TEST_SOURCES = \
12         test-1   test-2   test-3   test-4   test-5   test-6   test-7   test-8   test-9   test-10 \
13         test-11  test-12  test-13  test-14  test-15  test-16  test-17  test-18  test-19  test-20 \
14         test-21  test-22  test-23  test-24  test-25  test-26  test-27  test-28  test-29  test-30 \
15         test-31  test-32  test-33  test-34  test-35  test-36  test-37  test-38  test-39  test-40 \
16         test-41  test-42  test-43  test-44           test-46  test-47  test-48  test-49  \
17         test-51  test-52           test-54  test-55  test-56  test-57           test-59  test-60 \
18         test-61  test-62  test-63  test-64  test-65  test-66           test-68  test-69  test-70 \
19         test-71  test-72  test-73  test-74  test-75  test-76  test-77  test-78  test-79  test-80 \
20         test-81  test-82  test-83  test-84  test-85  test-86  test-87  test-88  test-89  test-90 \
21                  test-92  test-93  test-94  test-95  test-96  test-97  test-98  test-99  test-100\
22         test-101 test-102 test-103 test-104 test-105                   test-108 test-109 test-110\
23         test-111 test-112 test-113 test-114 test-115 test-116 test-117 test-118 test-119 \
24         test-121          test-123          test-125 test-126 test-127 test-128 test-129 test-130 \
25         test-131                   test-134 test-135 test-136 test-137 test-138 test-139 test-140 \
26         test-141 test-142 test-143 test-144 test-145 test-146 test-147 test-148
27
28 UNSAFE_SOURCES = \
29         unsafe-1 unsafe-2 unsafe-3 test-58.cs
30
31 WINDOWS_SOURCES = \
32         test-50 test-67
33
34 # A test is a 'no pass' if it fails on either windows or linux
35 # Test 120 does not pass because the MS.NET runtime is buggy.
36 TEST_NOPASS = \
37         test-45  test-53  test-91  test-106 test-107 test-120 test-122 test-132 test-133
38
39 all: test-compiler test-unsafe test-windows
40
41
42 # Compile with mono, run with MS jit
43 test-compiler:
44         @rm -f *.exe; \
45         for i in $(TEST_SOURCES); do \
46                 echo -n "Running $$i ... "; \
47                 if $(MCS) $$i.cs > /dev/null; then \
48                         if $(RUNTIME) ./$$i.exe > /dev/null; then \
49                                 echo $$i: ok; \
50                         else \
51                                 echo FAILED; exit 1; \
52                         fi; \
53                 else \
54                         echo FAILED TO COMPILE; exit 1; \
55                 fi \
56         done
57
58 # Compile with mono, run with MS jit
59 test-unsafe:
60         @for i in $(UNSAFE_SOURCES); do \
61                 echo -n "Running (unsafe) $$i ... "; \
62                 if $(MCS) --unsafe $$i.cs > /dev/null; then \
63                         if $(RUNTIME) ./$$i.exe > /dev/null; then \
64                                 echo OK; \
65                         else \
66                                 echo FAILED; exit 1; \
67                         fi; \
68                 else \
69                         echo FAILED WHILE COMPILING; exit 1; \
70                 fi \
71         done
72
73 # Compiled (previously) with mono, run with mono jit
74 test-jit:
75         @for i in $(TEST_SOURCES:.cs=.exe); do \
76                 echo -n "Running jit $$i ... "; \
77                 if mono ./$$i.exe > /dev/null; then \
78                         echo OK; \
79                 else \
80                         echo FAILED; exit 1; \
81                 fi \
82         done
83
84 # Compiled with mono, run with MS jit
85 test-windows:
86         @echo Running windows-only tests - these will fail on linux; \
87         for i in $(WINDOWS_SOURCES); do \
88                 echo -n "Running $$i ... "; \
89                 if $(MCS) $$i.cs > /dev/null; then \
90                         if ./$$i.exe > /dev/null; then \
91                                 echo OK; \
92                         else \
93                                 echo FAILED; exit 1; \
94                         fi; \
95                 else \
96                         echo FAILED TO COMPILE; exit 1; \
97                 fi \
98         done
99
100 # Compile with mono, run with mono jit
101 test-compiler-mono:
102         @rm -f *.exe; \
103         for i in $(TEST_SOURCES); do \
104                 echo -n "Running $$i ... "; \
105                 if $(MCS2) $$i.cs > /dev/null; then \
106                         if mono ./$$i.exe > /dev/null; then \
107                                 echo OK; \
108                         else \
109                                 echo FAILED; exit 1; \
110                         fi; \
111                 else \
112                         echo FAILED TO COMPILE; exit 1; \
113                 fi \
114         done
115         echo "Running NO_PASS tests ..."
116         for i in $(TEST_NOPASS); do \
117                 echo -n "Running $$i ... "; \
118                 if $(MCS2) $$i.cs > /dev/null; then \
119                         echo OK; \
120                 else \
121                         echo FAILED TO COMPILE; exit 1; \
122                 fi \
123         done
124
125 verify:
126         @for i in $(TEST_SOURCES); do \
127                 if $(MCS) -o mcs-gen-code.exe $$i.cs > /dev/null; then \
128                         if $(CSC) /out:csc-gen-code.exe $$i.cs > /dev/null; then \
129                                 if $(VERIFY) mcs-gen-code.exe csc-gen-code.exe > /dev/null; then \
130                                         echo $$i: identical assemblies; \
131                                 else \
132                                         echo $$i: unidentical assemblies; exit; \
133                                 fi; \
134                         fi \
135                 fi \
136         done; \
137         echo Verification passed
138
139
140 casts.cs: gen-cast-test.cs
141         $(CSC) /out:csc-cast.exe gen-cast-test.cs
142         ./csc-cast > casts.cs
143
144 casts-csc.exe: casts.cs
145         $(CSC) /out:casts-csc.exe casts.cs
146
147 casts.exe: casts.cs
148         $(MCS) casts.cs
149
150 csc-casts.out: casts-csc.exe
151         ./casts-csc.exe > csc-casts.out
152
153 msc-casts.out: casts.exe
154         ./casts.exe > msc-casts.out
155
156 test-casts: csc-casts.out msc-casts.out
157         cmp csc-casts.out msc-casts.out
158
159 clean:
160         rm *.exe
161         rm *.out
162         rm casts.cs
163