[Libguestfs] [PATCH] tests: Conditionally skip UUID tests.

Jim Meyering jim at meyering.net
Wed Aug 19 13:55:06 UTC 2009


Richard W.M. Jones wrote:
...
> diff --git a/capitests/Makefile.am b/capitests/Makefile.am
...
> +# Old version of e2fsprogs which didn't support UUIDs?
> +e2fs_uuid_not_supported := $(shell r=1; if test -x ../initramfs/sbin/mkswap; then if ../initramfs/sbin/mkswap --help 2>&1 | grep -sq -- -U; then r=0; fi; fi; echo $$r)

Looks good.
However it'd be even tidier, and easier to read with line lengths < 80:

e2fs_uuid_not_supported :=					\
  $(shell r=1; if test -x ../initramfs/sbin/mkswap; then	\
    if ../initramfs/sbin/mkswap --help 2>&1			\
      | grep -sq -- -U; then r=0; fi; fi; echo $$r)

In case you're comfortable with cmd && cmd2 && ... notation,
here's another way to write it using slightly less syntax:

e2fs_uuid_not_supported :=						\
  $(shell r=1;								\
    test -x ../initramfs/sbin/mkswap					\
      && ../initramfs/sbin/mkswap --help 2>&1 | grep -sq -- -U		\
      && r=1; echo $$r)




More information about the Libguestfs mailing list