chiark / gitweb /
manpages written; some bugs in error handling fixed
authorIan Jackson <ian@anarres>
Tue, 24 Jan 2006 18:24:13 +0000 (18:24 +0000)
committerIan Jackson <ian@anarres>
Tue, 24 Jan 2006 18:24:13 +0000 (18:24 +0000)
debian/changelog
runner/adt-run
runner/adt-run.1 [new file with mode: 0644]
virt-chroot/adt-virt-chroot
virt-chroot/adt-virt-chroot.1 [new file with mode: 0644]

index 2d51147c0030e7f1d1f3e83d1ad6f2b9f93e0287..87fd8955a23d16f8372bae11523d1e3f3e3198d0 100644 (file)
@@ -1,3 +1,9 @@
+autodebtest (0.5.1) dapper unstable; urgency=low
+
+  * Manpages and minor fixes.
+
+ -- Ian Jackson <iwj@ubuntu.com>  Tue, 24 Jan 2006 18:23:56 +0000
+
 autodebtest (0.5.0) dapper unstable; urgency=low
 
   * Initial release of (still largely proof-of-concept) automatic binary
index c8eed988d210e2ac51fa88294465dcb7128353a4..8b52320c5fc30285170ed1abf43dbcb797a36787 100755 (executable)
@@ -1,18 +1,5 @@
 #!/usr/bin/python2.4
-# usage:
-#      adt-run <options>... --- <virt-server> [<virt-server-arg>...]
 #
-# invoke in toplevel of package (not necessarily built)
-# with package installed
-
-# exit status:
-#  0 all tests passed
-#  4 at least one test failed
-#  8 no tests in this package
-# 12 erroneous package
-# 16 testbed failure
-# 20 other unexpected failures including bad usage
-
 # adt-run is part of autodebtest
 # autodebtest is a tool for testing Debian binary packages
 #
@@ -45,11 +32,13 @@ import urllib
 import string
 import re as regexp
 import os
+import errno
 
 from optparse import OptionParser
 
 tmpdir = None
 testbed = None
+errorcode = 0
 
 signal.signal(signal.SIGINT, signal.SIG_DFL) # undo stupid Python SIGINT thing
 
@@ -65,6 +54,8 @@ class Unsupported:
        if lno >= 0: u.m = '%s (control line %d)' % (m, lno)
        else: u.m = m
  def report(u, tname):
+       global errorcode
+       errorcode != 2
        report(tname, 'SKIP %s' % u.m)
 
 def debug(m):
@@ -140,8 +131,9 @@ def parse_args():
        pa_path('control',      False, 'read control file PATH on %s')
 
        pa('-d', '--debug', action='store_true', dest='debug');
-       pa('','--user', type='string',
-               help='run tests as USER (needs root on testbed)')
+       # pa('','--user', type='string',
+       #       help='run tests as USER (needs root on testbed)')
+       # nyi
 
        class SpecialOption(optparse.Option): pass
        vs_op = SpecialOption('','--VSERVER-DUMMY')
@@ -303,6 +295,10 @@ def run_tests():
        testbed.close()
        for t in tests:
                t.run()
+       if not tests:
+               global errorcode
+               report('*', 'SKIP no tests in this package')
+               errorcode |= 8
 
 class Test:
  def __init__(t, tname, base):
@@ -314,6 +310,10 @@ class Test:
        t.p.ontb()
  def report(t, m):
        report(t.tname, m)
+ def reportfail(t, m):
+       global errorcode
+       errorcode |= 4
+       report(t.tname, 'FAIL ' + m)
  def run(t):
        testbed.open()
        so = testbed.scratch.append('stdout-' + t.tname, 'stdout-' + t.tname)
@@ -329,15 +329,20 @@ class Test:
                l = file(seh).readline()
                l = l.rstrip('\n \t\r')
                if len(l) > 40: l = l[:40] + '...'
-               t.report('FAIL stderr: %s' % l)
+               t.reportfail('stderr: %s' % l)
        elif rc != 0:
-               t.report('FAIL non-zero exit status %d' % rc)
+               t.reportfail('non-zero exit status %d' % rc)
        else:
                t.report('PASS')
 
 def read_control():
        global tests
