annotate tests/runminitest.d @ 1351:8d501abecd24

Initial (but disabled) fix for ticket #294 , the actual part that fixes the bug is in a #if 0 block as I'm afraid it will cause regressions. I'm most likely not going to be around tonight, and maybe not tomorrow as well, so I'm pushing it in case someone wants to run some serious testing/investigate the problem noted in llvmhelpers.cpp : realignOffset .
author Tomas Lindquist Olsen <tomas.l.olsen gmail com>
date Thu, 14 May 2009 17:20:17 +0200
parents 498c484f3a03
children 9081d916df1d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
3 import tango.io.FileSystem,
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
4 tango.io.Stdout,
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
5 tango.io.vfs.FileFolder;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
6 import Path = tango.io.Path;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
7 import Util = tango.text.Util;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
8 import tango.text.convert.Format;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
9 import tango.stdc.stdlib,
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
22 char[][] compilefailed;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
23 char[][] nocompilefailed;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
24 char[][] runfailed;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
29 if (!Path.exists("obj"))
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
52 auto scan = new FileFolder (".");
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
55 auto testname = Path.parse(c.name).name;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
5071469303d4 [svn r104] TONS OF FIXES.
lindquist
parents: 42
diff changeset
59 foreach(v; args[1..$]) {
5071469303d4 [svn r104] TONS OF FIXES.
lindquist
parents: 42
diff changeset
60 cmd ~= ' ';
5071469303d4 [svn r104] TONS OF FIXES.
lindquist
parents: 42
diff changeset
61 cmd ~= v;
5071469303d4 [svn r104] TONS OF FIXES.
lindquist
parents: 42
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
66 Stdout(cmd).newline;
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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) {
1198
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
72 if (system(toStringz("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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
111 Stdout.formatln(" {}",b);
12
ee302fe07296 [svn r16] * Updated all tests to have a main
lindquist
parents: 11
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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
f48500f9350c Ported script to Tango
larsivi@larsivi-gutsy
parents: 781
diff changeset
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 }