From 6650c43fcafd144c78349aca9eb80c0ae3886a9d Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Fri, 4 Jul 2014 16:49:52 -0400 Subject: pactest: check for pacman binary before running Using fakeroot or fakechroot as the command with subprocess.call prevents the detection and reporting of a missing pacman binary. Some tests even pass when run with a non-existent binary. Checking manually allows us to provide a meaningful error message and prevent the false positives. Signed-off-by: Andrew Gregory --- test/pacman/pactest.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py index b2b9c289..cba439c3 100755 --- a/test/pacman/pactest.py +++ b/test/pacman/pactest.py @@ -49,7 +49,7 @@ def create_parser(): help = "set debug level for pacman") parser.add_option("-p", "--pacman", action = "callback", callback = resolve_binary_path, type = "string", - dest = "bin", default = "pacman", + dest = "bin", default = util.which("pacman"), help = "specify location of the pacman binary") parser.add_option("--keep-root", action = "store_true", dest = "keeproot", default = False, @@ -86,6 +86,10 @@ def create_parser(): opt_parser = create_parser() (opts, args) = opt_parser.parse_args() + if opts.bin is None or not os.access(opts.bin, os.X_OK): + tap.bail("cannot locate pacman binary") + sys.exit(2) + # instantiate env root_path = tempfile.mkdtemp(prefix='pactest-') env = pmenv.pmenv(root=root_path) -- cgit v1.2.3-54-g00ecf