-       control = file(opts.control.onhost(), 'r')
+       try:
+               control = file(opts.control.onhost(), 'r')
+       except IOError, oe:
+               if oe[0] != errno.ENOENT: raise
+               tests = []
+               return
        lno = 0
        def badctrl(m): testbed.badpkg('tests/control line %d: %s' % (lno, m))
        stz = None # stz[field_name][index] = (lno, value)
@@ -431,13 +436,16 @@ def cleanup():
        except:
                print_exception(sys.exc_info(),
                        '\nadt-run: error cleaning up:\n')
-               sys.exit(20)
+               os._exit(20)
 
 def main():
        global testbed
        global tmpdir
        try:
                parse_args()
+       except SystemExit, se:
+               os._exit(20)
+       try:
                tmpdir = tempfile.mkdtemp()
                testbed = Testbed()
                testbed.start()
@@ -446,7 +454,8 @@ def main():
        except:
                ec = print_exception(sys.exc_info(), '')
                cleanup()
-               sys.exit(ec)
+               os._exit(ec)
        cleanup()
+       os._exit(errorcode)
 
 main()
diff --git a/runner/adt-run.1 b/runner/adt-run.1
new file mode 100644 (file)
index 0000000..0b3cd9e
--- /dev/null
@@ -0,0 +1,111 @@
+.TH adt\-run 1 2006 autodebtest "Linux Programmer's Manual"
+.SH NAME
+adt\-run \- test an installed binary package using the package's tests
+.SH SYNOPSYS
+.B adt\-run
+.IR options ...
+.B \-\-\-
+.I virt\-server
+.RI [ virt\-server\-arg ...]
+.br
+.SH DESCRIPTION
+.B adt\-run
+is the program for invoking the autodebtest package testing machinery.
+
+autodebtest is a facility for testing binary packages, as installed on
+a system (such as a testbed system).  The tests are those supplied in
+the source package.
+
+adt\-run runs each test supplied by a particular package and reports
+the results.  It drives the specified virtualisation regime as
+appropriate, and parses the test description metadata, and arranges
+for data to be copied to and from the testbed as required.
+
+adt\-run should be invoked (unless options to the contrary are
+supplied) in the top level directory of the built source tree, on the
+host.  The package should be installed on the testbed.
+
+.SH OPTIONS
+.TP
+.BR \-\-build\-tree [ \-tb ] " " \fIdirectory\fR
+Specifies that the built source tree can be found in
+.IR directory .
+(Default: adt\-run's current directory, on the host.)
+.TP
+.BR \-\-control [ \-tb ] " " \fIcontrol\fR
+Specifies that
+.I control
+should be used as the test control file instead of
+.B debian/tests/control
+in the build tree.  Note that it is not an error for this file not to
+exist; that just means that there are no tests.
+.TP
+.BR \-d " | " \-\-debug
+Enables debugging output.  Probably not hugely interesting.
+.TP
+\fB\-\-\-\fR \fIvirt\-server virt\-server\-arg\fR...
+Specifies the virtualisation regime server, as a command and arguments
+to invoke.  All the remaining arguments and options after
+.B \-\-\-
+are passed to the virtualisation server program.
+
+.SS NOTES
+Some options which come in variants with and without
+.BR \-tb .
+These specify paths on the testbed and the host, respectively.  The
+data will be copied by
+.B adt\-run
+to where it is needed.
+
+.SH OUTPUT FORMAT
+During a normal test run, one line is printed for each test.  This
+consists of the name of the test, some horizontal whitespace, and
+either
+.B PASS
+or
+.BR FAIL " reason"
+or
+.BR SKIP " reason"
+where the pass/fail indication is separated by any reason by some
+horizontal whitespace.
+
+Sometimes a
+.B SKIP
+will be reported when the name of the test is not known or not
+applicable: for example, when there are no tests in the package, or a
+there is a test stanza which contains features not understood by this
+version of
+.BR adt\-run .
+In this case
+.B *
+will appear where the name of the test should be.
+
+.SH EXIT STATUS
+0      all tests passed
+.br
+2      at least one test skipped
+.br
+4      at least one test failed
+.br
+6      at least one test failed and at least one test skipped
+.br
+8      no tests in this package
+.br
+12     erroneous package
+.br
+16     testbed failure
+.br
+20     other unexpected failures including bad usage
+
+.SH SEE ALSO
+\fBadt\-virt\-chroot\fR(1)
+
+.SH BUGS
+This tool still lacks many important features.
+
+.SH AUTHORS AND COPYRIGHT
+This manpage is part of autodebtest, a tool for testing Debian binary
+packages.  autodebtest is Copyright (C) 2006 Canonical Ltd and others.
+
+See \fB/usr/share/doc/autodebtest/CREDTIS\fR for the list of
+contributors and full copying conditions.
index d795de44fcc4ee842d7099cf84ce8b07d7caff0c..8fe5729f54f92a80eac38f37977635ee4d5dff7d 100755 (executable)
@@ -1,12 +1,5 @@
 #!/usr/bin/python2.4
-# usage:
-#      adt-virt-chroot =[CHROOTNAME]
-#              uses dchroot (but problems with spaces)
-#              spaces in CHROOTNAME also not permitted
-#      adt-virt-chroot [-rGAINROOT] /PATH/TO/CHROOT
-#              uses GAINROOT chroot
-#              GAINROOT will be split up if it has spaces
-
+#
 # adt-virt-chroot is part of autodebtest
 # autodebtest is a tool for testing Debian binary packages
 #
diff --git a/virt-chroot/adt-virt-chroot.1 b/virt-chroot/adt-virt-chroot.1
new file mode 100644 (file)
index 0000000..0caabc8
--- /dev/null
@@ -0,0 +1,79 @@
+.TH adt\-run 1 2006 autodebtest "Linux Programmer's Manual"
+.SH NAME
+adt\-virt\-chroot \- autodebtest virtualisation server using a chroot
+.SH SYNOPSYS
+.B adt\-virt\-chroot
+.RI [ options ]
+.BR = [\fBchroot\-name\fR]
+.br
+.B adt\-virt\-chroot
+.RI [ options ]
+.RI [\fB\-r\fR gain\-root\-cmd ]
+.I /path/to/chroot
+.SH DESCRIPTION
+.B adt\-virt\-chroot
+provides an autodebtest virtualisation server using a chroot install
+(or similar).
+
+Normally
+.B adt\-virt\-chroot
+will be invoked by
+.BR adt\-run .
+
+The chroot to use must be specified.  If it starts with a
+.B =
+character then it is taken to be a chroot name known to
+.BR dchroot (8).
+Otherwise it must start with a
+.B /
+and will be taken to an absolute path.
+.SH OPTIONS
+.TP
+.BR \-\-gain\-root | \-r " \fIgain\-root\-cmd\fR"
+Specifies that
+.B adt\-virt\-chroot
+can become root (on the host) by prefixing its commands with
+.IR gain\-root\-cmd .
+The command may consist of several words separated by whitespace,
+in which case words other than the first are supplied as additional
+arguments to the command; other shell (or other) metacharacters in 
+.IR gain\-root\-cmd
+are not interpreted or modified by
+.BR adt\-virt\-chroot .
+The actual command to be run as root, and
+its arguments, are supplied as additional (separate) arguments to
+.IR gain\-root\-cmd .
+
+Root privilege is needed, to successfully run
+.BR chroot (8),
+if the chroot to use is specified as an absolute path.  The default is
+not to take any special action when root will be needed, in which case
+for an absolute path chroot,
+.B adt\-virt\-chroot
+must be started as root.
+.TP
+.BR \-d " | " \-\-debug
+Enables debugging output.  Probably not hugely interesting.
+
+.SH INPUT, OUTPUT AND EXIT STATUS
+The behaviour of
+.B adt\-virt\-chroot
+is as described by the AutomatedTesting virtualisation regime
+specification.
+
+.SH SEE ALSO
+\fBadt\-run\fR(1),
+.br
+.I "AutomatedTesting"
+.RB ( https://wiki.ubuntu.com/AutomatedTesting )
+
+.SH BUGS
+This tool lacks flexibility, and also lacks features provided for by
+the specification which would be useful for robust testing.
+
+.SH AUTHORS AND COPYRIGHT
+This manpage is part of autodebtest, a tool for testing Debian binary
+packages.  autodebtest is Copyright (C) 2006 Canonical Ltd and others.
+
+See \fB/usr/share/doc/autodebtest/CREDTIS\fR for the list of
+contributors and full copying conditions.