Mercurial > projects > ldc
annotate tests/runminitest.d @ 1650:40bd4a0d4870
Update to work with LLVM 2.7.
Removed use of dyn_cast, llvm no compiles
without exceptions and rtti by
default. We do need exceptions for the libconfig stuff, but rtti isn't
necessary (anymore).
Debug info needs to be rewritten, as in LLVM 2.7 the format has
completely changed. To have something to look at while rewriting, the
old code has been wrapped inside #ifndef DISABLE_DEBUG_INFO , this means
that you have to define this to compile at the moment.
Updated tango 0.99.9 patch to include updated EH runtime code, which is
needed for LLVM 2.7 as well.
author | Tomas Lindquist Olsen |
---|---|
date | Wed, 19 May 2010 12:42:32 +0200 |
parents | 9081d916df1d |
children |
rev | line source |
---|---|
341
1bb99290e03a
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
lindquist
parents:
100
diff
changeset
|
1 module runminitest; |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
2 |
1198 | 3 import tango.io.FileSystem, |
4 tango.io.Stdout, | |
5 tango.io.vfs.FileFolder; | |
6 import Path = tango.io.Path; | |
7 import Util = tango.text.Util; | |
8 import tango.text.convert.Format; | |
9 import tango.stdc.stdlib, | |
10 tango.stdc.stringz; | |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
11 |
1198 | 12 int main(char[][] args) |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
13 { |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
14 enum : int |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
15 { |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
16 COMPILE, |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
17 NOCOMPILE, |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
18 RUN, |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
19 NORUN |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
20 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
21 |
1198 | 22 char[][] compilefailed; |
23 char[][] nocompilefailed; | |
24 char[][] runfailed; | |
25 char[][] norunfailed; | |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
26 |
1198 | 27 FileSystem.setDirectory("mini"); |
418
94c4e090c1af
clean out obj dir before running mini test.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
415
diff
changeset
|
28 |
1198 | 29 if (!Path.exists("obj")) |
30 Path.createFolder("obj"); | |
38
27b2f40bdb58
[svn r42] Disabled the extensive logging by default. Use the -vv flag to get it back.
lindquist
parents:
14
diff
changeset
|
31 |
1198 | 32 foreach(f; Path.children("./obj")) |
418
94c4e090c1af
clean out obj dir before running mini test.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
415
diff
changeset
|
33 { |
1198 | 34 Path.remove(f.path ~ f.name); |
418
94c4e090c1af
clean out obj dir before running mini test.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
415
diff
changeset
|
35 } |
94c4e090c1af
clean out obj dir before running mini test.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
415
diff
changeset
|
36 |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
37 static int classify(char[] name) |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
38 { |
1204
498c484f3a03
Fix mini test runner.
Christian Kamm <kamm incasoftware de>
parents:
1198
diff
changeset
|
39 char[] tail; |
498c484f3a03
Fix mini test runner.
Christian Kamm <kamm incasoftware de>
parents:
1198
diff
changeset
|
40 char[] desc = Util.head(name, "_", tail); |
498c484f3a03
Fix mini test runner.
Christian Kamm <kamm incasoftware de>
parents:
1198
diff
changeset
|
41 if ("compile" == desc) |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
42 return COMPILE; |
1204
498c484f3a03
Fix mini test runner.
Christian Kamm <kamm incasoftware de>
parents:
1198
diff
changeset
|
43 else if ("nocompile" == desc) |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
44 return NOCOMPILE; |
1204
498c484f3a03
Fix mini test runner.
Christian Kamm <kamm incasoftware de>
parents:
1198
diff
changeset
|
45 else if ("run" == desc) |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
46 return RUN; |
1204
498c484f3a03
Fix mini test runner.
Christian Kamm <kamm incasoftware de>
parents:
1198
diff
changeset
|
47 else if ("norun" == desc) |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
48 return NORUN; |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
49 return RUN; |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
50 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
51 |
1198 | 52 auto scan = new FileFolder ("."); |
53 auto contents = scan.tree.catalog("*.d"); | |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
54 foreach(c; contents) { |
1198 | 55 auto testname = Path.parse(c.name).name; |
56 Stdout.formatln("TEST NAME: {}", testname); | |
418
94c4e090c1af
clean out obj dir before running mini test.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
415
diff
changeset
|
57 |
1204
498c484f3a03
Fix mini test runner.
Christian Kamm <kamm incasoftware de>
parents:
1198
diff
changeset
|
58 char[] cmd = Format.convert("ldc {} -quiet -L-s -ofobj/{}", c, testname); |
100 | 59 foreach(v; args[1..$]) { |
60 cmd ~= ' '; | |
61 cmd ~= v; | |
62 } | |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
63 int cl = classify(testname); |
468
45a67b6f1310
Removed the 'needsstorage' thing from Dsymbol. Arguments are not always given storage when applicable. This is not longer treat specially
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
463
diff
changeset
|
64 if (cl == COMPILE || cl == NOCOMPILE) |
45a67b6f1310
Removed the 'needsstorage' thing from Dsymbol. Arguments are not always given storage when applicable. This is not longer treat specially
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
463
diff
changeset
|
65 cmd ~= " -c"; |
1198 | 66 Stdout(cmd).newline; |
67 if (system(toStringz(cmd)) != 0) { | |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
68 if (cl != NOCOMPILE) |
1198 | 69 compilefailed ~= c.toString; |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
70 } |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
71 else if (cl == RUN || cl == NORUN) { |
1429
9081d916df1d
Fix - add Path.native for mingw support...thanks mp4/jaffa
Kelly Wilson <wilsonk cpsc.ucalgary.ca>
parents:
1204
diff
changeset
|
72 if (system(toStringz(Path.native("obj/" ~ testname))) != 0) { |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
73 if (cl == RUN) |
1198 | 74 runfailed ~= c.toString; |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
75 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
76 else { |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
77 if (cl == NORUN) |
1198 | 78 norunfailed ~= c.toString; |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
79 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
80 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
81 else { |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
82 if (cl == NOCOMPILE) |
1198 | 83 nocompilefailed ~= c.toString; |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
84 } |
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
85 } |
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
86 |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
87 size_t nerrors = 0; |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
88 |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
89 if (compilefailed.length > 0) |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
90 { |
1198 | 91 Stdout.formatln("{}{}{}{}", compilefailed.length, '/', contents.files, " of the tests failed to compile:"); |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
92 foreach(b; compilefailed) { |
1198 | 93 Stdout.formatln(" {}",b); |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
94 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
95 nerrors += compilefailed.length; |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
96 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
97 |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
98 if (nocompilefailed.length > 0) |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
99 { |
1198 | 100 Stdout.formatln("{}{}{}{}", nocompilefailed.length, '/', contents.files, " of the tests failed to NOT compile:"); |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
101 foreach(b; nocompilefailed) { |
1198 | 102 Stdout.formatln(" {}",b); |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
103 } |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
104 nerrors += nocompilefailed.length; |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
105 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
106 |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
107 if (runfailed.length > 0) |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
108 { |
1198 | 109 Stdout.formatln("{}{}{}{}", runfailed.length, '/', contents.files, " of the tests failed to run:"); |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
110 foreach(b; runfailed) { |
1198 | 111 Stdout.formatln(" {}",b); |
12 | 112 } |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
113 nerrors += runfailed.length; |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
114 } |
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
115 |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
116 if (norunfailed.length > 0) |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
117 { |
1198 | 118 Stdout.formatln("{}{}{}{}", norunfailed.length, '/', contents.files, " of the tests failed to NOT run:"); |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
119 foreach(b; norunfailed) { |
1198 | 120 Stdout.formatln(" {}",b); |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
121 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
122 nerrors += norunfailed.length; |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
123 } |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
124 |
1198 | 125 Stdout.formatln("{}{}{}{}", contents.files - nerrors, '/', contents.files, " of the tests passed"); |
415
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
126 |
76bf1eaaf4dc
Updated the mini test runner to allow classified tests as
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents:
383
diff
changeset
|
127 return nerrors ? 1 : 0; |
11
d3ee9efe20e2
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
lindquist
parents:
diff
changeset
|
128 } |