From: Jean-Marc Pigeon (Delson) Date: Tue, 25 Mar 2025 22:41:45 +0000 (-0400) Subject: Improving the debug function within Makefile X-Git-Tag: tag-0.7~63 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=a057c3e9217bd58d95bf6a39886d3840422bf211;p=jmp%2Fmailleur Improving the debug function within Makefile --- diff --git a/Makefile b/Makefile index c9b0917..50f47a2 100644 --- a/Makefile +++ b/Makefile @@ -32,7 +32,7 @@ TESTPORT= 1025 #-------------------------------------------------------------------- #testing feed FEEDPAR = \ - -d 3 \ + -d3 \ $(TESTIP) \ $(TESTPORT) \ $(TESTDIR)/$(DATATST)/feed*.tst \ @@ -42,7 +42,7 @@ tstfeed : debug @ bin/feeder $(FEEDPAR) #using gdb -gdbfeed : debug +dbgfeed : debug @ gdb --args \ bin/feeder $(FEEDPAR) @@ -50,17 +50,47 @@ gdbfeed : debug #starting email receiver EMLPAR = \ - -r $(TSTDIR) \ - -d 8 \ + -r $(TESTDIR) \ + -d8 \ :$(TESTIP):$(TESTPORT) \ emlrcvr : debug newtest @ echo @ echo "--------------" @ echo "starting $@" - @ bin/$@ $(EMLPAR) + @ $(TESTDIR)/$(SBINDIR)/$@ $(EMLPAR) @ echo "--------------" - + +valrcvr : clean debug newtest #valgrin dest + @ echo "emlrec valgrind test" + @ valgrind \ + --leak-check=full \ + --show-leak-kinds=all \ + --track-origins=yes \ + --trace-children=no \ + --track-fds=yes \ + $(TESTDIR)/$(SBINDIR)/emlrcvr \ + -f \ + $(EMLPAR) + +dbgrcvr : clean debug newtest #using gdb + @ gdb --args \ + $(TESTDIR)/$(SBINDIR)/emlrcvr \ + -f \ + $(EMLPAR) + +#-------------------------------------------------------------------- +#preparing a test area +newtest : deltest +#-------------------------------------------------------------------- +#test procedure +#-------------------------------------------------------------------- +tstspf : clean debug + @ shell/test-spf.sh data-tst/spf.tst + +#todo a specfic test +DATA = chkaddr.spf.example.com 127.0.1.255 + #-------------------------------------------------------------------- #preparing a test area newtest : deltest @@ -68,7 +98,7 @@ newtest : deltest @ mkdir -p $(TESTDIR)/var/spool/clement/{in,out}-logs @ mkdir -p $(TESTDIR)/$(SBINDIR) @ cp -a \ - bin/{chkspf,emlrcvr,maild} \ + bin/{chkspf,emlrcvr} \ $(TESTDIR)/$(SBINDIR) @ cp -a \ $(DATATST) \ @@ -77,21 +107,6 @@ newtest : deltest deltest : @ rm -fr $(TSTDIR) -#-------------------------------------------------------------------- -#test procedure -#-------------------------------------------------------------------- -test : clean debug - @ shell/test-spf.sh data-tst/spf.tst - -#todo a specfic test -DATA = chkaddr.spf.example.com 127.0.1.255 -dbgtst : debug - @ echo "doing chkspf with \"$(DATA)\"" - @ valgrind \ - --leak-check=full \ - --show-leak-kinds=all \ - ./bin/chkspf $(DATA) - #-------------------------------------------------------------------- #Installation procedure #-------------------------------------------------------------------- @@ -107,3 +122,7 @@ SUBDIR = \ #definitions globale APPNAME = MAILLEUR #-------------------------------------------------------------------- +#Managing testarea +SBINDIR = usr/sbin +CURDIR = `pwd` +#=================================================================== diff --git a/app/Makefile b/app/Makefile index 4b08821..ffae341 100644 --- a/app/Makefile +++ b/app/Makefile @@ -23,13 +23,11 @@ clean : EXE= \ emlrcvr \ feeder \ - maild \ chkspf \ SRC= \ emlrcvr.c \ freeder.c \ - maild.c \ chkspf.c \ #-------------------------------------------------------------------- @@ -52,9 +50,6 @@ emlrcvr : toremake emlrcvr.o feeder : toremake feeder.o @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS) -maild : toremake maild.o - @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS) - chkspf : toremake chkspf.o @ $(LD) $(LDFLAGS) -o ../bin/$@ $@.o $(LIBS) @@ -75,13 +70,6 @@ feeder.o: feeder.c \ ../lib/subrou.h -maild.o : maild.c \ - ../lib/uniprc.h \ - ../lib/unisig.h \ - ../lib/unipar.h \ - ../lib/subrou.h \ - - toremake: Makefile $(LIBAI) touch toremake - rm -f $(EXE) *.o diff --git a/app/emlrcvr.c b/app/emlrcvr.c index c8b93ca..e02ddd0 100644 --- a/app/emlrcvr.c +++ b/app/emlrcvr.c @@ -60,6 +60,8 @@ while (proceed==true) { (void) sig_trapsignal(true,sig_alrm); break; case 2 : //doing main task + if (foreground==true) + (void) fprintf(stdout,"Running application in foreground\n"); (void) rec_handlesmtp(params->argc,params->argv); break; case 3 : //doing main task diff --git a/app/maild.c b/app/res/maild.c similarity index 100% rename from app/maild.c rename to app/res/maild.c diff --git a/lib/modrec.c b/lib/modrec.c index ba1022d..3b1b9b8 100644 --- a/lib/modrec.c +++ b/lib/modrec.c @@ -106,7 +106,7 @@ return rou_nbrlist(*bindings); /* a remote TCP connection. */ /* */ /********************************************************/ -void docontact(SOCPTR *socptr,int pos) +static void docontact(SOCPTR *socptr,int pos) { #define OPEP "modrec.c:contact" @@ -189,7 +189,13 @@ while (proceed==true) { else proceed=false; //Empty Soc!?! break; - case 1 : //check need to dispatch a process + case 1 : //empty phase + if (foreground==true) { + (void) docontact(socptr,1); + phase++; //no fork + } + break; + case 2 : //check need to dispatch a process for (int i=0;i)", + OPEP,strerror(errno)); + childs[i]=(pid_t)0; + (void) sleep(1); //Weathering the storm + break; + case 0 : //Child process itself + (void) startwaiter(bindings[i]); + break; + default : //Main process + (void) usleep(10000); + break; } - (void) usleep(10000); //avoid avalanche } break; - case 3 : //relax time + case 4 : //relax time (void) sleep(5); //Waiting for signal if ((hangup==false)&&(reload==false)) phase=0; //Normal process, lets restart break; - case 4 : //we got a signal, kill all childs + case 5 : //we got a signal, kill all childs (void) prc_killchilds(childs,nbrbind,10); break; default : //SAFE Guard diff --git a/lib/subrou.c b/lib/subrou.c index d49c119..2950616 100644 --- a/lib/subrou.c +++ b/lib/subrou.c @@ -21,7 +21,7 @@ //version definition #define VERSION "0.6" -#define RELEASE "11" +#define RELEASE "12" //Public variables PUBLIC int debug=0; //debug level diff --git a/vgcore.4405 b/vgcore.4405 new file mode 100644 index 0000000..af9c107 Binary files /dev/null and b/vgcore.4405 differ