# HG changeset patch # User thomask # Date 1113555300 0 # Node ID db4b6169a99dffc9ccf6c45b48ded72f3e05bd0d # Parent 61ec77e09b1ee551dd08a595072fba65faae79d6 1) implemented checkRuntimeErrorMessage 2) fixed norun test cases diff -r 61ec77e09b1e -r db4b6169a99d dstress.c --- a/dstress.c Fri Apr 15 01:59:35 2005 +0000 +++ b/dstress.c Fri Apr 15 08:55:00 2005 +0000 @@ -24,6 +24,8 @@ * */ +// Beware: the code doesn't care about freeing allocated memory + #include #include #include @@ -166,7 +168,7 @@ if(back == NULL){ back = getenv("dflags"); if(back==NULL){ - back = ""; + back = calloc(1,1); } } return back; @@ -267,8 +269,7 @@ strcat(gdc, line); strcat(gdc, ": "); }else{ - dmd=NULL; - gdc=NULL; + return 1; } /* fix filenames */ @@ -300,12 +301,126 @@ back=1; } - /* @todo@ check format of all other messages */ return back; } -int checkRuntimeErrorMessage(const char* file, const char* line, const char* buffer){ - /* @todo@ */ +int checkRuntimeErrorMessage(const char* file_, const char* line_, const char* buffer){ + // Phobos(dmd & gdc): dir/file.d(2) + + char* file; + char* line; + char* phobos; + char* phobosLong; + + char* begin; + char* end1; + char* end2; + + int back=0; + + /* clean arguments */ + if(strcmp(file_, "")!=0){ + file = malloc(strlen(file_)+1); + strcpy(file, file_); + }else{ + file=NULL; + } + + if(strcmp(line_, "")!=0){ + line = malloc(strlen(line_)+1); + strcpy(line, line_); + }else{ + line=NULL; + } + + /* gen patterns*/ + if(file!=NULL){ + if(line!=NULL){ + phobos = malloc(strlen(file)+strlen(line)+5); + phobos[0]='\x00'; + if(begin=rindex(file,'/')){ + begin++; + }else if(begin=rindex(file,'\\')){ + begin++; + }else{ + begin=file; + } + end1=rindex(file,'.'); + strncat(phobos, begin, end1-begin); + strcat(phobos, "("); + strcat(phobos, line); + strcat(phobos, ")"); + + phobosLong = malloc(strlen(file)+strlen(line)+5); + phobosLong[0]='\x00'; + strcat(phobosLong, file); + strcat(phobosLong, "("); + strcat(phobosLong, line); + strcat(phobosLong, ")"); + + }else{ + phobos = malloc(strlen(file)+2); + phobos[0]='\x00'; + if(begin=rindex(file,'/')){ + begin++; + }else if(begin=rindex(file,'\\')){ + begin++; + }else{ + begin=file; + } + end1=rindex(file,'.'); + strncat(phobos, begin, end1-begin); + strcat(phobos, "("); + + phobosLong = malloc(strlen(file)+2); + phobosLong[0]='\x00'; + strcat(phobosLong, file); + strcat(phobosLong, "("); + } + }else if(line!=NULL){ + phobos = malloc(strlen(line)+3); + phobos[0]='\x00'; + strcat(phobos, "("); + strcat(phobos, line); + strcat(phobos, ")"); + + phobosLong=NULL; + }else{ + return 1; + } + + /* fix filenames */ +#ifdef WIN32 + end1="/"; + end2="\\"; +#else + end1="\\"; + end2="/"; +#endif + + if(phobos){ + while( (begin=strchr(phobos, end1[0])) ){ + begin[0]=end2[0]; + } + } + + if(phobosLong){ + while( (begin=strchr(phobosLong, end1[0])) ){ + begin[0]=end2[0]; + } + while(phobosLong[0]==end2[0]){ + phobosLong++; + } + } + /* specific error messages */ + + if( (phobos && strstr(buffer, phobos)) + || (phobosLong && strstr(buffer, phobosLong))) + { + back=1; + } + + return back; return 1; } @@ -524,6 +639,7 @@ fprintf(stderr, "--------\n"); }else{ printf("@bug@ %d (%s)\n", modus, arg[2]); + return -1; } return 0; } diff -r 61ec77e09b1e -r db4b6169a99d norun/auto_05.d --- a/norun/auto_05.d Fri Apr 15 01:59:35 2005 +0000 +++ b/norun/auto_05.d Fri Apr 15 08:55:00 2005 +0000 @@ -6,7 +6,7 @@ // @date@ 2005-03-25 // @uri@ news:d2175a$2u8h$1@digitaldaemon.com -// __DSTRESS_ELINE__ 27 +// __DSTRESS_ELINE__ 23 module dstress.norun.auto_05; @@ -20,11 +20,11 @@ void autotest(){ auto AutoClass c = new AutoClass(); - b = c; // this should be forbidden? + b = c; // this should be forbidden } int main(){ autotest(); b.test(); // "access violation" - return 1; -} \ No newline at end of file + return 0; +} diff -r 61ec77e09b1e -r db4b6169a99d norun/main_05.d --- a/norun/main_05.d Fri Apr 15 01:59:35 2005 +0000 +++ b/norun/main_05.d Fri Apr 15 08:55:00 2005 +0000 @@ -2,7 +2,7 @@ // $Date$ // $Author$ -// __DSTRESS_ELINE__ 9 +// __DSTRESS_ELINE__ 10 module dstress.norun.main_05; diff -r 61ec77e09b1e -r db4b6169a99d norun/throw_04.d --- a/norun/throw_04.d Fri Apr 15 01:59:35 2005 +0000 +++ b/norun/throw_04.d Fri Apr 15 08:55:00 2005 +0000 @@ -2,8 +2,6 @@ // $Date$ // $Author$ -// __DSTRESS_ELINE__ - module dstress.norun.throw_04; static ~this(){ @@ -12,4 +10,4 @@ int main(){ return 0; -} \ No newline at end of file +} diff -r 61ec77e09b1e -r db4b6169a99d norun/throw_05.d --- a/norun/throw_05.d Fri Apr 15 01:59:35 2005 +0000 +++ b/norun/throw_05.d Fri Apr 15 08:55:00 2005 +0000 @@ -2,14 +2,12 @@ // $Date$ // $Author$ -// __DSTRESS_ELINE__ +module dstress.norun.throw_05; -module dstress.norun.throw_04; - -static ~this(){ +static this(){ throw new Exception("Message\n"); } int main(){ return 0; -} \ No newline at end of file +} diff -r 61ec77e09b1e -r db4b6169a99d todo.txt --- a/todo.txt Fri Apr 15 01:59:35 2005 +0000 +++ b/todo.txt Fri Apr 15 08:55:00 2005 +0000 @@ -6,7 +6,6 @@ * update/check the Windows bat generator (./beta) dstress.c: -* check messages: compile->generic, runtime->spezific&generic * MSWindows: implement crashRun (stop pop-up for segfaulting test cases / createProcess) Benchmark: