poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] testsuite: Fix nbdkit usage when /usr/sbin is not on PATH


From: Eric Blake
Subject: [PATCH] testsuite: Fix nbdkit usage when /usr/sbin is not on PATH
Date: Fri, 6 Mar 2020 11:05:19 -0600

* configure.ac: Check for nbdkit in /usr/sbin.
* testsuite/lib/poke-dg.exp (dg-nbd): Actually use $NBDKIT from
environment.
---

nbdkit currently defaults to installation in /usr/sbin.  While we may
convince upstream nbdkit to change to something saner, in the meantime
this makes it easier to test without requiring the user to update
their PATH.  (Note that configure sets NBDKIT to no when libnbd is not
compiled in, so 'dg-require nbd' checking just for sane NBDKIT is
still robust enough to skip nbd tests when either nbd is not compiled
in or when nbdkit cannot be located).

 ChangeLog                 | 6 ++++++
 configure.ac              | 2 +-
 testsuite/lib/poke-dg.exp | 5 +++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 1e90550f..69e66935 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2020-03-06  Eric Blake  <address@hidden>
+
+       * configure.ac: Check for nbdkit in /usr/sbin.
+       * testsuite/lib/poke-dg.exp (dg-nbd): Actually use $NBDKIT from
+       environment.
+
 2020-03-06  Jose E. Marchesi  <address@hidden>

        * TODO: Update.
diff --git a/configure.ac b/configure.ac
index 38135cf5..8d32491d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,7 +88,7 @@ PKG_CHECK_MODULES([LIBNBD], [libnbd], [
   AC_SUBST([LIBNBD_LIBS])
   AC_DEFINE([HAVE_LIBNBD], [1], [libnbd found at compile time])
   libnbd_enabled=yes
-  AC_CHECK_PROGS([NBDKIT], [nbdkit], [no])
+  AC_PATH_PROGS([NBDKIT], [nbdkit], [no], [$PATH:/usr/sbin])
 ], [libnbd_enabled=no NBDKIT=no])
 AM_CONDITIONAL([NBD], [test "x$libnbd_enabled" = "xyes"])

diff --git a/testsuite/lib/poke-dg.exp b/testsuite/lib/poke-dg.exp
index f7994fcc..f10ceae9 100644
--- a/testsuite/lib/poke-dg.exp
+++ b/testsuite/lib/poke-dg.exp
@@ -175,11 +175,12 @@ proc dg-nbd { args } {
         error "[lindex $args 0]: invalid arguments"
     }

-    if { $::env(NBDKIT) != "no"} {
+    set nbdkit $::env(NBDKIT)
+    if { $nbdkit != "no"} {
         set data [lindex $args 1]
         set sock [lindex $args 2]

-        set fh [open |[list nbdkit -f -U $sock data data=$data]]
+        set fh [open |[list $nbdkit -f -U $sock data data=$data]]
         lappend poke_nbd_pids [pid $fh]
     }
 }
-- 
2.25.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]