[pacman-dev] [PATCH] [pactest] Check for fakeroot in ldconfig tests

Dave Reisner d at falconindy.com
Thu Jan 31 19:41:42 EST 2013


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 at 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
> 
> 


More information about the pacman-dev mailing list