From 1152052b3e27e3252f6685a369fce8a426710015 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Mon, 29 Jul 2013 15:22:07 -0400 Subject: 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 Signed-off-by: Allan McRae --- test/pacman/pmtest.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'test/pacman/pmtest.py') 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: -- cgit v1.2.3