regression tests: Properly handle adnshost et al exit status
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 19 Feb 2015 00:55:53 +0000 (00:55 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 21 Feb 2015 11:48:38 +0000 (11:48 +0000)
commite7308d2612173a14b26f797ae3aca830859ea3bf
tree459233fcd9e0e92027954d69939fb83a072cbf32
parent31813ed744ceb6cd3febe136fb7057ae06d2d1ed
regression tests: Properly handle adnshost et al exit status

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:
client/adnstest.c
regress/case-adh-cancel.sys
regress/case-adh-cancel2.sys
regress/case-adh-cancel3.sys
regress/case-adh-norm.sys
regress/case-adh-pipe.sys
regress/case-arf-norm.sys
regress/case-arf-text.sys
regress/case-dh-ptr-aaaa.sys
regress/case-srvbaddom.out
regress/case-srvbaddom.sys
regress/case-srvha.sys
regress/case-srvok.sys
regress/case-srvqudom.out
regress/case-srvqudom.sys
regress/case-srvsort.sys
regress/case-unknown2.sys
regress/case-unknown33.sys
regress/case-unknown5.sys
regress/harness.h
regress/harness.h.m4
regress/hcommon.c
regress/hcommon.c.m4
regress/sys-rc-convert [new file with mode: 0755]