diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2013-07-29 21:22:07 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2013-08-21 03:00:18 +0200 |
commit | 1152052b3e27e3252f6685a369fce8a426710015 (patch) | |
tree | c7e31e108faa3cf8b464cd04fbe2123abe76b6e8 /test/pacman/pmtest.py | |
parent | 429b956fb2d21309cae0560d6d98225969447737 (diff) | |
download | pacman-1152052b3e27e3252f6685a369fce8a426710015.tar.gz pacman-1152052b3e27e3252f6685a369fce8a426710015.tar.xz |
convert pactest to TAP output
Each test produces a single TAP result with the rules run in a sub-test.
This reduces output when run under automake and makes it possible to
continue setting expectfailure at the test level rather than per-rule.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'test/pacman/pmtest.py')
-rw-r--r-- | test/pacman/pmtest.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index cea584da..b343d55f 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -27,6 +27,7 @@ import time import pmrule import pmdb import pmfile +import tap import util from util import vprint @@ -104,7 +105,7 @@ class pmtest(object): raise IOError("file %s does not exist!" % self.name) def generate(self, pacman): - print "==> Generating test environment" + tap.diag("==> Generating test environment") # Cleanup leftover files from a previous test session if os.path.isdir(self.root): @@ -192,23 +193,23 @@ class pmtest(object): def run(self, pacman): if os.path.isfile(util.PM_LOCK): - print "\tERROR: another pacman session is on-going -- skipping" + tap.bail("\tERROR: another pacman session is on-going -- skipping") return - print "==> Running test" + tap.diag("==> Running test") vprint("\tpacman %s" % self.args) cmd = [] if os.geteuid() != 0: fakeroot = util.which("fakeroot") if not fakeroot: - print "WARNING: fakeroot not found!" + tap.diag("WARNING: fakeroot not found!") else: cmd.append("fakeroot") fakechroot = util.which("fakechroot") if not fakechroot: - print "WARNING: fakechroot not found!" + tap.diag("WARNING: fakechroot not found!") else: cmd.append("fakechroot") @@ -252,23 +253,20 @@ class pmtest(object): # Check if the lock is still there if os.path.isfile(util.PM_LOCK): - print "\tERROR: %s not removed" % util.PM_LOCK + tap.diag("\tERROR: %s not removed" % util.PM_LOCK) os.unlink(util.PM_LOCK) # Look for a core file if os.path.isfile(os.path.join(self.root, util.TMPDIR, "core")): - print "\tERROR: pacman dumped a core file" + tap.diag("\tERROR: pacman dumped a core file") def check(self): - print "==> Checking rules" - + tap.plan(len(self.rules)) for i in self.rules: success = i.check(self) if success == 1: - msg = " OK " self.result["success"] += 1 else: - msg = "FAIL" self.result["fail"] += 1 - print "\t[%s] %s" % (msg, i) + tap.ok(success, i) # vim: set ts=4 sw=4 et: |