annotate dstress.c @ 620:03ad4005cd8e

POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
author thomask
date Thu, 11 Aug 2005 21:28:02 +0000
parents 0434764d4a66
children 7acb8b34c87a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
1 /*
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
2 * core test tool for the DStress test suite
251
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 *
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
25 */
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
26
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
27 /* Beware: the code doesn't care about freeing allocated memory etc... */
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
28
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
29 #include <stdlib.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
30 #include <stdio.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
31 #include <string.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
32 #include <errno.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
33
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
34 #define OBJ "-odobj "
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
35 #define TLOG "log.tmp"
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
36 #define CRASH_RUN "./crashRun__"
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
37 #define GDB_SCRIPTER "./gdb.txt"
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
38
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
39 #define RUN 1
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
40 #define NORUN 2
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
41 #define COMPILE 4
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
42 #define NOCOMPILE 8
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
43
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
44 /* secure malloc */
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
45 void *xmalloc(size_t size){
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
46 void *p;
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
47 if (p < 0){
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
48 fprintf(stderr,"Failed to allocate %zd bytes!\n", size);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
49 exit(EXIT_FAILURE);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
50 }
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
51 p = malloc(size);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
52 if (p == NULL){
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
53 fprintf(stderr,"Failed to allocate %zd bytes!\n", size);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
54 exit(EXIT_FAILURE);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
55 }
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
56 return p;
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
57 }
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
58 #define malloc xmalloc
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
59
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
60 #if defined(__GNU_LIBRARY__) || defined(__GLIBC__)
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
61 #define USE_POSIX
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
62 #endif
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
63
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
64 #ifdef linux
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
65 #define USE_POSIX
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
66 #endif
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
67
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
68 #if defined(__APPLE__) && defined(__MACH__)
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
69 #define USE_POSIX
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
70 #endif
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
71
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
72 #ifdef __FreeBSD__
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
73 #define USE_POSIX
273
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
74 #endif
68b883fe4fad added *BSD support to the test framework
thomask
parents: 261
diff changeset
75
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
76
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
77 #ifdef USE_POSIX
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
78
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
79 #include <sys/types.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
80 #include <sys/stat.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
81 #include <fcntl.h>
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
82 #include <unistd.h>
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
83 #include <regex.h>
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
84
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
85 #else
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
86 #ifdef WIN32
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
87
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
88 #include <windows.h>
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
89
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
90 #endif /* WIN 32 */
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
91 #endif /* USE_POSIX else */
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
92
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
93 char* errorMsg(int good_error){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
94 return (good_error) ? ("") : " [bad error message]";
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
95 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
96
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
97 char* gdbMsg(int good_gdb){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
98 return (good_gdb) ? ("") : " [bad debugger message]";
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
99 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
100
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
101 char* strip(char* buffer){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
102 if(buffer!=NULL){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
103 while(isspace(buffer[0])){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
104 buffer++;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
105 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
106
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
107 char* tmp;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
108 for(tmp=buffer+strlen(buffer); isspace(tmp[0]); tmp=buffer+strlen(buffer)){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
109 tmp[0]='\x00';
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
110 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
111 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
112 return buffer;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
113 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
114
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
115 /* cleanup "/" versus "\" in filenames */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
116 char* cleanPathSeperator(char* filename){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
117 char* pos;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
118 #ifdef USE_POSIX
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
119 for(pos=strchr(filename, '\\'); pos; pos=strchr(filename, '\\')){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
120 *pos='/';
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
121 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
122 #else
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
123 #if WIN32
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
124 for(pos=strchr(filename, '/'); pos; pos=strchr(filename, '/')){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
125 *pos='\\';
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
126 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
127 #else
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
128
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
129 #error no cleanPathSeperator available for this system
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
130
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
131 #endif /* WIN32 else */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
132 #endif /* USE_POSIX else */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
133 return filename;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
134 }
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
135
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
136 char* loadFile(char* filename){
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
137 #ifdef USE_POSIX
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
138 char* back = NULL;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
139 struct stat fileInfo;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
140 int file = open(filename, O_RDONLY);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
141 if(errno == 0 && file != 0 && file != -1){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
142 if(0==fstat(file, &fileInfo)){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
143 back=malloc(fileInfo.st_size+1);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
144 fileInfo.st_size = read(file, back, fileInfo.st_size);
440
dc186d1266ba fixed handling of empty files
thomask
parents: 439
diff changeset
145 if(fileInfo.st_size>=0){
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
146 *(back+fileInfo.st_size+1) = '\x00';
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
147 }else{
436
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
148 back = NULL;
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
149 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
150 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
151 close(file);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
152 }
436
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
153
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
154 if(back){
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
155 return back;
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
156 }
440
dc186d1266ba fixed handling of empty files
thomask
parents: 439
diff changeset
157 if(0==strcmp(filename, TLOG)){
dc186d1266ba fixed handling of empty files
thomask
parents: 439
diff changeset
158 return calloc(1,sizeof(char));
dc186d1266ba fixed handling of empty files
thomask
parents: 439
diff changeset
159 }
436
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
160
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
161 fprintf(stderr, "File not found \"%s\" (%s)\n", filename, strerror(errno));
436
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
162 exit(EXIT_FAILURE);
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
163 #else /* USE_POSIX */
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
164 #ifdef WIN32
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
165
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
166 char* back=NULL;
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
167 DWORD size, numread;
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
168 HANDLE file=CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, NULL,
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
169 OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_SEQUENTIAL_SCAN, NULL);
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
170 if (file != INVALID_HANDLE_VALUE){
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
171 size = GetFileSize(file, NULL);
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
172 if (size != INVALID_FILE_SIZE){
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
173 back=malloc((size+1)*sizeof(char));
292
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
174 if (ReadFile(file,back,size,&numread,NULL) == 1){
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
175 if (numread==size){
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
176 *(back+size+1) = '\x00';
292
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
177 }else{
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
178 back = NULL;
292
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
179 }
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
180 }else{
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
181 back = NULL;
292
7e28d437d6d7 fixed Windows loadFile return code bug
thomask
parents: 273
diff changeset
182 }
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
183 }
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
184 CloseHandle(file);
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
185 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
186 if(back){
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
187 errno = 0;
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
188 return back;
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
189 }
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
190
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
191 fprintf(stderr, "File not found \"%s\"\n", filename);
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
192 exit(EXIT_FAILURE);
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
193 #else /* WIN32 */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
194
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
195 #error "no loadFile implementation present"
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
196
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
197 #endif /* WIN32 else */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
198 #endif /* USE_POSIX else */
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
199 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
200
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
201 void writeFile(const char* filename, const char* content){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
202 size_t len = strlen(content);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
203 FILE* file = fopen(filename, "w+");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
204
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
205 if(errno == 0 && file != NULL){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
206 if((fwrite(content, sizeof(char), len, file) != len) || (errno != 0)){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
207 fprintf(stderr, "failed to write file \"%s\" (%s)\n", filename, strerror(errno));
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
208 exit(EXIT_FAILURE);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
209 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
210 if(fclose(file) || (errno != 0)){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
211 fprintf(stderr, "failed to close file \"%s\" (%s)\n", filename, strerror(errno));
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
212 exit(EXIT_FAILURE);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
213 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
214 return;
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
215 }
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
216
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
217 fprintf(stderr, "couldn't open file \"%s\" for writing (%s)\n", filename, strerror(errno));
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
218 exit(EXIT_FAILURE);
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
219 }
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
220
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
221 /* query the environment for the compiler name */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
222 char* getCompiler(){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
223 char* back = getenv("DMD");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
224 if(back == NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
225 back = getenv("dmd");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
226 if(back==NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
227 back = "dmd";
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
228 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
229 }
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
230 return strip(cleanPathSeperator(back));
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
231 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
232
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
233 /* query the environment for the debugger name */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
234 char* getGDB(){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
235 char* back = getenv("GDB");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
236 if(back == NULL){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
237 back = getenv("gdb");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
238 if(back == NULL){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
239 back = "gdb";
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
240 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
241 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
242 return strip(cleanPathSeperator(back));
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
243 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
244
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
245 /* query the environment for general flags */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
246 char* getGeneralFlags(){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
247 char* back = getenv("DFLAGS");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
248 if(back == NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
249 back = getenv("dflags");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
250 if(back==NULL){
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
251 back = calloc(1,1);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
252 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
253 }
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
254 return strip(cleanPathSeperator(back));
339
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
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
257
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
258 /* extract the FIRST occurance of a given TAG until the next linebreak */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
259 char* getCaseFlag(const char* data, const char* tag){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
260 char* begin;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
261 char* end1;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
262 char* end2;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
263 char* back;
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
264
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
265 if(data!=NULL && tag!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
266 begin = strstr(data, tag);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
267 if(begin!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
268 begin = begin+strlen(tag);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
269 end1 = strstr(begin, "\n");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
270 end2 = strstr(begin, "\r");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
271 if(end2!=NULL && ((end1!=NULL && end2<end1) || end1==NULL)){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
272 end1=end2;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
273 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
274 if(end1==NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
275 end1 = begin + strlen(begin);
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 back = malloc(end1-begin+1);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
278 strncpy(back, begin, end1-begin);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
279 back[end1-begin+1]='\x00';
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
280 return strip(cleanPathSeperator(back));
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
281 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
282 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
283
429
1185c50d4b08 fix dstress.c's memory handling
thomask
parents: 405
diff changeset
284 return calloc(1,1);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
285 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
286
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
287 /* check compile-time error messages */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
288 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
289
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
290 char* file;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
291 char* line;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
292 char* dmd;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
293 char* gdc;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
294
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
295 int back=0;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
296
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
297 /* clean arguments */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
298 if(strcmp(file_, "")!=0){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
299 file = malloc(strlen(file_)+1);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
300 strcpy(file, file_);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
301 }else{
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
302 file=NULL;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
303 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
304
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
305 if(strcmp(line_, "")!=0){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
306 line = malloc(strlen(line_)+1);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
307 strcpy(line, line_);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
308 }else{
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
309 line=NULL;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
310 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
311
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
312 /* gen patterns*/
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
313 if(file!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
314 if(line!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
315 dmd = malloc(strlen(file)+strlen(line)+5);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
316 dmd[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
317 strcat(dmd, file);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
318 strcat(dmd, "(");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
319 strcat(dmd, line);
405
7df87732c662 fixed DMD's pattern generator for in-message location
thomask
parents: 373
diff changeset
320 strcat(dmd, ")");
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
321 gdc = malloc(strlen(file)+strlen(line)+4);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
322 gdc[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
323 strcat(gdc, file);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
324 strcat(gdc, ":");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
325 strcat(gdc, line);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
326 strcat(gdc, ": ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
327 }else{
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
328 dmd = malloc(strlen(file)+2);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
329 dmd[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
330 strcat(dmd, file);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
331 strcat(dmd, "(");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
332 gdc = malloc(strlen(file)+2);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
333 gdc[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
334 strcat(gdc, file);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
335 strcat(gdc, ":");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
336 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
337 }else if(line!=NULL){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
338 dmd = malloc(strlen(line)+5);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
339 dmd[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
340 strcat(dmd, "(");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
341 strcat(dmd, line);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
342 strcat(dmd, "): ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
343 gdc = malloc(strlen(line)+4);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
344 gdc[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
345 strcat(gdc, ":");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
346 strcat(gdc, line);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
347 strcat(gdc, ": ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
348 }else{
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
349 return 1;
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
350 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
351
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
352 /* specific error messages */
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
353
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
354 if( (dmd!=NULL && strstr(buffer, dmd))
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
355 || (gdc!=NULL && strstr(buffer, gdc))
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
356 || (dmd==NULL && gdc==NULL)){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
357 back=1;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
358 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
359
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
360 return back;
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
361 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
362
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
363 int checkRuntimeErrorMessage(const char* file_, const char* line_, const char* buffer){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
364 /* PhobosLong dir/file.d(2)
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
365 * Phobos package.module(2)
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
366 */
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
367
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
368 char* file;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
369 char* line;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
370 char* phobos;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
371 char* phobosLong;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
372
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
373 char* begin;
439
edb0923c9159 cleanup for Linux(gcc)
thomask
parents: 438
diff changeset
374 char* end;
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
375
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
376 int back=0;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
377
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
378 /* clean arguments */
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
379 if(strcmp(file_, "")!=0){
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
380 file = malloc(strlen(file_)+1);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
381 strcpy(file, file_);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
382 }else{
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
383 file=NULL;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
384 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
385
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
386 if(strcmp(line_, "")!=0){
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
387 line = malloc(strlen(line_)+1);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
388 strcpy(line, line_);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
389 }else{
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
390 line=NULL;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
391 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
392
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
393 /* gen patterns*/
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
394 if(file!=NULL){
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
395 if(line!=NULL){
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
396 phobos = malloc(strlen(file)+strlen(line)+5);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
397 phobos[0]='\x00';
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
398 begin=strrchr(file,'/');
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
399 if(begin){
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
400 begin++;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
401 }else{
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
402 begin=strrchr(file,'\\');
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
403 if(begin){
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
404 begin++;
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
405 }else{
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
406 begin=file;
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
407 }
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
408 }
439
edb0923c9159 cleanup for Linux(gcc)
thomask
parents: 438
diff changeset
409 end=strrchr(file,'.');
edb0923c9159 cleanup for Linux(gcc)
thomask
parents: 438
diff changeset
410 strncat(phobos, begin, end-begin);
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
411 strcat(phobos, "(");
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
412 strcat(phobos, line);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
413 strcat(phobos, ")");
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
414
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
415 phobosLong = malloc(strlen(file)+strlen(line)+5);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
416 phobosLong[0]='\x00';
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
417 strcat(phobosLong, file);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
418 strcat(phobosLong, "(");
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
419 strcat(phobosLong, line);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
420 strcat(phobosLong, ")");
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
421
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
422 }else{
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
423 phobos = malloc(strlen(file)+2);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
424 phobos[0]='\x00';
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
425 begin=strrchr(file,'/');
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
426 if(begin){
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
427 begin++;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
428 }else{
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
429 begin=strrchr(file,'\\');
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
430 if(begin){
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
431 begin++;
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
432 }else{
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
433 begin=file;
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
434 }
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
435 }
439
edb0923c9159 cleanup for Linux(gcc)
thomask
parents: 438
diff changeset
436 end=strrchr(file,'.');
edb0923c9159 cleanup for Linux(gcc)
thomask
parents: 438
diff changeset
437 strncat(phobos, begin, end-begin);
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
438 strcat(phobos, "(");
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
439
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
440 phobosLong = malloc(strlen(file)+2);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
441 phobosLong[0]='\x00';
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
442 strcat(phobosLong, file);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
443 strcat(phobosLong, "(");
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
444 }
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
445 }else if(line!=NULL){
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
446 phobos = malloc(strlen(line)+3);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
447 phobos[0]='\x00';
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
448 strcat(phobos, "(");
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
449 strcat(phobos, line);
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
450 strcat(phobos, ")");
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
451
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
452 phobosLong=NULL;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
453 }else{
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
454 return 1;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
455 }
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
456
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
457 /* specific error messages */
432
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
458
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
459 if( (phobos && strstr(buffer, phobos))
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
460 || (phobosLong && strstr(buffer, phobosLong)))
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
461 {
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
462 back=1;
db4b6169a99d 1) implemented checkRuntimeErrorMessage
thomask
parents: 429
diff changeset
463 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
464
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
465 return back;
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
466 }
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
467
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
468 int hadExecCrash(const char* buffer){
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
469 if(strstr(buffer, "Segmentation fault")
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
470 || strstr(buffer, "Internal error")
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
471 || strstr(buffer, "gcc.gnu.org/bugs")
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
472 || strstr(buffer, "EXIT CODE: signal"))
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
473 {
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
474 return 1;
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
475 }
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
476 return 0;
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
477 }
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
478
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
479 /* system call with time-out */
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
480 int crashRun(const char* cmd){
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
481 #ifdef USE_POSIX
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
482 char* buffer=malloc(4+strlen(CRASH_RUN)+strlen(cmd));
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
483 buffer[0]='\x00';
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
484 strcat(buffer, "\"");
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
485 strcat(buffer, CRASH_RUN);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
486 strcat(buffer, "\" ");
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
487 strcat(buffer, cmd);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
488 system(buffer);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
489 buffer=loadFile(TLOG);
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
491 if(strstr(buffer, "EXIT CODE: 0")){
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
492 return EXIT_SUCCESS;
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
493 }else if(strstr(buffer, "EXIT CODE: 256")
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
494 || strstr(buffer, "EXIT CODE: timeout"))
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
495 {
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
496 return EXIT_FAILURE;
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
497 }else{
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
498 return RAND_MAX;
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
499 }
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
500 #else
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
501
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
502 #error comment me out, if your test cases produce neither eternal loops nor Access Violations
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
503 return system(cmd);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
504
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
505 #endif /* USE_POSIX else */
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
506 }
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
507
254
a39162afcc94 MSWindows port of "dstress.c"
thomask
parents: 251
diff changeset
508
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
509 int main(int argc, char* arg[]){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
510 char* compiler; /* the compiler - from enviroment flag "DMD" */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
511 char* cmd_arg_general; /* additional arguments - from enviroment flag "DFLAGS" */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
512 char* cmd_arg_case; /* additional arguments - from the testcase file */
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
513 char* buffer; /* general purpose buffer */
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
514 int modus; /* test modus: RUN NORUN COMPILE NOCOMPILE */
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
515 int res; /* return code from external executions */
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
516 char* case_file;
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
517 char* error_file; /* expected sourcefile containing the error */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
518 char* error_line; /* expected error line */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
519 int good_error; /* error contained file and line and matched the expectations */
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
520 char* gdb; /* the debugger - from environment flag "GDB" */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
521 char* gdb_script; /* gdb command sequence */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
522 char* gdb_pattern_raw; /* POSIX regexp expected in GDB's output */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
523 #ifdef REG_EXTENDED
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
524 regex_t* gdb_pattern;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
525 #endif
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
526 int good_gdb; /* (gdb test and positive) or (no gdb test)*/
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
527
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
528 /* check arguments */
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
529 if(argc != 3){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
530 err:
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
531 if(argc!=0)
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
532 fprintf(stderr,"%s <run|norun|compile|nocompile> <source>\n", arg[0]);
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
533 else
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
534 fprintf(stderr,"dstress <run|norun|compile|nocompile> <source>\n");
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
535 exit(EXIT_FAILURE);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
536 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
537
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
538 if(0==strcmp(arg[1], "run") || 0==strcmp(arg[1], "RUN")){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
539 modus = RUN;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
540 }else if(0==strcmp(arg[1], "norun") || 0==strcmp(arg[1], "NORUN")){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
541 modus = NORUN;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
542 }else if(0==strcmp(arg[1], "compile") || 0==strcmp(arg[1], "COMPILE")){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
543 modus = COMPILE;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
544 }else if(0==strcmp(arg[1], "nocompile") || 0==strcmp(arg[1], "NOCOMPILE")){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
545 modus = NOCOMPILE;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
546 }else{
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
547 goto err;
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
548 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
549
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
550 /* gen flags */
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
551 case_file = cleanPathSeperator(strdup(arg[2]));
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
552 compiler = getCompiler();
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
553 cmd_arg_general = getGeneralFlags();
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
554 gdb = getGDB();
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
555 buffer = loadFile(case_file);
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
556
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
557 cmd_arg_case = getCaseFlag(buffer, "__DSTRESS_DFLAGS__");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
558 error_line = getCaseFlag(buffer, "__DSTRESS_ELINE__");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
559 error_file = getCaseFlag(buffer, "__DSTRESS_EFILE__");
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
560 gdb_script = getCaseFlag(buffer, "__GDB_SCRIPT__");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
561 gdb_pattern_raw = getCaseFlag(buffer, "__GDB_PATTERN__");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
562
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
563
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
564 /* set implicit source file */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
565 if(strcmp(error_line, "")!=0 && strcmp(error_file, "")==0){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
566 error_file=case_file;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
567 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
568
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
569 /* gdb pattern */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
570 #ifdef REG_EXTENDED
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
571 if(gdb_pattern_raw!=NULL && gdb_pattern_raw[0]!='\x00'){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
572
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
573 gdb_pattern = malloc(sizeof(regex_t));
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
574 if(regcomp(gdb_pattern, gdb_pattern_raw, REG_EXTENDED)){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
575 fprintf(stderr, "failed to compile regular expression:\n\t%s\n", gdb_pattern_raw);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
576 exit(EXIT_FAILURE);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
577 }else if(gdb_script==NULL){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
578 fprintf(stderr, "GDB pattern without GDB script\n");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
579 exit(EXIT_FAILURE);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
580 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
581 }else{
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
582 gdb_pattern = NULL;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
583 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
584
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
585 /* gdb script */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
586 if(gdb_script!=NULL && gdb_script[0]!='\x00'){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
587 if(gdb_pattern==NULL){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
588 fprintf(stderr, "GDB script without GDB pattern\n");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
589 exit(EXIT_FAILURE);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
590 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
591 buffer=gdb_script;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
592 for(; *buffer; buffer++){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
593 if(buffer[0]=='\\'){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
594 if(buffer[1]=='n'){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
595 buffer[0]=' ';
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
596 buffer[1]='\n';
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
597 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
598 buffer++;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
599 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
600 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
601
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
602 buffer=malloc(strlen(gdb_script)+10);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
603 strcpy(buffer, gdb_script);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
604 gdb_script=strcat(buffer, "\n\nquit\ny\n\n");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
605 good_gdb = 0;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
606 }else{
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
607 good_gdb = 1;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
608 gdb_script = NULL;
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
609 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
610
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
611 #else
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
612
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
613 if(gdb_script && gdb_pattern_raw){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
614 fprintf(stderr, "WARNING: regex support inactive\n");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
615 }else if(gdb_script && strlen(gdb_script)){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
616 fprintf(stderr, "GDB script without GDB pattern\n");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
617 exit(EXIT_FAILURE);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
618 }else if(gdb_pattern_raw && strlen(gdb_pattern_raw)){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
619 fprintf(stderr, "GDB pattern without GDB script\n");
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
620 exit(EXIT_FAILURE);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
621 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
622
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
623 #endif /* REG_EXTENDED else */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
624
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
625
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
626
493
1418f225a81e disabled debug output
thomask
parents: 490
diff changeset
627 #ifdef DEBUG
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
628 fprintf(stderr, "case: \"%s\"\n", case_file);
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
629 fprintf(stderr, "compiler: \"%s\"\n", compiler);
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
630 fprintf(stderr, "DFLAGS G: \"%s\"\n", cmd_arg_general);
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
631 fprintf(stderr, "DFLAGS C: \"%s\"\n", cmd_arg_case);
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
632 fprintf(stderr, "ELINE : \"%s\"\n", error_line);
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
633 fprintf(stderr, "EFILE : \"%s\"\n", error_file);
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
634 fprintf(stderr, "GDB Scri: \"%s\"\n", gdb_script);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
635 fprintf(stderr, "GDB Patt: \"%s\"\n", gdb_pattern_raw);
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
636 #endif
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
637
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
638 /* start working */
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
639 if(modus==COMPILE || modus==NOCOMPILE){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
640 /* gen command */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
641 buffer = malloc(strlen(compiler)+strlen(cmd_arg_general)+strlen(cmd_arg_case)+strlen(OBJ)
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
642 +strlen(case_file)+strlen(TLOG)+64);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
643 buffer[0]='\x00';
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
644 strcat(buffer, compiler);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
645 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
646 strcat(buffer, cmd_arg_general);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
647 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
648 strcat(buffer, cmd_arg_case);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
649 strcat(buffer, " -c ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
650 if(NULL==strstr(buffer, "-od")){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
651 strcat(buffer, OBJ);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
652 strcat(buffer, " ");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
653 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
654 strcat(buffer, case_file);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
655 strcat(buffer, " 1> ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
656 strcat(buffer, TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
657 strcat(buffer, " 2>&1");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
658
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
659 /* test */
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
660 if(modus==COMPILE){
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
661 fprintf(stderr, "compile: %s\n", buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
662 }else{
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
663 fprintf(stderr, "nocompile: %s\n", buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
664 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
665 res = crashRun(buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
666
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
667 /* diagnostic */
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
668 buffer = loadFile(TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
669 fprintf(stderr, "%s\n", buffer);
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
670 good_error = checkErrorMessage(error_file, error_line, buffer);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
671
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
672 if(hadExecCrash(buffer)){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
673 printf("ERROR:\t%s [internal compiler error]\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
674 }else if(modus==COMPILE){
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
675 if(res==EXIT_SUCCESS){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
676 printf("PASS: \t%s\n", case_file);
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
677 }else if(res==EXIT_FAILURE && good_error){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
678 if(checkErrorMessage(case_file, "", buffer)){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
679 printf("FAIL: \t%s\n", case_file);
373
177ce8d13eac test cases that unexpectetly fail and in addition fail to provide file/line information are now treated as ERROR instead of FAIL
thomask
parents: 361
diff changeset
680 }else{
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
681 printf("ERROR:\t%s [bad error message]\n", case_file);
373
177ce8d13eac test cases that unexpectetly fail and in addition fail to provide file/line information are now treated as ERROR instead of FAIL
thomask
parents: 361
diff changeset
682 }
437
1b4034b27e93 added "[bad error message]" output
thomask
parents: 436
diff changeset
683 }else if(good_error){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
684 printf("ERROR:\t%s\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
685 }else{
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
686 printf("ERROR:\t%s [bad error message]\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
687 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
688 }else{
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
689 if(res==EXIT_FAILURE){
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
690 if(good_error){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
691 printf("XFAIL:\t%s\n", case_file);
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
692 }else{
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
693 printf("FAIL: \t%s [bad error message]\n", case_file);
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
694 }
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
695 }else if(res==EXIT_SUCCESS){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
696 printf("XPASS:\t%s\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
697 }else{
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
698 printf("ERROR:\t%s\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
699 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
700 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
701 fprintf(stderr,"--------\n");
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
702 }else if(modus==RUN || modus==NORUN){
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
703 /* gen command */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
704 buffer = malloc(strlen(compiler)+strlen(cmd_arg_general)+strlen(cmd_arg_case)+strlen(OBJ)
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
705 +strlen(case_file)*2+strlen(TLOG)+64);
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
706 strcpy(buffer, compiler);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
707 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
708 strcat(buffer, cmd_arg_general);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
709 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
710 strcat(buffer, cmd_arg_case);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
711 strcat(buffer, " ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
712 if(NULL==strstr(buffer, "-od")){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
713 strcat(buffer, OBJ);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
714 strcat(buffer, " ");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
715 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
716 if(NULL==strstr(buffer, "-of")){
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
717 strcat(buffer, "-of");
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
718 strcat(buffer, case_file);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
719 strcat(buffer, ".exe ");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
720 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
721 strcat(buffer, case_file);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
722 strcat(buffer, " 1> ");
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
723 strcat(buffer, TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
724 strcat(buffer, " 2>&1");
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
725
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
726 /* test 1/3 - compile */
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
727 if(modus==RUN){
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
728 fprintf(stderr, "run: %s\n", buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
729 }else{
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
730 fprintf(stderr, "norun: %s\n", buffer);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
731 }
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
732 res = crashRun(buffer);
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
733
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
734 /* diagnostic 1/3 */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
735 buffer = loadFile(TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
736 fprintf(stderr, "%s", buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
737 good_error = checkErrorMessage(error_file, error_line, buffer);
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
738 if(hadExecCrash(buffer)){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
739 printf("ERROR:\t%s [internal compiler error]\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
740 fprintf(stderr, "\n--------\n");
437
1b4034b27e93 added "[bad error message]" output
thomask
parents: 436
diff changeset
741 return EXIT_SUCCESS;
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
742 }else if(res==EXIT_FAILURE && good_error){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
743 printf("FAIL: \t%s\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
744 fprintf(stderr, "\n--------\n");
437
1b4034b27e93 added "[bad error message]" output
thomask
parents: 436
diff changeset
745 return EXIT_SUCCESS;
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
746 }else if(res!=EXIT_SUCCESS){
437
1b4034b27e93 added "[bad error message]" output
thomask
parents: 436
diff changeset
747 if(good_error){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
748 printf("ERROR:\t%s\n", case_file);
437
1b4034b27e93 added "[bad error message]" output
thomask
parents: 436
diff changeset
749 }else{
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
750 printf("ERROR:\t%s [bad error message]\n", case_file);
437
1b4034b27e93 added "[bad error message]" output
thomask
parents: 436
diff changeset
751 }
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
752 fprintf(stderr, "\n--------\n");
437
1b4034b27e93 added "[bad error message]" output
thomask
parents: 436
diff changeset
753 return EXIT_SUCCESS;
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
754 }
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
755
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
756 /* test 2/3 - run */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
757 buffer = malloc(strlen(case_file) + strlen(TLOG) + 30);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
758 sprintf(buffer, "%s.exe 1> %s 2>&1\x00\n", case_file, TLOG);
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
759 fprintf(stderr, "%s\n", buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
760 res=crashRun(buffer);
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
761
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
762 /* diagnostic 2/3 */
339
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
763 buffer = loadFile(TLOG);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
764 fprintf(stderr, "%s\n", buffer);
a74c84e75682 added error line tests (__DSTRESS_ELINE__ / __DSTRESS_EFILE__)
thomask
parents: 292
diff changeset
765 good_error = checkRuntimeErrorMessage(error_file, error_line, buffer);
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
766
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
767 #ifdef REG_EXTENDED
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
768 if(good_error && !good_gdb){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
769 /* test 3/3 - gdb */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
770 writeFile(GDB_SCRIPTER, gdb_script);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
771 buffer = malloc(strlen(gdb) + strlen(case_file) + strlen(GDB_SCRIPTER) + strlen(TLOG) + 20);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
772 sprintf(buffer, "%s %s.exe < %s > %s 2>&1", gdb, case_file, GDB_SCRIPTER, TLOG);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
773 fprintf(stderr, "%s\n", buffer);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
774 if(EXIT_SUCCESS==crashRun(buffer)){
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
775 /* diagnostic 3/3 */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
776 buffer = loadFile(TLOG);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
777 fprintf(stderr, "%s\n", buffer);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
778 good_gdb = (regexec(gdb_pattern, buffer, 0, NULL, 0)==0);
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
779 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
780 }
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
781 #endif /* REG_EXTENDED */
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
782
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
783 if(modus==RUN){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
784 if(hadExecCrash(buffer)){
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
785 printf("ERROR:\t%s [test case crash]%s%s", case_file, errorMsg(good_error), gdbMsg(good_gdb));
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
786 }else if(res==EXIT_SUCCESS && good_gdb){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
787 printf("PASS: \t%s\n", case_file);
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
788 }else if(res==EXIT_FAILURE && good_error && good_gdb){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
789 printf("FAIL: \t%s\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
790 }else{
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
791 printf("ERROR:\t%s%s%s\n", case_file, errorMsg(good_error), gdbMsg(good_gdb));
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
792 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
793 }else{
490
d091ff903fa4 added crashRun for POSIX systems
thomask
parents: 476
diff changeset
794 if(res==EXIT_FAILURE){
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
795 if(good_error && good_gdb){
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
796 printf("XFAIL:\t%s\n", case_file);
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
797 }else{
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
798 printf("FAIL:\t%s%s%s\n", case_file, errorMsg(good_error), gdbMsg(good_gdb));
361
0147a35cbeb7 dif. fixes 5
thomask
parents: 340
diff changeset
799 }
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
800 }else if(res==EXIT_SUCCESS && good_error && good_gdb){
499
0434764d4a66 removed redundancy in the output
thomask
parents: 493
diff changeset
801 printf("XPASS:\t%s\n", case_file);
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
802 }else{
620
03ad4005cd8e POSIX only: added __GDB_SCRIPT__ and __GDB__PATTERN__ support
thomask
parents: 499
diff changeset
803 printf("ERROR:\t%s%s%s\n", case_file, errorMsg(good_error), gdbMsg(good_gdb));
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
804 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
805 }
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
806 fprintf(stderr, "--------\n");
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
807 }else{
438
27039d5cbe81 partial cleanup for Windows(dmc)
thomask
parents: 437
diff changeset
808 printf("@bug@ %d (%s)\n", modus, case_file);
436
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
809 return EXIT_FAILURE;
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
810 }
436
5e210bace0f1 added "File not found" clause
thomask
parents: 432
diff changeset
811 return EXIT_SUCCESS;
251
6cd84461e17b enabled new "dstress.c" test tool
thomask
parents:
diff changeset
812 }