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"
+# undef exit
+# define exit Texit
#endif
struct myctx {
close fd=6
close=OK
+0.000961
+ exit 0
close fd=6
close=OK
+0.000149
+ exit 0
close fd=6
close=OK
+0.000686
+ exit 0
close fd=4
close=OK
+0.000290
+ exit 0
close fd=6
close=OK
+0.000134
+ exit 0
close fd=6
close=OK
+0.000090
+ exit 0
close fd=6
close=OK
+0.000117
+ exit 0
close fd=6
close=OK
+0.000134
+ exit 0
close fd=6
close=OK
+0.000091
+ exit 6
close fd=6
close=OK
+0.006908
+ exit 0
close fd=6
close=OK
+0.004680
+ exit 0
close fd=6
close=OK
+0.000078
+ exit 6
close fd=6
close=OK
+0.014060
+ exit 0
close fd=6
close=OK
+0.000187
+ exit 0
close fd=6
close=OK
+0.002395
+ exit 0
close fd=6
close=OK
+0.000144
+ exit 0
extern vbuf vb;
extern struct timeval currenttime;
extern const struct Terrno { const char *n; int v; } Terrnos[];
+/* Special cases */
+void Texit(int rv) NONRETURNING;
#endif
extern vbuf vb;
extern struct timeval currenttime;
extern const struct Terrno { const char *n; int v; } Terrnos[];
+
+/* Special cases */
+void Texit(int rv) NONRETURNING;
+
#endif
Hfree(op);
return np;
}
-void Hexit(int rv) {
+void Texit(int rv) {
struct malloced *loopnode;
Tshutdown();
adns__vbuf_free(&vb);
}
exit(rv);
}
+void Hexit(int rv) {
+ vb.used= 0;
+ Tvbf("exit %d", rv);
+ Q_vb();
+ Texit(0);
+}
pid_t Hgetpid(void) {
return 2264; /* just some number */
}
return np;
}
-void Hexit(int rv) {
+void Texit(int rv) {
struct malloced *loopnode;
Tshutdown();
exit(rv);
}
+void Hexit(int rv) {
+ vb.used= 0;
+ Tvbf("exit %d", rv);
+ Q_vb();
+ Texit(0);
+}
+
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