[pacman-dev] [PATCH] [pactest] Check for fakeroot in ldconfig tests
libalpm runs ldconfig inside chroot so we should expect failure when testing if fakechroot is not installed. Fixes FS#33551. Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> --- test/pacman/tests/ldconfig001.py | 4 ++++ test/pacman/tests/ldconfig002.py | 4 ++++ test/pacman/tests/ldconfig003.py | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/test/pacman/tests/ldconfig001.py b/test/pacman/tests/ldconfig001.py index a97f28c..cbc4695 100644 --- a/test/pacman/tests/ldconfig001.py +++ b/test/pacman/tests/ldconfig001.py @@ -7,3 +7,7 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True diff --git a/test/pacman/tests/ldconfig002.py b/test/pacman/tests/ldconfig002.py index 07f2ec6..2b5d833 100644 --- a/test/pacman/tests/ldconfig002.py +++ b/test/pacman/tests/ldconfig002.py @@ -11,3 +11,7 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=dummy|1.0-2") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True diff --git a/test/pacman/tests/ldconfig003.py b/test/pacman/tests/ldconfig003.py index 9b2967e..40fcfb2 100644 --- a/test/pacman/tests/ldconfig003.py +++ b/test/pacman/tests/ldconfig003.py @@ -7,3 +7,7 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True -- 1.8.1.2
libalpm runs ldconfig inside chroot so we should expect failure when testing if fakechroot is not installed. Fixes FS#33551. Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> --- Fixed the title of the commit message. Please ignore the first one. test/pacman/tests/ldconfig001.py | 4 ++++ test/pacman/tests/ldconfig002.py | 4 ++++ test/pacman/tests/ldconfig003.py | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/test/pacman/tests/ldconfig001.py b/test/pacman/tests/ldconfig001.py index a97f28c..cbc4695 100644 --- a/test/pacman/tests/ldconfig001.py +++ b/test/pacman/tests/ldconfig001.py @@ -7,3 +7,7 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True diff --git a/test/pacman/tests/ldconfig002.py b/test/pacman/tests/ldconfig002.py index 07f2ec6..2b5d833 100644 --- a/test/pacman/tests/ldconfig002.py +++ b/test/pacman/tests/ldconfig002.py @@ -11,3 +11,7 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=dummy|1.0-2") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True diff --git a/test/pacman/tests/ldconfig003.py b/test/pacman/tests/ldconfig003.py index 9b2967e..40fcfb2 100644 --- a/test/pacman/tests/ldconfig003.py +++ b/test/pacman/tests/ldconfig003.py @@ -7,3 +7,7 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True -- 1.8.1.2
On Thu, Jan 31, 2013 at 07:11:56PM -0500, Chirantan Ekbote wrote:
libalpm runs ldconfig inside chroot so we should expect failure when testing if fakechroot is not installed.
Fixes FS#33551.
Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> --- test/pacman/tests/ldconfig001.py | 4 ++++ test/pacman/tests/ldconfig002.py | 4 ++++ test/pacman/tests/ldconfig003.py | 4 ++++ 3 files changed, 12 insertions(+)
diff --git a/test/pacman/tests/ldconfig001.py b/test/pacman/tests/ldconfig001.py index a97f28c..cbc4695 100644 --- a/test/pacman/tests/ldconfig001.py +++ b/test/pacman/tests/ldconfig001.py @@ -7,3 +7,7 @@
self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True
IMO, conditionals like this have no place in testsuites. We would be better off skipping the test entirely if we cannot conclusively determine success or failure due to missing prerequisites. Alternatively, document fakechroot as a dependency. I'm in favor of this.
diff --git a/test/pacman/tests/ldconfig002.py b/test/pacman/tests/ldconfig002.py index 07f2ec6..2b5d833 100644 --- a/test/pacman/tests/ldconfig002.py +++ b/test/pacman/tests/ldconfig002.py @@ -11,3 +11,7 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=dummy|1.0-2") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True diff --git a/test/pacman/tests/ldconfig003.py b/test/pacman/tests/ldconfig003.py index 9b2967e..40fcfb2 100644 --- a/test/pacman/tests/ldconfig003.py +++ b/test/pacman/tests/ldconfig003.py @@ -7,3 +7,7 @@
self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=etc/ld.so.cache") + +fakechroot = util.which("fakechroot") +if not fakechroot: + self.expectfailure = True -- 1.8.1.2
Explicitly list fakeroot and fakechroot as dependencies in the installation section of the pactest README. Print a warning if fakechroot is not found, similar to the fakeroot warning. Remove conditional checks for fakechroot from test files. I wasn't sure if I should separate these or send them as one big patch but since they all seem to do different things, I decided to keep them separate. Please correct me if I am wrong. Chirantan
Fixes FS#33551. Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> --- test/pacman/README | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/pacman/README b/test/pacman/README index e563379..9f1af7d 100644 --- a/test/pacman/README +++ b/test/pacman/README @@ -52,8 +52,17 @@ Upon completion, it checks that: Installation ============ -Simply extract the pactest tarball, jump into the newly created directory and -run pactest.py. See the usage section below. +You will need to build and install two libraries before running any +tests. + +fakeroot +http://fakeroot.alioth.debian.org + +fakechroot +http://fakechroot.alioth.debian.org + +To test pacman simply extract the pactest tarball, jump into the newly +created directory and run pactest.py. See the usage section below. Remark: pacman 3.x restrictions regarding fakeroot must be disabled. It can be done by configuring pacman with the --disable-fakeroot flag: -- 1.8.1.2
On 01/02/13 13:24, Chirantan Ekbote wrote:
Fixes FS#33551.
Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> --- test/pacman/README | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/test/pacman/README b/test/pacman/README index e563379..9f1af7d 100644 --- a/test/pacman/README +++ b/test/pacman/README @@ -52,8 +52,17 @@ Upon completion, it checks that: Installation ============
-Simply extract the pactest tarball, jump into the newly created directory and -run pactest.py. See the usage section below. +You will need to build and install two libraries before running any +tests. + +fakeroot +http://fakeroot.alioth.debian.org + +fakechroot +http://fakechroot.alioth.debian.org + +To test pacman simply extract the pactest tarball, jump into the newly +created directory and run pactest.py. See the usage section below.
Remark: pacman 3.x restrictions regarding fakeroot must be disabled. It can be done by configuring pacman with the --disable-fakeroot flag:
Committed to my working branch as this: From: Chirantan Ekbote <chirantan.ekbote@gmail.com> Subject: [PATCH] Document fakeroot and fakechroot as dependencies Signed-off-by: Allan McRae <allan@archlinux.org> --- test/pacman/README | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/pacman/README b/test/pacman/README index b6189d2..958ff28 100644 --- a/test/pacman/README +++ b/test/pacman/README @@ -63,6 +63,14 @@ Note: several "--test" options can be passed to pactest. Use the "help" option to get the full list of parameters: ./pactest.py --help +The following pieces of software are required to run the pactest suite: + +fakeroot (required to run as non-root user) +http://fakeroot.alioth.debian.org + +fakechroot +http://fakechroot.alioth.debian.org + Parameters ========== -- 1.8.1.2
Fixes FS#33551. Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> --- test/pacman/pmtest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index 1d198f0..d141567 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -204,7 +204,9 @@ def run(self, pacman): cmd.append("fakeroot") fakechroot = util.which("fakechroot") - if fakechroot: + if not fakechroot: + print "WARNING: fakechroot not found!" + else: cmd.append("fakechroot") if pacman["gdb"]: -- 1.8.1.2
On 01/02/13 13:24, Chirantan Ekbote wrote:
Fixes FS#33551.
Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> ---
Ack. Although, I think it would be better if the testsuite just aborted immediately when not run as root and fakeroot and fakechroot are missing. At least there is no point running the test-suite at all if fakeroot is missing.
test/pacman/pmtest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index 1d198f0..d141567 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -204,7 +204,9 @@ def run(self, pacman): cmd.append("fakeroot")
fakechroot = util.which("fakechroot") - if fakechroot: + if not fakechroot: + print "WARNING: fakechroot not found!" + else: cmd.append("fakechroot")
if pacman["gdb"]:
We don't want test files to do any checks for fakechroot since we will print a warning if it is not found. Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> --- test/pacman/tests/scriptlet001.py | 4 ---- test/pacman/tests/scriptlet002.py | 4 ---- 2 files changed, 8 deletions(-) diff --git a/test/pacman/tests/scriptlet001.py b/test/pacman/tests/scriptlet001.py index 6f702eb..a8350b1 100644 --- a/test/pacman/tests/scriptlet001.py +++ b/test/pacman/tests/scriptlet001.py @@ -11,7 +11,3 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=pre_install") self.addrule("FILE_EXIST=post_install") - -fakechroot = util.which("fakechroot") -if not fakechroot: - self.expectfailure = True diff --git a/test/pacman/tests/scriptlet002.py b/test/pacman/tests/scriptlet002.py index 907f419..7d58d03 100644 --- a/test/pacman/tests/scriptlet002.py +++ b/test/pacman/tests/scriptlet002.py @@ -11,7 +11,3 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=pre_remove") self.addrule("FILE_EXIST=post_remove") - -fakechroot = util.which("fakechroot") -if not fakechroot: - self.expectfailure = True -- 1.8.1.2
On 01/02/13 13:24, Chirantan Ekbote wrote:
We don't want test files to do any checks for fakechroot since we will print a warning if it is not found.
Signed-off-by: Chirantan Ekbote <chirantan.ekbote@gmail.com> ---
I'm going to accept this because I think the test-suite should either explicitly state it is skipping a test or enforce the dependencies before it runs. Hiding a potential failure is not right. Allan
test/pacman/tests/scriptlet001.py | 4 ---- test/pacman/tests/scriptlet002.py | 4 ---- 2 files changed, 8 deletions(-)
diff --git a/test/pacman/tests/scriptlet001.py b/test/pacman/tests/scriptlet001.py index 6f702eb..a8350b1 100644 --- a/test/pacman/tests/scriptlet001.py +++ b/test/pacman/tests/scriptlet001.py @@ -11,7 +11,3 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=pre_install") self.addrule("FILE_EXIST=post_install") - -fakechroot = util.which("fakechroot") -if not fakechroot: - self.expectfailure = True diff --git a/test/pacman/tests/scriptlet002.py b/test/pacman/tests/scriptlet002.py index 907f419..7d58d03 100644 --- a/test/pacman/tests/scriptlet002.py +++ b/test/pacman/tests/scriptlet002.py @@ -11,7 +11,3 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("FILE_EXIST=pre_remove") self.addrule("FILE_EXIST=post_remove") - -fakechroot = util.which("fakechroot") -if not fakechroot: - self.expectfailure = True
participants (3)
-
Allan McRae
-
Chirantan Ekbote
-
Dave Reisner