mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 07:48:50 -05:00
pactest: handle non-default scriptlet shells
pacman can be configured to use a different shell than /bin/sh for scriplets. Pass the cnfigured value to the pactest suite and make the necessary "copy" of the shell in the test root. Also update all copyright years in the pactest suite. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
ad280e1b56
commit
801f7d1033
@ -28,6 +28,7 @@ check-local: test-pacman test-pacsort test-vercmp test-parseopts
|
|||||||
test-pacman: test/pacman src/pacman
|
test-pacman: test/pacman src/pacman
|
||||||
LC_ALL=C $(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
|
LC_ALL=C $(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
|
||||||
--test $(top_srcdir)/test/pacman/tests/*.py \
|
--test $(top_srcdir)/test/pacman/tests/*.py \
|
||||||
|
--scriptlet-shell $(SCRIPTLET_SHELL) \
|
||||||
-p $(top_builddir)/src/pacman/pacman
|
-p $(top_builddir)/src/pacman/pacman
|
||||||
|
|
||||||
test-pacsort: test/util src/util
|
test-pacsort: test/util src/util
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
# pactest : run automated testing on the pacman binary
|
# pactest : run automated testing on the pacman binary
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
||||||
|
# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -81,6 +82,9 @@ def create_parser():
|
|||||||
parser.add_option("--manual-confirm", action = "store_true",
|
parser.add_option("--manual-confirm", action = "store_true",
|
||||||
dest = "manualconfirm", default = False,
|
dest = "manualconfirm", default = False,
|
||||||
help = "do not use --noconfirm for pacman calls")
|
help = "do not use --noconfirm for pacman calls")
|
||||||
|
parser.add_option("--scriptlet-shell", type = "string",
|
||||||
|
dest = "scriptletshell", default = "/bin/sh",
|
||||||
|
help = "specify path to shell used for install scriptlets")
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
|
|
||||||
@ -99,6 +103,7 @@ if __name__ == "__main__":
|
|||||||
env.pacman["gdb"] = opts.gdb
|
env.pacman["gdb"] = opts.gdb
|
||||||
env.pacman["valgrind"] = opts.valgrind
|
env.pacman["valgrind"] = opts.valgrind
|
||||||
env.pacman["manual-confirm"] = opts.manualconfirm
|
env.pacman["manual-confirm"] = opts.manualconfirm
|
||||||
|
env.pacman["scriptlet-shell"] = opts.scriptletshell
|
||||||
|
|
||||||
if opts.testcases is None or len(opts.testcases) == 0:
|
if opts.testcases is None or len(opts.testcases) == 0:
|
||||||
print "no tests defined, nothing to do"
|
print "no tests defined, nothing to do"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/python2
|
#! /usr/bin/python2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
||||||
|
# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/python2
|
#! /usr/bin/python2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
||||||
|
# Copyright (c) 2006-2013 Pacman Developmet Team <pacman-dev@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -66,7 +67,7 @@ class pmenv(object):
|
|||||||
print t.description
|
print t.description
|
||||||
print "----------"*8
|
print "----------"*8
|
||||||
|
|
||||||
t.generate()
|
t.generate(self.pacman)
|
||||||
|
|
||||||
t.run(self.pacman)
|
t.run(self.pacman)
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/python2
|
#! /usr/bin/python2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
||||||
|
# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/python2
|
#! /usr/bin/python2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
||||||
|
# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/python2
|
#! /usr/bin/python2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
||||||
|
# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/python2
|
#! /usr/bin/python2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
||||||
|
# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -102,7 +103,7 @@ class pmtest(object):
|
|||||||
else:
|
else:
|
||||||
raise IOError("file %s does not exist!" % self.name)
|
raise IOError("file %s does not exist!" % self.name)
|
||||||
|
|
||||||
def generate(self):
|
def generate(self, pacman):
|
||||||
print "==> Generating test environment"
|
print "==> Generating test environment"
|
||||||
|
|
||||||
# Cleanup leftover files from a previous test session
|
# Cleanup leftover files from a previous test session
|
||||||
@ -120,13 +121,18 @@ class pmtest(object):
|
|||||||
etcdir = os.path.join(self.root, os.path.dirname(util.PACCONF))
|
etcdir = os.path.join(self.root, os.path.dirname(util.PACCONF))
|
||||||
bindir = os.path.join(self.root, "bin")
|
bindir = os.path.join(self.root, "bin")
|
||||||
sbindir = os.path.join(self.root, "sbin")
|
sbindir = os.path.join(self.root, "sbin")
|
||||||
sys_dirs = [dbdir, cachedir, syncdir, tmpdir, logdir, etcdir, bindir, sbindir]
|
shell = pacman["scriptlet-shell"][1:]
|
||||||
|
shelldir = os.path.join(self.root, os.path.dirname(shell))
|
||||||
|
sys_dirs = [dbdir, cachedir, syncdir, tmpdir, logdir, etcdir, bindir,
|
||||||
|
sbindir, shelldir]
|
||||||
for sys_dir in sys_dirs:
|
for sys_dir in sys_dirs:
|
||||||
if not os.path.isdir(sys_dir):
|
if not os.path.isdir(sys_dir):
|
||||||
vprint("\t%s" % sys_dir[len(self.root)+1:])
|
vprint("\t%s" % sys_dir[len(self.root)+1:])
|
||||||
os.makedirs(sys_dir, 0755)
|
os.makedirs(sys_dir, 0755)
|
||||||
# Only the dynamically linked binary is needed for fakechroot
|
# Only the dynamically linked binary is needed for fakechroot
|
||||||
shutil.copy("/bin/sh", bindir)
|
shutil.copy("/bin/sh", bindir)
|
||||||
|
if shell != "bin/sh":
|
||||||
|
shutil.copy("/bin/sh", os.path.join(self.root, shell))
|
||||||
shutil.copy(os.path.join(util.SELFPATH, "ldconfig.stub"),
|
shutil.copy(os.path.join(util.SELFPATH, "ldconfig.stub"),
|
||||||
os.path.join(sbindir, "ldconfig"))
|
os.path.join(sbindir, "ldconfig"))
|
||||||
ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w")
|
ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w")
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#! /usr/bin/python2
|
#! /usr/bin/python2
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
# Copyright (c) 2006 by Aurelien Foret <orelien@chez.com>
|
||||||
|
# Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
Loading…
Reference in New Issue
Block a user