Only adnstest has an exit status which is compatible with the test
harness's ideas. adnshost, in particular, uses `5' (skipped test) for
something else (worst failure was misconfig).
So we need to have two exit statuses, that of the program and that of
the test harness machinery. To this end:
* Enhance the syscall emulation of exit to record the exit status as a
normal syscall argument. This has to be done slightly ad hoc
because the hm_hsyscall macro cannot sanely generate nonreturning
calls. After this has been recorded, we do the shutdown activities
as before and exit the test harness with status 0.
* The previous shutdown function (now the core of the exit emulation)
is made available as Texit.
* adnstest (only) has a special test-harness-specific override to use
the core, so a call to exit is not recorded and instead adnstest's
exit status is that of the harness.
* Update all adnshost-based test cases to match. This was done with
this shell script (run once for each test, as needed):
#!/bin/sh
f=$1
o=${f%.sys}.out
rc=`sed -n '$s/^rc=//p' $o`
sed -e '$s/^rc=.*/rc=0/' $o >$o.new
mv $o.new $o
echo " exit $rc" >>$f
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
24 files changed:
#ifdef ADNS_REGRESS_TEST
# include "hredirect.h"
#ifdef ADNS_REGRESS_TEST
# include "hredirect.h"
+# undef exit
+# define exit Texit
close fd=6
close=OK
+0.000961
close fd=6
close=OK
+0.000961
close fd=6
close=OK
+0.000149
close fd=6
close=OK
+0.000149
close fd=6
close=OK
+0.000686
close fd=6
close=OK
+0.000686
close fd=4
close=OK
+0.000290
close fd=4
close=OK
+0.000290
close fd=6
close=OK
+0.000134
close fd=6
close=OK
+0.000134
close fd=6
close=OK
+0.000090
close fd=6
close=OK
+0.000090
close fd=6
close=OK
+0.000117
close fd=6
close=OK
+0.000117
close fd=6
close=OK
+0.000134
close fd=6
close=OK
+0.000134
close fd=6
close=OK
+0.000091
close fd=6
close=OK
+0.000091
close fd=6
close=OK
+0.006908
close fd=6
close=OK
+0.006908
close fd=6
close=OK
+0.004680
close fd=6
close=OK
+0.004680
close fd=6
close=OK
+0.000078
close fd=6
close=OK
+0.000078
close fd=6
close=OK
+0.014060
close fd=6
close=OK
+0.014060
close fd=6
close=OK
+0.000187
close fd=6
close=OK
+0.000187
close fd=6
close=OK
+0.002395
close fd=6
close=OK
+0.002395
close fd=6
close=OK
+0.000144
close fd=6
close=OK
+0.000144
extern vbuf vb;
extern struct timeval currenttime;
extern const struct Terrno { const char *n; int v; } Terrnos[];
extern vbuf vb;
extern struct timeval currenttime;
extern const struct Terrno { const char *n; int v; } Terrnos[];
+/* Special cases */
+void Texit(int rv) NONRETURNING;
extern vbuf vb;
extern struct timeval currenttime;
extern const struct Terrno { const char *n; int v; } Terrnos[];
extern vbuf vb;
extern struct timeval currenttime;
extern const struct Terrno { const char *n; int v; } Terrnos[];
+void Texit(int rv) NONRETURNING;
+
struct malloced *loopnode;
Tshutdown();
adns__vbuf_free(&vb);
struct malloced *loopnode;
Tshutdown();
adns__vbuf_free(&vb);
+void Hexit(int rv) {
+ vb.used= 0;
+ Tvbf("exit %d", rv);
+ Q_vb();
+ Texit(0);
+}
pid_t Hgetpid(void) {
return 2264; /* just some number */
}
pid_t Hgetpid(void) {
return 2264; /* just some number */
}
struct malloced *loopnode;
Tshutdown();
struct malloced *loopnode;
Tshutdown();
+void Hexit(int rv) {
+ vb.used= 0;
+ Tvbf("exit %d", rv);
+ Q_vb();
+ Texit(0);
+}
+
pid_t Hgetpid(void) {
return 2264; /* just some number */
}
pid_t Hgetpid(void) {
return 2264; /* just some number */
}
--- /dev/null
+#!/bin/sh
+f=$1
+o=${f%.sys}.out
+rc=`sed -n '$s/^rc=//p' $o`
+sed -e '$s/^rc=.*/rc=0/' $o >$o.new
+mv $o.new $o
+echo " exit $rc" >>$f