annotate tests/makewebstatistics.d @ 341:1bb99290e03a trunk

[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author lindquist
date Sun, 13 Jul 2008 02:51:19 +0200
parents 5d2f4814bb2e
children c9d5c711d65a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
1 // Based on DSTRESS code by Thomas Kühne
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
2
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
3 module findregressions;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
4
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
5 private import std.string;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
6 private import std.conv;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
7 private import std.stdio;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
8 private import std.stream;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
9 private import std.file;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
10 private import std.c.stdlib;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
11 private import std.date;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
12 private import std.path;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
13
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
14
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
15 enum Result{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
16 UNTESTED = 0,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
17 PASS = 1 << 2,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
18 XFAIL = 2 << 2,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
19 XPASS = 3 << 2,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
20 FAIL = 4 << 2,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
21 ERROR = 5 << 2,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
22 BASE_MASK = 7 << 2,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
23
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
24 EXT_MASK = 3,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
25 BAD_MSG = 1,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
26 BAD_GDB = 2,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
27
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
28 MAX = BAD_GDB + BASE_MASK
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
29 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
30
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
31 char[] toString(Result r){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
32 switch(r & Result.BASE_MASK){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
33 case Result.PASS: return "PASS";
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
34 case Result.XPASS: return "XPASS";
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
35 case Result.FAIL: return "FAIL";
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
36 case Result.XFAIL: return "XFAIL";
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
37 case Result.ERROR: return "ERROR";
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
38 case Result.UNTESTED: return "UNTESTED";
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
39 default:
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
40 break;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
41 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
42 throw new Exception(format("unhandled Result value %s", cast(int)r));
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
43 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
44
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
45 char[] dateString(){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
46 static char[] date;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
47 if(date is null){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
48 auto time = getUTCtime();
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
49 auto year = YearFromTime(time);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
50 auto month = MonthFromTime(time);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
51 auto day = DateFromTime(time);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
52 date = format("%d-%02d-%02d", year, month+1, day);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
53 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
54 return date;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
55 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
56
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
57 char[][] unique(char[][] a){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
58 char[][] b = a.sort;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
59 char[][] back;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
60
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
61 back ~= b[0];
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
62
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
63 size_t ii=0;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
64 for(size_t i=0; i<b.length; i++){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
65 if(back[ii]!=b[i]){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
66 back~=b[i];
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
67 ii++;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
68 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
69 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
70
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
71 return back;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
72 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
73
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
74 private{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
75 version(Windows){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
76 import std.c.windows.windows;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
77 extern(Windows) BOOL GetFileTime(HANDLE hFile, LPFILETIME lpCreationTime, LPFILETIME lpLastAccessTime, LPFILETIME lpLastWriteTime);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
78 }else version(linux){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
79 import std.c.linux.linux;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
80 version = Unix;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
81 }else version(Unix){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
82 import std.c.unix.unix;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
83 }else{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
84 static assert(0);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
85 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
86
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
87 alias ulong FStime;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
88
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
89 FStime getFStime(char[] fileName){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
90 version(Windows){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
91 HANDLE h;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
92
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
93 if (useWfuncs){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
94 wchar* namez = std.utf.toUTF16z(fileName);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
95 h = CreateFileW(namez,GENERIC_WRITE,0,null,OPEN_ALWAYS,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
96 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,cast(HANDLE)null);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
97 }else{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
98 char* namez = toMBSz(fileName);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
99 h = CreateFileA(namez,GENERIC_WRITE,0,null,OPEN_ALWAYS,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
100 FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN,cast(HANDLE)null);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
101 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
102
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
103 if (h == INVALID_HANDLE_VALUE)
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
104 goto err;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
105
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
106 FILETIME creationTime;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
107 FILETIME accessTime;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
108 FILETIME writeTime;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
109
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
110 BOOL b = GetFileTime(h, &creationTime, &accessTime, &writeTime);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
111 if(b==1){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
112 long modA = writeTime.dwLowDateTime;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
113 long modB = writeTime.dwHighDateTime;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
114 return modA | (modB << (writeTime.dwHighDateTime.sizeof*8));
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
115 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
116
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
117 err:
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
118 CloseHandle(h);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
119 throw new Exception("failed to query file modification : "~fileName);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
120 }else version(Unix){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
121 char* namez = toStringz(fileName);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
122 struct_stat statbuf;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
123
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
124 if(stat(namez, &statbuf)){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
125 throw new FileException(fileName, getErrno());
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
126 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
127
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
128 return statbuf.st_mtime;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
129 }else{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
130 static assert(0);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
131 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
132 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
133 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
134
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
135 char[] cleanFileName(char[] file){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
136 char[] back;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
137 bool hadSep;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
138
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
139 foreach(char c; file){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
140 if(c == '/' || c == '\\'){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
141 if(!hadSep){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
142 back ~= '/';
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
143 hadSep = true;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
144 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
145 }else{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
146 back ~= c;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
147 hadSep = false;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
148 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
149 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
150
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
151 size_t start = 0;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
152 while(back[start] <= ' ' && start < back.length){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
153 start++;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
154 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
155
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
156 size_t end = back.length-1;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
157 while(back[end] <= ' ' && end >= start){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
158 end--;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
159 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
160
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
161 back = back[start .. end+1];
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
162
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
163 return back;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
164 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
165
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
166 class Test{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
167 char[] name;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
168 char[] file;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
169 Result r;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
170
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
171 this(char[] file){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
172 this.file = file;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
173
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
174 int start = rfind(file, "/");
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
175 if(start<0){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
176 start = 0;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
177 }else{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
178 start += 1;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
179 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
180
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
181 int end = rfind(file, ".");
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
182 if(end < start){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
183 end = file.length;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
184 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
185
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
186 name = file[start .. end];
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
187 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
188 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
189
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
190
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
191 class Log{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
192 Test[char[]] tests;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
193
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
194 char[] id;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
195
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
196 int[Result] counts;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
197
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
198 this(char[] id, char[] file){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
199 this.id = id;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
200 counts = [
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
201 Result.PASS: 0,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
202 Result.FAIL: 0,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
203 Result.XPASS: 0,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
204 Result.XFAIL: 0,
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
205 Result.ERROR: 0 ];
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
206
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
207 writefln("parsing: %s", file);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
208 FStime logTime = getFStime(file);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
209 Stream source = new BufferedFile(file, FileMode.In);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
210 while(!source.eof()){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
211 add(source.readLine());
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
212 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
213 dropBogusResults(logTime, "dstress");
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
214 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
215
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
216
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
217 void dropBogusResults(FStime recordTime, char[] testRoot){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
218 uint totalCount = tests.length;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
219
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
220 char[][] sourcesTests = tests.keys;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
221 foreach(char[] source; sourcesTests){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
222 if(find(source, "complex/") < 0){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
223 try{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
224 FStime caseTime = getFStime(testRoot~std.path.sep~source);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
225 if(caseTime > recordTime){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
226 debug(drop) fwritefln(stderr, "dropped: %s", source);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
227 counts[tests[source].r & Result.BASE_MASK]--;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
228 tests.remove(source);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
229 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
230 }catch(Exception e){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
231 debug(drop) fwritefln(stderr, "dropped: %s", source);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
232 counts[tests[source].r & Result.BASE_MASK]--;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
233 tests.remove(source);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
234 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
235 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
236 // asm-filter
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
237 int i = find(source, "asm_p");
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
238 if(i >= 0){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
239 counts[tests[source].r & Result.BASE_MASK]--;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
240 tests.remove(source);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
241 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
242 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
243 tests.rehash;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
244
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
245 writefln("dropped %s outdated tests (%s remaining)", totalCount - tests.length, tests.length);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
246 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
247
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
248
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
249 bool add(char[] line){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
250 const char[] SUB = "Torture-Sub-";
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
251 const char[] TORTURE = "Torture:";
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
252
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
253 line = strip(line);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
254 int id = -1;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
255 Result r = Result.UNTESTED;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
256
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
257 if(line.length > SUB.length && line[0 .. SUB.length] == SUB){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
258 line = line[SUB.length .. $];
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
259 id = 0;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
260 while(line[id] >= '0' && line[id] <= '9'){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
261 id++;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
262 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
263 int start = id;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
264 id = std.conv.toUint(line[0 .. id]);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
265
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
266 while(line[start] != '-'){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
267 start++;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
268 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
269 line = line[start+1 .. $];
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
270 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
271
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
272 char[][] token = split(line);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
273 if(token.length < 2){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
274 return false;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
275 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
276 char[] file = strip(token[1]);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
277
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
278 switch(token[0]){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
279 case "PASS:":
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
280 r = Result.PASS; break;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
281 case "FAIL:":
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
282 r = Result.FAIL; break;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
283 case "XPASS:":
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
284 r = Result.XPASS; break;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
285 case "XFAIL:":
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
286 r = Result.XFAIL; break;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
287 case "ERROR:":
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
288 r = Result.ERROR; break;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
289 default:{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
290 if(token[0] == TORTURE){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
291 throw new Exception("not yet handled: "~line);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
292 }else if(id > -1){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
293 throw new Exception(format("bug in SUB line: (%s) %s", id, line));
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
294 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
295 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
296 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
297
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
298 if(r != Result.UNTESTED){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
299 if(std.string.find(line, "bad error message") > -1){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
300 r |= Result.BAD_MSG;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
301 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
302 if(std.string.find(line, "bad debugger message") > -1){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
303 r |= Result.BAD_MSG;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
304 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
305
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
306 file = cleanFileName(file);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
307
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
308 if(id >= 0){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
309 // update sub
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
310 id--;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
311
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
312 Test* test = file in tests;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
313
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
314 if(test is null){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
315 Test t = new Test(file);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
316 tests[file] = t;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
317 t.r = r;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
318 counts[r & Result.BASE_MASK]++;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
319 }else{
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
320 if(test.r != Result.UNTESTED){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
321 test.r = Result.UNTESTED;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
322 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
323 test.r = r;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
324 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
325 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
326 return true;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
327 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
328 return false;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
329 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
330 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
331
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
332
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
333 char[] basedir = "web";
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
334 bool regenerate = false;
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
335
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
336 int main(char[][] args){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
337
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
338 if(args.length < 3 || (args[1] == "--regenerate" && args.length < 4)){
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
339 fwritefln(stderr, "%s [--regenerate] <reference-log> <log> <log> ...", args[0]);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
340 fwritefln(stderr, "bash example: %s reference/dmd-something $(ls reference/llvmdc*)", args[0]);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
341 return 1;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
342 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
343
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
344 char[] reference;
257
4234b014a4f2 [svn r275] improved makewebstatistics
ChristianK
parents: 256
diff changeset
345 char[][] files;
4234b014a4f2 [svn r275] improved makewebstatistics
ChristianK
parents: 256
diff changeset
346 if(args[1] == "--regenerate") {
4234b014a4f2 [svn r275] improved makewebstatistics
ChristianK
parents: 256
diff changeset
347 regenerate = true;
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
348 reference = args[2];
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
349 files = args[3..$] ~ reference;
257
4234b014a4f2 [svn r275] improved makewebstatistics
ChristianK
parents: 256
diff changeset
350 } else {
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
351 reference = args[1];
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
352 files = args[2..$] ~ reference;
257
4234b014a4f2 [svn r275] improved makewebstatistics
ChristianK
parents: 256
diff changeset
353 }
4234b014a4f2 [svn r275] improved makewebstatistics
ChristianK
parents: 256
diff changeset
354
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
355 // make sure base path exists
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
356 if(std.file.exists(basedir) && !std.file.isdir(basedir))
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
357 throw new Exception(basedir ~ " is not a directory!");
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
358 else if(!std.file.exists(basedir))
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
359 std.file.mkdir(basedir);
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
360
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
361
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
362 Log[char[]] logs;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
363
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
364 // emit per-log data
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
365 foreach(char[] file; files)
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
366 generateLogStatistics(file, logs);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
367
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
368 // differences between logs
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
369 foreach(int i, char[] file; files[1 .. $])
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
370 generateChangeStatistics(files[1+i], files[1+i-1], logs);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
371
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
372 // differences between reference and logs
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
373 foreach(char[] file; files[0..$-1])
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
374 generateChangeStatistics(file, reference, logs);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
375
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
376 // collect all the stats.base files into a large table
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
377 BufferedFile index = new BufferedFile(std.path.join(basedir, "index.html"), FileMode.OutNew);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
378 scope(exit) index.close();
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
379 index.writefln(`
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
380 <html><body>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
381 <table style="border-collapse:collapse; text-align:center;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
382 <colgroup>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
383 <col style="border-right: medium solid black;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
384 <col style="background-color: #AAFFAA;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
385 <col style="background-color: #AAFFAA; border-right: thin solid black;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
386 <col style="background-color: #FFAAAA;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
387 <col style="background-color: #FFAAAA;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
388 <col style="background-color: #FFAAAA;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
389 <col style="border-left: medium solid black;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
390 </colgroup>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
391 <tr style="border-bottom: medium solid black;">
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
392 <th>name</th>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
393 <th style="padding-left:1em;padding-right:1em;">PASS</th>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
394 <th style="padding-left:1em;padding-right:1em;">XFAIL</th>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
395 <th style="padding-left:1em;padding-right:1em;">FAIL</th>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
396 <th style="padding-left:1em;padding-right:1em;">XPASS</th>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
397 <th style="padding-left:1em;padding-right:1em;">ERROR</th>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
398 <th style="padding-left:1em;padding-right:1em;">comparison to ` ~ std.path.getBaseName(reference) ~ `</th>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
399 </tr>
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
400 `);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
401
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
402 for(int i = files.length - 1; i >= 0; --i) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
403 auto file = files[i];
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
404 index.writefln(`<tr>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
405 char[] id = std.path.getBaseName(file);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
406 char[] statsname = std.path.join(std.path.join(basedir, id), "stats.base");
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
407 index.writef(cast(char[])std.file.read(statsname));
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
408
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
409 if(i != files.length - 1) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
410 index.writefln(`<td>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
411 char[] refid = std.path.getBaseName(reference);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
412 statsname = std.path.join(std.path.join(basedir, refid ~ "-to-" ~ id), "stats.base");
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
413 index.writef(cast(char[])std.file.read(statsname));
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
414 index.writefln(`</td></tr>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
415 } else {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
416 index.writefln(`<td></td></tr>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
417 }
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
418
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
419 if(i == 0) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
420 continue;
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
421 }
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
422
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
423 index.writefln(`<tr><td></td>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
424 index.writefln(`<td style="background-color:white;" colspan="5">`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
425 char[] newid = std.path.getBaseName(files[i-1]);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
426 statsname = std.path.join(std.path.join(basedir, newid ~ "-to-" ~ id), "stats.base");
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
427 index.writef(cast(char[])std.file.read(statsname));
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
428 index.writefln(`</td><td></td></tr>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
429 }
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
430
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
431 index.writefln(`</table></body></html>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
432
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
433 return 0;
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
434 }
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
435
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
436 void generateLogStatistics(char[] file, ref Log[char[]] logs)
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
437 {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
438 char[] id = std.path.getBaseName(file);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
439 char[] dirname = std.path.join(basedir, id);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
440
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
441 if(std.file.exists(dirname)) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
442 if(std.file.isdir(dirname)) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
443 if(!regenerate) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
444 writefln("Directory ", dirname, " already exists, skipping...");
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
445 return;
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
446 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
447 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
448 else
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
449 throw new Exception(dirname ~ " is not a directory!");
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
450 }
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
451 else
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
452 std.file.mkdir(dirname);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
453
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
454 // parse etc.
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
455 Log log = new Log(id, file);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
456 logs[id] = log;
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
457
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
458 // write status
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
459 {
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
460 BufferedFile makeFile(char[] name) {
261
5723b7385c25 [svn r279] fixed bug in makewebstatistics, regenerated output
ChristianK
parents: 257
diff changeset
461 return new BufferedFile(std.path.join(dirname, name), FileMode.OutNew);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
462 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
463 BufferedFile[Result] resultsfile = [
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
464 Result.PASS: makeFile("pass.html"),
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
465 Result.FAIL: makeFile("fail.html"),
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
466 Result.XPASS: makeFile("xpass.html"),
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
467 Result.XFAIL: makeFile("xfail.html"),
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
468 Result.ERROR: makeFile("error.html") ];
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
469
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
470 scope(exit) {
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
471 foreach(file; resultsfile)
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
472 file.close();
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
473 }
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
474
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
475 foreach(file; resultsfile)
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
476 file.writefln(`<html><body>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
477
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
478 foreach(tkey; log.tests.keys.sort) {
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
479 auto test = log.tests[tkey];
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
480 auto result = test.r & Result.BASE_MASK;
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
481 resultsfile[result].writefln(test.name, " in ", test.file, "<br>");
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
482 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
483
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
484 foreach(file; resultsfile)
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
485 file.writefln(`</body></html>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
486 }
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
487
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
488 BufferedFile stats = new BufferedFile(std.path.join(dirname, "stats.base"), FileMode.OutNew);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
489 scope(exit) stats.close();
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
490 stats.writefln(`<td style="padding-right:1em; text-align:left;">`, id, `</td>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
491 stats.writefln(`<td><a href="`, std.path.join(log.id, "pass.html"), `">`, log.counts[Result.PASS], `</a></td>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
492 stats.writefln(`<td><a href="`, std.path.join(log.id, "xfail.html"), `">`, log.counts[Result.XFAIL], `</a></td>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
493 stats.writefln(`<td><a href="`, std.path.join(log.id, "fail.html"), `">`, log.counts[Result.FAIL], `</a></td>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
494 stats.writefln(`<td><a href="`, std.path.join(log.id, "xpass.html"), `">`, log.counts[Result.XPASS], `</a></td>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
495 stats.writefln(`<td><a href="`, std.path.join(log.id, "error.html"), `">`, log.counts[Result.ERROR], `</a></td>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
496 }
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
497
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
498 void generateChangeStatistics(char[] file1, char[] file2, ref Log[char[]] logs)
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
499 {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
500 char[] newid = std.path.getBaseName(file1);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
501 char[] oldid = std.path.getBaseName(file2);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
502
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
503 char[] dirname = std.path.join(basedir, oldid ~ "-to-" ~ newid);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
504
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
505 if(std.file.exists(dirname)) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
506 if(std.file.isdir(dirname)) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
507 if(!regenerate) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
508 writefln("Directory ", dirname, " already exists, skipping...");
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
509 return;
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
510 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
511 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
512 else
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
513 throw new Exception(dirname ~ " is not a directory!");
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
514 }
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
515 else
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
516 std.file.mkdir(dirname);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
517
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
518 // parse etc.
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
519 Log newLog, oldLog;
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
520 Log getOrParse(char[] id, char[] file) {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
521 if(id in logs)
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
522 return logs[id];
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
523 else {
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
524 Log tmp = new Log(id, file);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
525 logs[id] = tmp;
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
526 return tmp;
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
527 }
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
528 }
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
529 newLog = getOrParse(newid, file1);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
530 oldLog = getOrParse(oldid, file2);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
531
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
532 int nRegressions, nImprovements, nChanges;
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
533
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
534 {
261
5723b7385c25 [svn r279] fixed bug in makewebstatistics, regenerated output
ChristianK
parents: 257
diff changeset
535 auto regressionsFile = new BufferedFile(std.path.join(dirname, "regressions.html"), FileMode.OutNew);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
536 scope(exit) regressionsFile.close();
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
537 regressionsFile.writefln(`<html><body>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
538
261
5723b7385c25 [svn r279] fixed bug in makewebstatistics, regenerated output
ChristianK
parents: 257
diff changeset
539 auto improvementsFile = new BufferedFile(std.path.join(dirname, "improvements.html"), FileMode.OutNew);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
540 scope(exit) improvementsFile.close();
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
541 improvementsFile.writefln(`<html><body>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
542
261
5723b7385c25 [svn r279] fixed bug in makewebstatistics, regenerated output
ChristianK
parents: 257
diff changeset
543 auto changesFile = new BufferedFile(std.path.join(dirname, "changes.html"), FileMode.OutNew);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
544 scope(exit) changesFile.close();
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
545 changesFile.writefln(`<html><body>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
546
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
547 BufferedFile targetFile;
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
548
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
549 foreach(Test t; newLog.tests.values){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
550 Test* oldT = t.file in oldLog.tests;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
551
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
552 if(oldT !is null){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
553 if(oldT.r == t.r)
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
554 continue;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
555 else if(oldT.r < t.r && oldT.r && oldT.r <= Result.XFAIL){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
556 targetFile = regressionsFile;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
557 nRegressions++;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
558 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
559 else if(t.r < oldT.r && t.r && t.r <= Result.XFAIL){
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
560 targetFile = improvementsFile;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
561 nImprovements++;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
562 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
563 else {
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
564 targetFile = changesFile;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
565 nChanges++;
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
566 }
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
567 targetFile.writefln(toString(oldT.r), " -> ", toString(t.r), " : ", t.name, " in ", t.file, "<br>");
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
568 }
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
569 }
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
570
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
571 regressionsFile.writefln(`</body></html>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
572 improvementsFile.writefln(`</body></html>`);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
573 changesFile.writefln(`</body></html>`);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
574 }
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
575
266
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
576 BufferedFile stats = new BufferedFile(std.path.join(dirname, "stats.base"), FileMode.OutNew);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
577 scope(exit) stats.close();
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
578 auto dir = oldid ~ "-to-" ~ newid;
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
579 stats.writefln(`<a href="`, std.path.join(dir, "improvements.html"), `">Improvements: `, nImprovements, `</a>, `);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
580 stats.writefln(`<a href="`, std.path.join(dir, "regressions.html"), `">Regressions: `, nRegressions, `</a>, `);
5d2f4814bb2e [svn r287] update to test statistics generation
ChristianK
parents: 261
diff changeset
581 stats.writefln(`<a href="`, std.path.join(dir, "changes.html"), `">Changes: `, nChanges, `</a>`);
255
4d14a1c84be7 [svn r272] some rough html statistics for the tests
ChristianK
parents:
diff changeset
582 }