2010-03-12 Jb Evain <jbevain@novell.com>
[mono.git] / mcs / tests / Makefile
1 #
2 # use make run-test PROFILE=net_2_0
3 #
4
5 thisdir = tests
6 SUBDIRS =
7 include ../build/rules.make
8
9 DISTFILES = README.tests $(wildcard dlls/**/*.cs)
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 ilasm = $(topdir)/class/lib/$(PROFILE)/ilasm.exe
15 ILASM = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(ilasm)
16
17 USE_MCS_FLAGS :=
18
19 # mention all targets
20 all-local $(STD_TARGETS:=-local):
21
22 VALID_PROFILE := $(filter net_2_0 net_2_1 net_4_0, $(PROFILE))
23 ifdef VALID_PROFILE
24 # casts
25 bootstrap-cast.exe: gen-cast-test.cs
26         $(BOOT_COMPILE) -target:exe /out:$@ $<
27
28 casts.cs: bootstrap-cast.exe
29         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
30
31 casts-mcs.exe: casts.cs
32         $(CSCOMPILE) -target:exe /out:$@ $<
33
34 casts-boot.exe: casts.cs
35         $(BOOT_COMPILE) -target:exe /out:$@ $<
36
37 boot-casts.out: casts-boot.exe
38         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
39
40 mcs-casts.out: casts-mcs.exe
41         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) $< >$@
42
43 test-casts: boot-casts.out mcs-casts.out
44         cmp $^
45         -rm -f bootstrap-cast.exe casts.cs casts-boot.exe casts-mcs.exe boot-casts.out mcs-casts.out
46
47 eval.exe: eval-tests.cs
48
49 ifeq (net_4_0, $(PROFILE))
50 COMPILER_NAME = dmcs
51 TEST_PATTERN = 'v4'
52 LOCAL_RUNTIME_FLAGS = --verify-all
53 #TOPTIONS += '-il:ver-il-dmcs.xml'
54 endif
55 ifeq (net_2_1, $(PROFILE))
56 COMPILER_NAME = smcs
57 TEST_PATTERN = 'v2'
58 LOCAL_RUNTIME_FLAGS = --security=temporary-smcs-hack
59 endif
60 ifeq (net_2_0, $(PROFILE))
61 COMPILER_NAME = gmcs
62 TEST_PATTERN = 'v2'
63 LOCAL_RUNTIME_FLAGS = --verify-all
64 TOPTIONS += '-il:ver-il-gmcs.xml'
65 endif
66
67 COMPILER = $(topdir)/class/lib/$(PROFILE)/$(COMPILER_NAME).exe
68 TESTER = MONO_RUNTIME='$(RUNTIME)' $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(LOCAL_RUNTIME_FLAGS) $(topdir)/class/lib/$(PROFILE)/compiler-tester.exe
69
70 TEST_ILS := $(wildcard *-lib.il)
71
72 eval-test: 
73         $(CSCOMPILE) eval-test.cs -r:Mono.CSharp.dll
74         $(with_mono_path) $(RUNTIME) $(RUNTIME_FLAGS) eval-test.exe
75         
76 build-compiler-lib:
77         cd ../class/Mono.CSharp && $(MAKE) NO_DIR_CHECK=yes
78
79 check: build-compiler-lib eval-test
80         $(TESTER) -mode:pos -files:$(TEST_PATTERN) -compiler:$(COMPILER) -issues:known-issues-$(COMPILER_NAME) -log:$(COMPILER_NAME).log $(TOPTIONS)
81
82 test-local:
83         @:
84
85 run-test-local: $(TEST_ILS:.il=.dll) setup check
86
87 # Temporary testing targets
88 cecil:
89         rm -f *.mdb
90         $(TESTER) -mode:pos -files:'test-*.cs' -compiler:gmcs.exe -issues:known-issues-$(COMPILER_NAME) -log:$(COMPILER_NAME).log -verbose
91
92 cecil2:
93         rm -f *.mdb
94         $(TESTER) -mode:pos -files:'*test-*.cs' -compiler:gmcs.exe -issues:known-issues-$(COMPILER_NAME) -log:$(COMPILER_NAME).log -verbose
95 # End   
96
97 endif
98
99 clean-local:
100         -rm -fr dir-*
101         -rm -f *.exe *.dll *.netmodule *.out *.pdb *.mdb casts.cs *.log
102         -rm -f xml-*.xml
103
104 dist-local: dist-default
105         rm -f $(distdir)/casts.cs
106
107 csproj-local:
108
109 %-il.dll: %-il.il
110         $(ILASM) /dll $<
111
112 %-lib.dll: %-lib.il
113         $(ILASM) /dll /out:$@ $<
114         
115 setup:
116         $(ILASM) /dll property-il.il
117         $(CSCOMPILE) /r:property-il.dll property-main.cs /out:property-main.exe
118         $(TEST_RUNTIME) property-main.exe
119
120         $(CSCOMPILE) -t:library dlls/test-679-2/test-679-lib-2.cs
121         $(CSCOMPILE) -t:library dlls/test-679-1/test-679-lib.cs -r:dlls/test-679-2/test-679-lib-2.dll