From 801f7d1033f74644c6d427cff9618270b2878582 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Sun, 20 Jan 2013 16:49:52 +1000 Subject: 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 --- test/pacman/pactest.py | 5 +++++ test/pacman/pmdb.py | 1 + test/pacman/pmenv.py | 3 ++- test/pacman/pmfile.py | 1 + test/pacman/pmpkg.py | 1 + test/pacman/pmrule.py | 1 + test/pacman/pmtest.py | 10 ++++++++-- test/pacman/util.py | 1 + 8 files changed, 20 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py index 2fb64edc..ea44be5c 100755 --- a/test/pacman/pactest.py +++ b/test/pacman/pactest.py @@ -3,6 +3,7 @@ # pactest : run automated testing on the pacman binary # # Copyright (c) 2006 by Aurelien Foret +# Copyright (c) 2006-2013 Pacman Development Team # # 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 @@ -81,6 +82,9 @@ def create_parser(): parser.add_option("--manual-confirm", action = "store_true", dest = "manualconfirm", default = False, 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 @@ -99,6 +103,7 @@ if __name__ == "__main__": env.pacman["gdb"] = opts.gdb env.pacman["valgrind"] = opts.valgrind env.pacman["manual-confirm"] = opts.manualconfirm + env.pacman["scriptlet-shell"] = opts.scriptletshell if opts.testcases is None or len(opts.testcases) == 0: print "no tests defined, nothing to do" diff --git a/test/pacman/pmdb.py b/test/pacman/pmdb.py index 285c3151..b694dff6 100644 --- a/test/pacman/pmdb.py +++ b/test/pacman/pmdb.py @@ -1,6 +1,7 @@ #! /usr/bin/python2 # # Copyright (c) 2006 by Aurelien Foret +# Copyright (c) 2006-2013 Pacman Development Team # # 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 diff --git a/test/pacman/pmenv.py b/test/pacman/pmenv.py index 0e455cee..9a88262e 100644 --- a/test/pacman/pmenv.py +++ b/test/pacman/pmenv.py @@ -1,6 +1,7 @@ #! /usr/bin/python2 # # Copyright (c) 2006 by Aurelien Foret +# Copyright (c) 2006-2013 Pacman Developmet Team # # 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 @@ -66,7 +67,7 @@ class pmenv(object): print t.description print "----------"*8 - t.generate() + t.generate(self.pacman) t.run(self.pacman) diff --git a/test/pacman/pmfile.py b/test/pacman/pmfile.py index d5aa1a11..49c02749 100644 --- a/test/pacman/pmfile.py +++ b/test/pacman/pmfile.py @@ -1,6 +1,7 @@ #! /usr/bin/python2 # # Copyright (c) 2006 by Aurelien Foret +# Copyright (c) 2006-2013 Pacman Development Team # # 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 diff --git a/test/pacman/pmpkg.py b/test/pacman/pmpkg.py index bfc93dd6..c0c9f131 100644 --- a/test/pacman/pmpkg.py +++ b/test/pacman/pmpkg.py @@ -1,6 +1,7 @@ #! /usr/bin/python2 # # Copyright (c) 2006 by Aurelien Foret +# Copyright (c) 2006-2013 Pacman Development Team # # 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 diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py index 778b6aac..3d38b852 100644 --- a/test/pacman/pmrule.py +++ b/test/pacman/pmrule.py @@ -1,6 +1,7 @@ #! /usr/bin/python2 # # Copyright (c) 2006 by Aurelien Foret +# Copyright (c) 2006-2013 Pacman Development Team # # 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 diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index 00a0b96e..af5d342b 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -1,6 +1,7 @@ #! /usr/bin/python2 # # Copyright (c) 2006 by Aurelien Foret +# Copyright (c) 2006-2013 Pacman Development Team # # 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 @@ -102,7 +103,7 @@ class pmtest(object): else: raise IOError("file %s does not exist!" % self.name) - def generate(self): + def generate(self, pacman): print "==> Generating test environment" # 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)) bindir = os.path.join(self.root, "bin") 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: if not os.path.isdir(sys_dir): vprint("\t%s" % sys_dir[len(self.root)+1:]) os.makedirs(sys_dir, 0755) # Only the dynamically linked binary is needed for fakechroot 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"), os.path.join(sbindir, "ldconfig")) ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w") diff --git a/test/pacman/util.py b/test/pacman/util.py index d40612dc..be99cd57 100644 --- a/test/pacman/util.py +++ b/test/pacman/util.py @@ -1,6 +1,7 @@ #! /usr/bin/python2 # # Copyright (c) 2006 by Aurelien Foret +# Copyright (c) 2006-2013 Pacman Development Team # # 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 -- cgit v1.2.3-70-g09d2