+2001-10-21 Bernhard Held <bernhard@bernhardheld.de>
+
+ * 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 <bernhard@bernhardheld.de>
* support/regression/port/mcs51/spec.mk: add timeout for uCsim
# 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
# 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
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)
# 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
+
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)
{
{
/* if getrlimit() / setrlimit() succeed, then no fork is neeeded */
int flagNoFork = 0;
+ int old_stderr;
long timeout;
pid_t pid_child;
struct rlimit rl;
}
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);