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