From 5c3871ea5553f2e129bb6a17fcc887c5f79e9764 Mon Sep 17 00:00:00 2001 From: "Jean-Marc Pigeon (Delson)" Date: Tue, 1 Apr 2025 16:01:56 -0400 Subject: [PATCH] Adding test description to test file --- app/feeder.c | 20 ++++++++++++++++++-- data-tst/feed00.tst | 2 ++ lib/subrou.c | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/app/feeder.c b/app/feeder.c index f651f75..0939ebe 100644 --- a/app/feeder.c +++ b/app/feeder.c @@ -23,6 +23,8 @@ #define FNAME "feeder" +static char titre[100]; //test title +static char testname[100]; //dest description /* */ @@ -137,7 +139,8 @@ while (proceed==true) { break; case 2 : //get available character if (strncmp(line,received,tocheck)!=0) { - (void) rou_alert(0,"Line %04d: Error!",numline); + (void) rou_alert(0,"\n%s\tline %04d, fatal error! (on %s)", + titre,numline,testname); (void) rou_alert(0,"expecting\t'%s'",line); (void) rou_alert(0,"found\t\t'%s'",received); phase=999; @@ -194,6 +197,9 @@ while (proceed==true) { break; case 2 : //discarding comment switch (line[0]) { + case 'T' : //Get the test titre + status=strncpy(testname,line+2,sizeof(testname)); + break; case 'R' : //Receiving data status=doincoming(socptr,numline,line+2); break; @@ -234,6 +240,7 @@ int phase; _Bool proceed; status=false; +(void) strcpy(testname,""); fichier=(FILE *)0; numline=0; (void) strcpy(line,""); @@ -243,7 +250,16 @@ while (proceed==true) { //(void) rou_alert(0,"JMPDBG scanfile phase='%d'",phase); switch (phase) { case 0 : //checking parameters - (void) fprintf(stdout,"Scanning file <%s>\n",filename); + (void) rou_alert(0,"Scanning file <%s>",filename); + if (filename!=(char *)0) { + const char *ptr; + + if ((ptr=strrchr(filename,'/'))!=(const char *)0) + ptr++; + else + ptr=filename; + (void) snprintf(titre,sizeof(titre),"%s:",ptr); + } if ((fichier=fopen(filename,"r"))==(FILE *)0) { (void) rou_alert(0,"Unable to open file <%s> (error=<%s>", filename,strerror(errno)); diff --git a/data-tst/feed00.tst b/data-tst/feed00.tst index 6f31b40..82cbe58 100644 --- a/data-tst/feed00.tst +++ b/data-tst/feed00.tst @@ -5,6 +5,8 @@ # # comment # R: incoming data # S: outgoing data +# T: Test titre +T:basic test function R:220 emlrcvr ESMTP emlrcvr... S:EHLO example.com R:250-emlrcvr ready, your IP/FQDN=[127.0.0.1/localhost.localdomain] diff --git a/lib/subrou.c b/lib/subrou.c index cf8037e..4b3077b 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -21,7 +21,7 @@ //version definition #define VERSION "0.6" -#define RELEASE "39" +#define RELEASE "40" #define BRANCH "dvl" //Public variables -- 2.47.3