]> SAFE projects GIT repository - jmp/mailleur/commitdiff
Improving test about sorter
authorJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 1 Jun 2025 14:28:41 +0000 (10:28 -0400)
committerJean-Marc Pigeon (Delson) <jmp@safe.ca>
Sun, 1 Jun 2025 14:29:07 +0000 (10:29 -0400)
Makefile
app/sorter.c
lib/geseml.c

index 1bbe724ae6bf6e988ed49dfffae301758fb3e46b..fff124b830bb98563402a156957bad0a14bf2d58 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -45,10 +45,13 @@ sorter      :  clean debug
                data-$@/*                               \
                $(TESTDIR)/var/spool/$(APPNAME)/queue
           @ bin/sorter                                 \
-                  -f                                   \
+                  -f                                   \
                   -d 2                                 \
                   -c ./conf/mailleur.conf.dvl          \
                   -r $(TESTDIR) 
+          @ cp -a                                      \
+               $(TESTDIR)/var/spool/$(APPNAME)/queue/* \
+               ./data-sender/                          \
                
 sorter2        :  clean debug newtest
           @ rm -fr $(TESTDIR)/var/spool/$(APPNAME)/queue
@@ -122,6 +125,8 @@ extfeed     :       debug
                        ./$(DATATST)/extfeed00.tst
 
 onefeed        :  debug
+          @ rm -fr ./data-queue/*
+          @ rm -fr $(TESTDIR)/var/spool/$(APPNAME)/queue/*
           @ bin/feeder                                 \
                        -f                              \
                        -d2                             \
@@ -129,6 +134,11 @@ onefeed    :  debug
                        $(TESTIP)                       \
                        $(TESTPORT)                     \
                        ./$(DATATST)/xxfeed.tst
+          @ rm -fr ./data-sorter/*
+          @ cp -a                                      \
+               $(TESTDIR)/var/spool/$(APPNAME)/queue/* \
+               ./data-sorter
+               
 
 #                      # -i 127.63.31.15
 
@@ -139,9 +149,11 @@ tstfeed    :  debug newtest
           @ bin/feeder                                 \
                          -c ./conf/feeder.conf.dvl     \
                         $(FEEDPAR)
+          @ rm -fr ./data-sorter/*
           @ cp -a                                      \
                $(TESTDIR)/var/spool/$(APPNAME)/queue/* \
-               ./data-queue
+               ./data-sorter
+               
                
 
 #using gdb
@@ -289,7 +301,8 @@ prepare     :  debug newtest
 
 #to kill all remaining emlrcvr process
 killall        :
-         @ kill -9 emlrcvr
+         @ - kill -9 emlrcvr
+         @ - kill -9 sorter
 
 #--------------------------------------------------------------------
 #test procedure
index 768d0e111dc18f1634f687c964e83805b51afe6a..0a5dd482cf4cb1f06029984b3ddafea01d4ff184 100644 (file)
@@ -40,7 +40,7 @@ trans=(TRATYP **)0;
 phase=0;
 proceed=true;
 while (proceed==true) {
-  (void) fprintf(stdout,"%s JMPDBG phase='%d' ext=<%s>\n",OPEP,phase,ext);
+  //(void) fprintf(stdout,"%s JMPDBG phase='%d' ext=<%s>\n",OPEP,phase,ext);
   switch (phase) {
     case 0      :       //Getting the list of file
       fname=eml_getqfilelist(fname,ext);
@@ -106,11 +106,10 @@ _Bool proceed;
 
 status=0;
 params=(ARGTYP *)0;
-foreground=true;
 phase=0;
 proceed=true;
 while (proceed==true) {
-  //(void) fprintf(stdout,"JMPDBG main phase='%d'\n",phase);
+  (void) fprintf(stdout,"JMPDBG main phase='%d' foreground='%d'\n",phase,foreground);
   switch (phase) {
     case 0      :       //checking parameters
       if ((params=par_getparams(argc,argv,"c:d:fhi:r:v"))==(ARGTYP *)0) {
index 0fb2069148dcff2b2c56d02dbbf25b7f374ccc86..e30b1b6d29fac37e9d6a60594f1e76fe1be9f1e1 100644 (file)
@@ -126,15 +126,18 @@ PUBLIC void eml_dumptra(FILE *qfile,TRATYP **tra)
 if (tra!=(TRATYP **)0) {
   if (qfile!=(FILE *)0) {
     (void) fprintf(qfile,"#'C', completed email task\n");
-    (void) fprintf(qfile,"#'D', delayed email\n");
     (void) fprintf(qfile,"#'L', Local email\n");
-    (void) fprintf(qfile,"#'O', Obsolete email\n");
     (void) fprintf(qfile,"#'R', Remote email\n");
+    (void) fprintf(qfile,"#code\tdate\t\tdelay\tsession-id\t\t\t"
+                         "originator\t\trecipient\n");
     }
   while (*tra!=(TRATYP *)0) {
+    char temps[50];
     char line[300];
 
-    (void) snprintf(line,sizeof(line),"%c %lu %04u %s %s %s",
+    (void) strftime(temps,sizeof(temps),"#%Y-%m-%d %H:%M:%S",
+                                        localtime(&((*tra)->date)));
+    (void) snprintf(line,sizeof(line),"%c\t%lu\t%04u\t%s\t%s\t%s",
                                       (*tra)->code,
                                       (*tra)->date,
                                       (*tra)->delay,
@@ -142,10 +145,13 @@ if (tra!=(TRATYP **)0) {
                                       (*tra)->mailfrom,
                                       (*tra)->rcptto
                                       );
-    if (qfile==(FILE *)0) 
+    if (qfile==(FILE *)0)  {
       (void) rou_alert(0,"TRA=<%s>",line);
-    else
+      }
+    else {
+      (void) fprintf(qfile,"%s\n",temps);
       (void) fprintf(qfile,"%s\n",line);
+      }
     tra++;
     }
   }