1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 00:08:50 -05:00

* Fixed globbing for pactest --test argument

* --manual-confirm was handled in the wrong order
This commit is contained in:
Aaron Griffin 2007-02-23 04:54:49 +00:00
parent 6cd69fa9ff
commit 94874d90e2
3 changed files with 13 additions and 7 deletions

View File

@ -9,6 +9,6 @@ EXTRA_DIST = HACKING
# TODO : figure out a way to get 'make distcheck' to build with # TODO : figure out a way to get 'make distcheck' to build with
# --disable-fakeroot so it actually passes tests # --disable-fakeroot so it actually passes tests
check-local: src/pacman check-local: src/pacman
python $(top_srcdir)/pactest/pactest.py --test=$(top_srcdir)/pactest/tests/*.py -p $(top_builddir)/src/pacman/pacman --debug=1 python $(top_srcdir)/pactest/pactest.py --test $(top_srcdir)/pactest/tests/*.py -p $(top_builddir)/src/pacman/pacman --debug=1
rm -rf $(top_builddir)/root rm -rf $(top_builddir)/root

View File

@ -32,13 +32,20 @@ def resolveBinPath(option, opt_str, value, parser):
setattr(parser.values, option.dest, os.path.abspath(value)) setattr(parser.values, option.dest, os.path.abspath(value))
def globTests(option, opt_str, value, parser): def globTests(option, opt_str, value, parser):
idx=0
globlist = [] globlist = []
globlist.extend(glob.glob(value))
# maintain the idx so we can modify rargs
while not parser.rargs[idx].startswith('-'):
globlist += glob.glob(parser.rargs[idx])
idx += 1
parser.rargs = parser.rargs[idx:]
setattr(parser.values, option.dest, globlist) setattr(parser.values, option.dest, globlist)
def createOptParser(): def createOptParser():
testcases = [] testcases = []
usage = "usage: %prog [options] [[--test=<path/to/testfile.py>] ...]" usage = "usage: %prog [options] [[--test <path/to/testfile.py>] ...]"
description = "Runs automated tests on the pacman binary. Tests are " \ description = "Runs automated tests on the pacman binary. Tests are " \
"described using an easy python syntax, and several can be " \ "described using an easy python syntax, and several can be " \
"ran at once." "ran at once."
@ -55,8 +62,7 @@ def createOptParser():
dest = "bin", default = "pacman", dest = "bin", default = "pacman",
help = "specify location of the pacman binary") help = "specify location of the pacman binary")
parser.add_option("-t", "--test", action = "callback", parser.add_option("-t", "--test", action = "callback",
callback = globTests, type = "string", callback = globTests, dest = "testcases",
dest = "testcases",
help = "specify test case(s)") help = "specify test case(s)")
parser.add_option("--nolog", action = "store_true", parser.add_option("--nolog", action = "store_true",
dest = "nolog", default = False, dest = "nolog", default = False,

View File

@ -188,10 +188,10 @@ class pmtest:
cmd.append("libtool gdb --args") cmd.append("libtool gdb --args")
if pacman["valgrind"]: if pacman["valgrind"]:
cmd.append("valgrind --tool=memcheck --leak-check=full --show-reachable=yes") cmd.append("valgrind --tool=memcheck --leak-check=full --show-reachable=yes")
if not pacman["manual-confirm"]:
cmd.append("--noconfirm")
cmd.append("%s --config=%s --root=%s" \ cmd.append("%s --config=%s --root=%s" \
% (pacman["bin"], os.path.join(self.root, PACCONF), self.root)) % (pacman["bin"], os.path.join(self.root, PACCONF), self.root))
if not pacman["manual-confirm"]:
cmd.append("--noconfirm")
if pacman["debug"]: if pacman["debug"]:
cmd.append("--debug=%s" % pacman["debug"]) cmd.append("--debug=%s" % pacman["debug"])
cmd.append("%s" % self.args) cmd.append("%s" % self.args)