[pacman-dev] [PATCH] pactest: fix when specifying scriptlet shell

Allan McRae allan at archlinux.org
Thu Sep 20 09:19:42 EDT 2012


When pacman is configured with --with-scriptlet-shell other than "sh",
the two scriptlet pactests fail. This copies /bin/sh into /bin/<shell>,
where <shell> is the specified shell, as the test rely on a sh
compatible shell being used.

Fixes FS#31552.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 Makefile.am            | 1 +
 test/pacman/pactest.py | 5 +++++
 test/pacman/pmenv.py   | 2 +-
 test/pacman/pmtest.py  | 5 +++--
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 0f15ec5..37a3c20 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -29,6 +29,7 @@ check-local: test-pacman test-pacsort test-vercmp test-parseopts
 test-pacman: test/pacman src/pacman
 	LC_ALL=C $(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
 		--test $(top_srcdir)/test/pacman/tests/*.py \
+		--scriptlet-shell $(SCRIPTLET_SHELL) \
 		-p $(top_builddir)/src/pacman/pacman
 
 test-pacsort: test/util src/util
diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py
index 2fb64ed..fcad160 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 <orelien at chez.com>
+#  Copyright (c) 2006-2012 Pacman Development Team <pacman-dev at archlinux.org>
 #
 #  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 = "sh",
+                      help = "specify shell used for install scriptlets")
     return parser
 
 
@@ -99,6 +103,7 @@ def create_parser():
     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/pmenv.py b/test/pacman/pmenv.py
index 0e455ce..04948c1 100644
--- a/test/pacman/pmenv.py
+++ b/test/pacman/pmenv.py
@@ -66,7 +66,7 @@ def run(self):
             print t.description
             print "----------"*8
 
-            t.generate()
+            t.generate(self.pacman)
 
             t.run(self.pacman)
 
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py
index 00a0b96..b69275b 100644
--- a/test/pacman/pmtest.py
+++ b/test/pacman/pmtest.py
@@ -1,6 +1,7 @@
 #! /usr/bin/python2
 #
 #  Copyright (c) 2006 by Aurelien Foret <orelien at chez.com>
+#  Copyright (c) 2006-2012 Pacman Development Team <pacman-dev at archlinux.org>
 #
 #  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 @@ def load(self):
         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
@@ -126,7 +127,7 @@ def generate(self):
                 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)
+        shutil.copy("/bin/sh", os.path.join(sbindir, pacman["scriptlet-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")
-- 
1.7.12



More information about the pacman-dev mailing list