[Libguestfs] [PATCH 1/2] tests/syslinux: factorize search for mbr.bin
Richard W.M. Jones
rjones at redhat.com
Fri May 9 09:55:05 UTC 2014
On Fri, May 09, 2014 at 11:01:49AM +0200, Pino Toscano wrote:
> ---
> tests/syslinux/test-syslinux.pl | 21 ++++++++++++++-------
> 1 file changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/tests/syslinux/test-syslinux.pl b/tests/syslinux/test-syslinux.pl
> index d86c095..8a227d4 100755
> --- a/tests/syslinux/test-syslinux.pl
> +++ b/tests/syslinux/test-syslinux.pl
> @@ -29,13 +29,20 @@ my $bootloader = $ENV{BOOTLOADER} || "syslinux";
> my $disk = "$bootloader-guest.img";
>
> # Find prerequisites.
> -my $mbr = "/usr/share/syslinux/mbr.bin";
> -unless (-f $mbr) {
> - $mbr = "/usr/lib/syslinux/mbr.bin";
> - unless (-f $mbr) {
> - print "$0: mbr.bin (from SYSLINUX) not found, skipping test\n";
> - exit 77;
> - }
> +my $mbr;
> +my @mbr_paths = (
> + "/usr/share/syslinux/mbr.bin",
> + "/usr/lib/syslinux/mbr.bin"
> +);
> +foreach my $m (@mbr_paths) {
> + if (-f $m) {
> + $mbr = $m;
> + last;
> + }
> +}
> +if (not length ($mbr)) {
unless (defined $mbr) {
> + print "$0: mbr.bin (from SYSLINUX) not found, skipping test\n";
> + exit 77;
> }
> print "mbr: $mbr\n";
ACK w/ that change.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top
More information about the Libguestfs
mailing list