annotate dstress.c @ 361:0147a35cbeb7

dif. fixes 5
author thomask
date Fri, 25 Mar 2005 05:25:33 +0000
parents 1062095b7a23
children 177ce8d13eac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
1 /*
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
2 * core test tool for the DStress test suite
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
3 * http://dstress.kuehne.cn
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
4 *
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
5 * Copyright (C) 2005 Thomas Kuehne <thomas@kuehne.cn>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
6 *
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
10 * (at your option) any later version.
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
11 *
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
15 * GNU General Public License for more details.
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
16 *
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
20 *
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
21 * $HeadURL$
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
22 * $Date$
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
23 * $Author$
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
24 *
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
25 */
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
26
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
27 #include <stdlib.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
28 #include <stdio.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
29 #include <string.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
30 #include <errno.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
31
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
32 #define TAG "__DSTRESS_DFLAGS__"
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
33 #define OBJ "-odobj "
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
34 #define TLOG "log.tmp"
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
35
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
36 #define RUN 1
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
37 #define NORUN 2
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
38 #define COMPILE 4
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
39 #define NOCOMPILE 8
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
40
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
41 #ifdef __GNU_LIBRARY__
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
42 #define USE_POSIX
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
43 #endif
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
44
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
45 #ifdef __GLIBC__
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
46 #define USE_POSIX
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
47 #endif
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
48
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
49 #ifdef linux
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
50 #define USE_POSIX
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
51 #endif
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
52
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
53 #if defined(__APPLE__) && defined(__MACH__)
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
54 #define USE_POSIX
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
55 #endif
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
56
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
57 #ifdef __FreeBSD__
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
58 #define USE_POSIX
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
59 #endif
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
60
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
61
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
62 #ifdef USE_POSIX
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
63
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
64 #define RETURN_OK 0
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
65 #define RETURN_FAIL 256
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
66 #define crashRun system
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
67
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
68 #include <sys/types.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
69 #include <sys/stat.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
70 #include <fcntl.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
71 #include <unistd.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
72 char* loadFile(char* filename){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
73 char* back = NULL;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
74 struct stat fileInfo;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
75 int file = open(filename, O_RDONLY);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
76 if(errno == 0 && file != 0 && file != -1){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
77 if(0==fstat(file, &fileInfo)){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
78 back=malloc(fileInfo.st_size+1);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
79 fileInfo.st_size = read(file, back, fileInfo.st_size);
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
80 if(fileInfo.st_size>0){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
81 *(back+fileInfo.st_size+1) = '\x00';
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
82 }else{
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
83 back = "\x00";
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
84 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
85 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
86 close(file);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
87 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
88 errno = 0;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
89 return back;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
90 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
91
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
92 #else
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
93
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
94 #ifdef WIN32
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
95
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
96 #define RETURN_OK 0
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
97 #define RETURN_FAIL 1
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
98
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
99 #include <windows.h>
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
100 char* loadFile(char* filename){
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
101 char* back=NULL;
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
102 DWORD size, numread;
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
103 HANDLE file=CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
104 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
105 if (file != INVALID_HANDLE_VALUE){
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
106 size = GetFileSize(file, NULL);
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
107 if (size != INVALID_FILE_SIZE){
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
108 back=malloc((size+1)*sizeof(char));
292
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
109 if (ReadFile(file,back,size,&numread,NULL) == 1){
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
110 if (numread==size){
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
111 *(back+size+1) = '\x00';
292
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
112 }else{
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
113 back = "\x00";
292
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
114 }
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
115 }else{
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
116 back = "\x00";
292
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
117 }
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
118 }
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
119 CloseHandle(file);
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
120 }
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
121 errno = 0;
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
122 return back;
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
123 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
124 #error no crashRun adaptation for this system available
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
125
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
126 #else
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
127 #error no loadFile adaptation for this system available
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
128 #error no crashRun adaptation for this system available /* like system(char*) but has to return without human intervention even if the application segfaults */
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
129
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
130 #endif /* WIN32 else */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
131 #endif /* USE_POSIX else */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
132
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
133 /* Query the environment for the compiler name */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
134 char* getCompiler(){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
135 char* back = getenv("DMD");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
136 if(back == NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
137 back = getenv("dmd");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
138 if(back==NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
139 back = "dmd";
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
140 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
141 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
142 return back;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
143 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
144
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
145 /* Query the environment for general flags */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
146 char* getGeneralFlags(){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
147 char* back = getenv("DFLAGS");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
148 if(back == NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
149 back = getenv("dflags");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
150 if(back==NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
151 back = "";
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
152 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
153 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
154 return back;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
155 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
156
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
157 /* extract the FIRST occurance of a given FLAG until the next linebreak */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
158 char* getCaseFlag(const char* data, const char* tag){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
159 char* begin;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
160 char* end1;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
161 char* end2;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
162 char* back;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
163
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
164 if(data!=NULL && tag!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
165 begin = strstr(data, tag);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
166 if(begin!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
167 begin = begin+strlen(tag);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
168 end1 = strstr(begin, "\n");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
169 end2 = strstr(begin, "\r");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
170 if(end2!=NULL && ((end1!=NULL && end2<end1) || end1==NULL)){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
171 end1=end2;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
172 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
173 if(end1==NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
174 end1 = begin + strlen(begin);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
175 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
176 back = malloc(end1-begin+1);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
177 strncpy(back, begin, end1-begin);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
178 back[end1-begin+1]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
179 return back;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
180 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
181 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
182
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
183 return "";
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
184 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
185
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
186
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
187 int checkErrorMessage(const char* file_, const char* line_, const char* buffer){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
188
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
189 char* file;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
190 char* line;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
191 char* dmd;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
192 char* gdc;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
193
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
194 char* begin;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
195 char* end1;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
196 char* end2;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
197
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
198 int back=0;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
199
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
200 /* clean arguments */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
201 if(strcmp(file_, "")!=0){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
202 file = malloc(strlen(file_)+1);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
203 strcpy(file, file_);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
204 }else{
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
205 file=NULL;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
206 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
207
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
208 if(strcmp(line_, "")!=0){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
209 line = malloc(strlen(line_)+1);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
210 strcpy(line, line_);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
211 }else{
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
212 line=NULL;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
213 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
214
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
215 /* gen patterns*/
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
216 if(file!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
217 if(line!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
218 dmd = malloc(strlen(file)+strlen(line)+5);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
219 dmd[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
220 strcat(dmd, file);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
221 strcat(dmd, "(");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
222 strcat(dmd, line);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
223 strcat(dmd, "): ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
224 gdc = malloc(strlen(file)+strlen(line)+4);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
225 gdc[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
226 strcat(gdc, file);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
227 strcat(gdc, ":");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
228 strcat(gdc, line);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
229 strcat(gdc, ": ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
230 }else{
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
231 dmd = malloc(strlen(file)+2);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
232 dmd[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
233 strcat(dmd, file);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
234 strcat(dmd, "(");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
235 gdc = malloc(strlen(file)+2);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
236 gdc[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
237 strcat(gdc, file);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
238 strcat(gdc, ":");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
239 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
240 }else if(line!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
241 dmd = malloc(strlen(line)+5);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
242 dmd[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
243 strcat(dmd, "(");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
244 strcat(dmd, line);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
245 strcat(dmd, "): ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
246 gdc = malloc(strlen(line)+4);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
247 gdc[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
248 strcat(gdc, ":");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
249 strcat(gdc, line);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
250 strcat(gdc, ": ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
251 }else{
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
252 dmd=NULL;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
253 gdc=NULL;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
254 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
255
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
256 /* fix filenames */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
257 #ifdef WIN32
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
258 end1="/";
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
259 end2="\\";
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
260 #else
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
261 end1="\\";
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
262 end2="/";
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
263 #endif
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
264
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
265 if(dmd!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
266 while( (begin=strchr(dmd, end1[0])) ){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
267 begin[0]=end2[0];
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
268 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
269 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
270
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
271 if(gdc!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
272 while( (begin=strchr(gdc, end1[0])) ){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
273 begin[0]=end2[0];
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
274 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
275 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
276
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
277 /* specific error messages */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
278
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
279 if( (dmd!=NULL && strstr(buffer, dmd))
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
280 || (gdc!=NULL && strstr(buffer, gdc))
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
281 || (dmd==NULL && gdc==NULL)){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
282 back=1;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
283 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
284
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
285 /* @todo@ check format of all other messages */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
286 return back;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
287 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
288
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
289 int checkRuntimeErrorMessage(const char* file, const char* line, const char* buffer){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
290 /* @todo@ */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
291 return 1;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
292 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
293
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
294
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
295 int main(int argc, char* arg[]){
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
296 char* compiler; /* the compiler */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
297 char* cmd_arg_general; /* additional arguments - from enviroment flag "DFLAGS" */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
298 char* cmd_arg_case; /* additional arguments - from the testcase file */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
299 char* buffer; /* general purpos buffer */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
300 int modus; /* test modus: RUN NORUN COMPILE NOCOMPILE */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
301 int res; /* return code from external executions */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
302 char* error_file; /* expected sourcefile containing the error */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
303 char* error_line; /* expected error line */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
304 int good_error; /* error contained file and line and matched the expectations */
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
305
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
306 /* check arguments */
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
307 if(argc != 3){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
308 err: if(argc!=0)
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
309 fprintf(stderr,"%s <run|norun|compile|nocompile> <source>\n", arg[0]);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
310 else
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
311 fprintf(stderr,"dstress.exe <run|norun|compile|nocompile> <source>\n");
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
312 exit(-1);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
313 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
314
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
315 if(0==strcmp(arg[1], "run") || 0==strcmp(arg[1], "RUN")){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
316 modus = RUN;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
317 }else if(0==strcmp(arg[1], "norun") || 0==strcmp(arg[1], "NORUN")){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
318 modus = NORUN;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
319 }else if(0==strcmp(arg[1], "compile") || 0==strcmp(arg[1], "COMPILE")){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
320 modus = COMPILE;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
321 }else if(0==strcmp(arg[1], "nocompile") || 0==strcmp(arg[1], "NOCOMPILE")){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
322 modus = NOCOMPILE;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
323 }else{
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
324 goto err;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
325 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
326
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
327 /* gen flags */
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
328 compiler = getCompiler();
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
329 cmd_arg_general = getGeneralFlags();
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
330 buffer = loadFile(arg[2]);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
331
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
332 cmd_arg_case = getCaseFlag(buffer, "__DSTRESS_DFLAGS__");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
333 error_line = getCaseFlag(buffer, "__DSTRESS_ELINE__");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
334 error_file = getCaseFlag(buffer, "__DSTRESS_EFILE__");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
335
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
336 /* strip spaces */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
337 while(error_line[0]==' '){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
338 error_line++;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
339 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
340 for(buffer=error_line+strlen(error_line)-1; buffer && buffer[0]==' '; buffer=error_line+strlen(error_line)-1){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
341 buffer[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
342 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
343 while(error_file[0]==' '){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
344 error_file++;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
345 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
346 for(buffer=error_file+strlen(error_file)-1; buffer && buffer[0]==' '; buffer=error_file+strlen(error_file)-1){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
347 buffer[0]='\x00';
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
348 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
349
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
350 /* set implicit source file */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
351 if(strcmp(error_line, "")!=0 && strcmp(error_file, "")==0){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
352 error_file=arg[2];
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
353 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
354
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
355 /* start working */
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
356 if(modus==COMPILE || modus==NOCOMPILE){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
357 /* gen command */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
358 buffer = malloc(strlen(compiler)+strlen(cmd_arg_general)+strlen(cmd_arg_case)+strlen(OBJ)
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
359 +strlen(arg[2])+strlen(TLOG)+64);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
360 buffer[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
361 strcat(buffer, compiler);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
362 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
363 strcat(buffer, cmd_arg_general);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
364 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
365 strcat(buffer, cmd_arg_case);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
366 strcat(buffer, " -c ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
367 if(NULL==strstr(buffer, "-od")){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
368 strcat(buffer, OBJ);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
369 strcat(buffer, " ");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
370 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
371 strcat(buffer, arg[2]);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
372 strcat(buffer, " 1> ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
373 strcat(buffer, TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
374 strcat(buffer, " 2>&1");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
375
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
376 /* test */
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
377 if(modus==COMPILE){
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
378 fprintf(stderr, "compile: %s\n", buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
379 }else{
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
380 fprintf(stderr, "nocompile: %s\n", buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
381 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
382 res = crashRun(buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
383
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
384 /* diagnostic */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
385 buffer = loadFile(TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
386 fprintf(stderr, "%s\n", buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
387 good_error = checkErrorMessage(error_file, error_line, buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
388
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
389 if(strstr(buffer, "Internal error")!= NULL || strstr(buffer, "gcc.gnu.org/bugs")!=NULL){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
390 printf("ERROR:\t%s (Internal compiler error)\n", arg[2]);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
391 }else if(modus==COMPILE){
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
392 if(res==RETURN_OK){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
393 printf("PASS: \t%s\n", arg[2]);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
394 }else if(res==RETURN_FAIL && good_error){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
395 printf("FAIL: \t%s [%d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
396 }else{
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
397 printf("ERROR:\t%s [%d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
398 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
399 }else{
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
400 if(res==RETURN_FAIL){
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
401 if(good_error){
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
402 printf("XFAIL:\t%s\n", arg[2]);
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
403 }else{
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
404 printf("FAIL: \t%s\n", arg[2]);
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
405 }
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
406 }else if(res==RETURN_OK){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
407 printf("XPASS:\t%s\n", arg[2]);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
408 }else{
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
409 printf("ERROR:\t%s [%d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
410 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
411 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
412 fprintf(stderr,"--------\n");
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
413 }else if(modus==RUN || modus==NORUN){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
414 /* gen command */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
415 buffer = malloc(strlen(compiler)+strlen(cmd_arg_general)+strlen(cmd_arg_case)+strlen(OBJ)
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
416 +strlen(arg[2])*2+strlen(TLOG)+64);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
417 buffer[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
418 strcat(buffer, compiler);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
419 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
420 strcat(buffer, cmd_arg_general);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
421 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
422 strcat(buffer, cmd_arg_case);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
423 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
424 if(NULL==strstr(buffer, "-od")){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
425 strcat(buffer, OBJ);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
426 strcat(buffer, " ");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
427 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
428 if(NULL==strstr(buffer, "-of")){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
429 strcat(buffer, "-of");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
430 strcat(buffer, arg[2]);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
431 strcat(buffer, ".exe ");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
432 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
433 strcat(buffer, arg[2]);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
434 strcat(buffer, " 1> ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
435 strcat(buffer, TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
436 strcat(buffer, " 2>&1");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
437
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
438 /* test 1/2 */
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
439 if(modus==RUN){
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
440 fprintf(stderr, "run: %s\n", buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
441 }else{
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
442 fprintf(stderr, "norun: %s\n", buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
443 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
444 res = crashRun(buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
445
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
446 /* diagnostic 1/2 */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
447 buffer = loadFile(TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
448 fprintf(stderr, "%s", buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
449 good_error = checkErrorMessage(error_file, error_line, buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
450 if(strstr(buffer, "Internal error")!= NULL || strstr(buffer, "gcc.gnu.org/bugs")!=NULL){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
451 printf("ERROR:\t%s (Internal compiler error)\n", arg[2]);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
452 fprintf(stderr, "\n--------\n");
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
453 return 0;
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
454 }else if(res==RETURN_FAIL && good_error){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
455 printf("FAIL: \t%s [%d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
456 fprintf(stderr, "\n--------\n");
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
457 return 0;
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
458 }else if(res!=RETURN_OK){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
459 printf("ERROR:\t%s [%d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
460 fprintf(stderr, "\n--------\n");
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
461 return 0;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
462 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
463
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
464 /* test 2/2 */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
465 buffer = malloc(strlen(arg[2]) + strlen(TLOG) + 24);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
466 *buffer = '\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
467 strcat(buffer, arg[2]);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
468 strcat(buffer, ".exe 1> ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
469 strcat(buffer, TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
470 strcat(buffer, " 2>&1");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
471 fprintf(stderr, "%s\n", buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
472 res=crashRun(buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
473
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
474 /* diagnostic 2/2 */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
475 buffer = loadFile(TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
476 if(buffer==NULL || strlen(buffer)<2){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
477 buffer="";
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
478 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
479 fprintf(stderr, "%s\n", buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
480 good_error = checkRuntimeErrorMessage(error_file, error_line, buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
481 if(modus==RUN){
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
482 if(res==RETURN_OK){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
483 printf("PASS: \t%s\n", arg[2]);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
484 }else if(res==RETURN_FAIL && good_error){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
485 printf("FAIL: \t%s [run: %d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
486 }else{
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
487 printf("ERROR:\t%s [run: %d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
488 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
489 }else{
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
490 if(res==RETURN_FAIL){
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
491 if(good_error){
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
492 printf("XFAIL:\t%s\n", arg[2]);
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
493 }else{
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
494 printf("FAIL: \t%s\n", arg[2]);
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
495 }
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
496 }else if(res==RETURN_OK){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
497 printf("XPASS:\t%s [norun: %d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
498 }else{
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
499 printf("ERROR:\t%s [norun: %d]\n", arg[2], res);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
500 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
501 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
502 fprintf(stderr, "--------\n");
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
503 }else{
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
504 printf("@bug@ %d (%s)\n", modus, arg[2]);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
505 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
506 return 0;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
507 }