diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2014-10-06 09:01:40 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2014-10-13 04:54:29 +0200 |
commit | 42c859e4cc38f91a1236cd93eae9e9f9a1bc1e62 (patch) | |
tree | 23ddd2d78b3fbe4ce2cfed46e7c47f6c9acb91ec /test/pacman/pmtest.py | |
parent | 01beca5df717252c7c9aa59bc705dc10a25ebdc8 (diff) | |
download | pacman-42c859e4cc38f91a1236cd93eae9e9f9a1bc1e62.tar.gz pacman-42c859e4cc38f91a1236cd93eae9e9f9a1bc1e62.tar.xz |
pmtest: allow tests to specify test binary
Adds a cmd property to tests (defaults to pacman) which is resolved
using directories specified with --bindir (defaults to PATH). The
ability to manually specify a particular binary is preserved in order to
allow running individual tests with differently named binaries such as
lt-pacman.
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 | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index 36829632..5a79919e 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -39,6 +39,11 @@ class pmtest(object): self.root = root self.dbver = 9 self.cachepkgs = True + self.cmd = ["pacman", "--noconfirm", + "--config", os.path.join(self.root, util.PACCONF), + "--root", self.root, + "--dbpath", os.path.join(self.root, util.PM_DBPATH), + "--cachedir", os.path.join(self.root, util.PM_CACHEDIR)] def __str__(self): return "name = %s\n" \ @@ -234,16 +239,24 @@ class pmtest(object): "--log-file=%s" % os.path.join(self.root, "var/log/valgrind"), "--suppressions=%s" % suppfile]) self.addrule("FILE_EMPTY=var/log/valgrind") - cmd.extend([pacman["bin"], "--noconfirm", - "--config", os.path.join(self.root, util.PACCONF), - "--root", self.root, - "--dbpath", os.path.join(self.root, util.PM_DBPATH), - "--cachedir", os.path.join(self.root, util.PM_CACHEDIR)]) + + # replace program name with absolute path + prog = pacman["bin"] + if not prog: + prog = util.which(self.cmd[0], pacman["bindir"]) + if not prog or not os.access(prog, os.X_OK): + if not prog: + tap.bail("could not locate '%s' binary" % (self.cmd[0])) + return + + cmd.append(os.path.abspath(prog)) + cmd.extend(self.cmd[1:]) if pacman["manual-confirm"]: cmd.append("--confirm") if pacman["debug"]: cmd.append("--debug=%s" % pacman["debug"]) cmd.extend(shlex.split(self.args)) + if not (pacman["gdb"] or pacman["nolog"]): output = open(os.path.join(self.root, util.LOGFILE), 'w') else: |