From: bernhardheld Date: Sun, 21 Oct 2001 20:53:04 +0000 (+0000) Subject: * support/regression/Makefile: Improved clean X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=98db30348e2ea36fa873f7e501e119b2623c6124;p=fw%2Fsdcc * support/regression/Makefile: Improved clean * support/regression/ports/gbz80/spec.mk: Added clean * support/regression/ports/host/spec.mk: Added clean * support/regression/ports/z80/spec.mk: Added clean * support/regression/ports/mcs51/spec.mk: Added clean, little improvements * support/regression/ports/mcs51/timeout.c: little improvements git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1425 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index 865e94e7..df6a9108 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2001-10-21 Bernhard Held + + * support/regression/Makefile: Improved clean + + * support/regression/ports/gbz80/spec.mk: Added clean + + * support/regression/ports/host/spec.mk: Added clean + + * support/regression/ports/z80/spec.mk: Added clean + + * support/regression/ports/mcs51/spec.mk: Added clean, little improvements + + * support/regression/ports/mcs51/timeout.c: little improvements + + 2001-10-16 Bernhard Held * support/regression/port/mcs51/spec.mk: add timeout for uCsim diff --git a/support/regression/Makefile b/support/regression/Makefile index 32e93fbf..92057a7e 100644 --- a/support/regression/Makefile +++ b/support/regression/Makefile @@ -63,6 +63,9 @@ GENERATE_CASES = generate-cases.py # files and how to run the emulator. ALL_PORTS = $(filter-out CVS mcs51 gbz80,$(notdir $(wildcard $(PORTS_DIR)/*))) +# These ports will be cleaned with 'make clean' +CLEAN_PORTS = $(filter-out CVS,$(notdir $(wildcard $(PORTS_DIR)/*))) + all: test-ports # Test all of the ports @@ -179,8 +182,10 @@ $(RESULTS): $(SUB_RESULTS) # BeginGeneric rules -clean: +clean: inter-port-clean rm -rf $(CASES_DIR) $(RESULTS_DIR) *.pyc + for i in $(CLEAN_PORTS); do $(MAKE) -f $(PORTS_DIR)/$$i/spec.mk _clean PORT=$$i; done inter-port-clean: - rm -f fwk/lib/*.o fwk/lib/*.asm fwk/lib/*.rst fwk/lib/*.lst fwk/lib/*.rel + rm -f fwk/lib/*.o fwk/lib/*.asm fwk/lib/*.rst fwk/lib/*.lst fwk/lib/*.rel \ + fwk/lib/*.ihx fwk/lib/*.map fwk/lib/*.sym diff --git a/support/regression/ports/gbz80/spec.mk b/support/regression/ports/gbz80/spec.mk index d8b33ede..4b9c5c58 100644 --- a/support/regression/ports/gbz80/spec.mk +++ b/support/regression/ports/gbz80/spec.mk @@ -28,3 +28,6 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) $(EMU) -m $< > $@ -grep -n FAIL $@ /dev/null || true +_clean: + rm -f ports/$(PORT)/*.lst ports/$(PORT)/*.o ports/$(PORT)/*.sym + diff --git a/support/regression/ports/host/spec.mk b/support/regression/ports/host/spec.mk index 0e03a3f4..9471f7e9 100644 --- a/support/regression/ports/host/spec.mk +++ b/support/regression/ports/host/spec.mk @@ -17,3 +17,7 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) %$(OBJEXT): %.c fwk/include/*.h $(SDCC) $(SDCCFLAGS) -c $< -o $@ + +_clean: + rm -f ports/$(PORT)/support.o + diff --git a/support/regression/ports/mcs51/spec.mk b/support/regression/ports/mcs51/spec.mk index 1c76314e..071d08ee 100644 --- a/support/regression/ports/mcs51/spec.mk +++ b/support/regression/ports/mcs51/spec.mk @@ -11,7 +11,7 @@ EXEEXT = .ihx EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) # Rule to link into .ihx -%.ihx: %$(OBJEXT) $(EXTRAS) +%$(EXEEXT): %$(OBJEXT) $(EXTRAS) $(SDCC) $(SDCCFLAGS) $(EXTRAS) $< mv fwk/lib/testfwk.ihx $@ mv fwk/lib/testfwk.map $(@:.ihx=.map) @@ -22,7 +22,14 @@ EXTRAS = fwk/lib/testfwk$(OBJEXT) ports/$(PORT)/support$(OBJEXT) # run simulator with 5 seconds timeout %.out: %$(EXEEXT) ports/$(PORT)/timeout mkdir -p `dirname $@` - -ports/$(PORT)/timeout 5 $(S51) -t32 -S in=/dev/null,out=$@ $< < ports/mcs51/uCsim.cmd >/dev/null 2>&1 || \ + -ports/$(PORT)/timeout 5 $(S51) -t32 -S in=/dev/null,out=$@ $< < ports/mcs51/uCsim.cmd >/dev/null || \ echo -e --- FAIL: \"timeout, simulation killed\" in $(<:.ihx=.c)"\n"--- Summary: 1/1/1: timeout >> $@ -grep -n FAIL $@ /dev/null || true +ports/$(PORT)/timeout: ports/$(PORT)/timeout.c + gcc -o $@ $< + +_clean: + rm -f ports/$(PORT)/timeout ports/$(PORT)/*.rel ports/$(PORT)/*.rst ports/$(PORT)/*.lst \ + ports/$(PORT)/*.sym ports/$(PORT)/*.asm + diff --git a/support/regression/ports/mcs51/timeout.c b/support/regression/ports/mcs51/timeout.c index 4b6b5e25..a768ffe5 100644 --- a/support/regression/ports/mcs51/timeout.c +++ b/support/regression/ports/mcs51/timeout.c @@ -66,14 +66,6 @@ sigchld_handler (int signum) int pid; int status; int exit_status = 0; - struct rlimit rl; - - /* remove limitation for CPU time */ - if (getrlimit (RLIMIT_CPU, &rl) == 0) - { - rl.rlim_cur = rl.rlim_max; - setrlimit (RLIMIT_CPU, &rl); - } while (1) { @@ -93,6 +85,7 @@ main (int argc, char * const *argv) { /* if getrlimit() / setrlimit() succeed, then no fork is neeeded */ int flagNoFork = 0; + int old_stderr; long timeout; pid_t pid_child; struct rlimit rl; @@ -119,18 +112,48 @@ main (int argc, char * const *argv) } if (flagNoFork) - /* the CPU-time is limited: simple execvp */ - return execvp (argv[2], argv + 2); + { /* the CPU-time is limited: simple execvp */ + + /* s51 prints warnings on stderr: */ + /* serial input/output interface connected to a non-terminal file. */ + /* We'll redirect here stderr to stdout, which will be redirected */ + /* to /dev/null by the shell. The shell could also redirect stderr */ + /* to /dev/null, but then this program doesn't have the chance to */ + /* output any real error. */ + old_stderr = dup (STDERR_FILENO); + dup2 (STDOUT_FILENO, STDERR_FILENO); + /* shouldn't return */ + execvp (argv[2], argv + 2); + /* restore stderr */ + dup2 (old_stderr, STDERR_FILENO); + perror (argv[2]); + return 1; /* Error */ + } else { /* do it the hard way: fork/exec */ signal (SIGCHLD, sigchld_handler); pid_child = fork(); if (pid_child == 0) - return execvp (argv[2], argv + 2); + { + /* s51 prints warnings on stderr: */ + /* serial input/output interface connected to a non-terminal file. */ + /* We'll redirect here stderr to stdout, which will be redirected */ + /* to /dev/null by the shell. The shell could also redirect stderr */ + /* to /dev/null, but then this program doesn't have the chance to */ + /* output any real error. */ + old_stderr = dup (STDERR_FILENO); + dup2 (STDOUT_FILENO, STDERR_FILENO); + /* shouldn't return */ + execvp (argv[2], argv + 2); + /* restore stderr */ + dup2 (old_stderr, STDERR_FILENO); + perror (argv[2]); + return 1; /* Error */ + } else { - /* this timeout is hopefully aborted by a SIGCHLD */ + /* this timeout is hopefully aborted by a SIGCHLD */ sleep (timeout); fprintf (stderr, PROGNAME ": timeout, killing child %s\n", argv[2]); kill (pid_child, SIGTERM); diff --git a/support/regression/ports/z80/spec.mk b/support/regression/ports/z80/spec.mk index 66e9d86d..b14249d4 100644 --- a/support/regression/ports/z80/spec.mk +++ b/support/regression/ports/z80/spec.mk @@ -36,3 +36,6 @@ fwk/lib/testfwk$(OBJEXT): fwk/lib/testfwk.c $(RRZ80) --maxruntime=3 --mapfile=$(<:.bin=.sym) $< > $@ -grep -n FAIL $@ /dev/null || true +_clean: + rm -f ports/$(PORT)/*.lst ports/$(PORT)/*.o ports/$(PORT)/*.sym +