2008-04-07 Marek Safar <marek.safar@gmail.com>
[mono.git] / mcs / tests / Makefile
1 #
2 # use `run-test'
3 #
4
5 thisdir = tests
6 SUBDIRS =
7 include ../build/rules.make
8
9 DISTFILES = README.tests
10 DISTFILES += $(wildcard *.cs) $(wildcard *.il) $(wildcard *.xml) $(wildcard *.inc) $(wildcard known-issues-*) $(wildcard *.snk)
11
12 with_mono_path = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH"
13
14 ifeq (default, $(PROFILE))
15 # force this, we don't case if CSC is broken. This also
16 # means we can use --options, yay.
17 MCS = $(with_mono_path) $(INTERNAL_MCS)
18 endif
19 ilasm = $(topdir)/class/lib/net_1_1_bootstrap/ilasm.exe
20 ILASM = MONO_PATH="$(topdir)/class/lib/net_1_1_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(ilasm)
21
22 ifeq (net_2_0, $(PROFILE))
23 BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/net_2_0_bootstrap$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/net_2_0_bootstrap/mcs.exe
24 endif
25
26 USE_MCS_FLAGS :=
27
28 # mention all targets
29 all-local $(STD_TARGETS:=-local):
30
31 VALID_PROFILE := $(filter default net_2_0 net_2_1, $(PROFILE))
32 ifdef VALID_PROFILE
33 # casts
34 bootstrap-cast.exe: gen-cast-test.cs
35         $(BOOT_COMPILE) -target:exe /out:$@ $<
36
37 casts.cs: bootstrap-cast.exe
38         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
39
40 casts-mcs.exe: casts.cs
41         $(CSCOMPILE) -target:exe /out:$@ $<
42
43 casts-boot.exe: casts.cs
44         $(BOOT_COMPILE) -target:exe /out:$@ $<
45
46 boot-casts.out: casts-boot.exe
47         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
48
49 mcs-casts.out: casts-mcs.exe
50         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
51
52 test-casts: boot-casts.out mcs-casts.out
53         cmp $^
54
55 test-local: casts-boot.exe
56
57 ifeq (net_2_1, $(PROFILE))
58 COMPILER_NAME = smcs
59 TEST_PATTERN = '*test-*.cs'
60 LOCAL_RUNTIME_FLAGS = --security=temporary-smcs-hack
61 endif
62 ifeq (net_2_0, $(PROFILE))
63 COMPILER_NAME = gmcs
64 TEST_PATTERN = '*test-*.cs'
65 TOPTIONS += '-il:ver-il-gmcs.xml'
66 endif
67 ifeq (default, $(PROFILE))
68 COMPILER_NAME = mcs
69 TEST_PATTERN = 'test-*.cs'
70 endif
71
72 COMPILER = $(topdir)/class/lib/$(PROFILE)/$(COMPILER_NAME).exe
73 TESTER = MONO_RUNTIME='$(RUNTIME)' $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(LOCAL_RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/compiler-tester.exe
74
75 TEST_ILS := $(wildcard *-lib.il)
76
77 check: run-test
78
79 run-test-local: $(TEST_ILS:.il=.dll)
80         $(TESTER) -mode:pos -files:$(TEST_PATTERN) -compiler:$(COMPILER) -issues:known-issues-$(COMPILER_NAME) -log:$(COMPILER_NAME).log $(TOPTIONS)
81
82 test-everything:
83         $(MAKE) PROFILE=default run-test
84         $(MAKE) PROFILE=net_2_0 run-test
85
86 test-generics:
87         $(MAKE) PROFILE=net_2_0 run-test
88
89 clean-local:
90         -rm -fr dir-*
91         -rm -f *.exe *.dll *.netmodule *.out *.pdb *.mdb casts.cs *.log
92         -rm -f xml-*.xml
93
94 dist-local: dist-default
95         rm -f $(distdir)/casts.cs
96
97 %-il.dll: %-il.il
98         $(ILASM) /dll $<
99
100 %-lib.dll: %-lib.il
101         $(ILASM) /dll /out:$@ $<
102
103 ifeq (default, $(PROFILE))
104 run-test-local: ilasm
105 ilasm:
106         $(ILASM) /dll property-il.il
107         $(CSCOMPILE) /r:property-il.dll property-main.cs /out:property-main.exe
108         $(TEST_RUNTIME) property-main.exe
109 endif
110
111 endif