This is for consistency with qemu-img, socat, ss, etc where we test for these binaries at run time. --- configure.ac | 4 ---- tests/Makefile.am | 8 +++----- tests/test-parallel-file.sh | 20 +++++++++++++------- tests/test-parallel-nbd.sh | 20 +++++++++++++------- 4 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/configure.ac b/configure.ac index 6025ce0..30e4c43 100644 --- a/configure.ac +++ b/configure.ac @@ -407,10 +407,6 @@ dnl Check for guestfish (only needed for some of the tests). AC_CHECK_PROG([GUESTFISH], [guestfish], [guestfish], [no]) AM_CONDITIONAL([HAVE_GUESTFISH], [test "x$GUESTFISH" != "xno"]) -dnl Check for qemu-io (only needed for some of the tests). -AC_CHECK_PROG([QEMU_IO], [qemu-io], [qemu-io], [no]) -AM_CONDITIONAL([HAVE_QEMU_IO], [test "x$QEMU_IO" != "xno"]) - dnl See plugins/vddk/README.VDDK. AC_CHECK_SIZEOF([size_t]) AS_IF([test "x$ac_cv_sizeof_size_t" = "x4"],[bits=32],[bits=64]) diff --git a/tests/Makefile.am b/tests/Makefile.am index 1e32cb6..89ceb9d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -178,11 +178,9 @@ file-data: # While most tests need libguestfs, testing parallel I/O is easier when # using qemu-io to kick off asynchronous requests. -if HAVE_QEMU_IO -TESTS_ENVIRONMENT += QEMU_IO=$(QEMU_IO) -TESTS += test-parallel-file.sh -TESTS += test-parallel-nbd.sh -endif HAVE_QEMU_IO +TESTS += \ + test-parallel-file.sh \ + test-parallel-nbd.sh # Most in-depth tests need libguestfs, since that is a convenient way to # drive qemu. diff --git a/tests/test-parallel-file.sh b/tests/test-parallel-file.sh index 8c307af..d032bf7 100755 --- a/tests/test-parallel-file.sh +++ b/tests/test-parallel-file.sh @@ -31,17 +31,23 @@ # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -# Makefile sets $QEMU_IO, but it's also nice if the script runs again -# standalone afterwards for diagnosing any failures -: ${QEMU_IO=qemu-io} +# Check file-data was created by Makefile and qemu-io exists. +if ! test -f file-data; then + echo "$0: missing file-data" + exit 77 +fi +if ! qemu-io --version; then + echo "$0: missing qemu-io" + exit 77 +fi trap 'rm -f test-parallel-file.data test-parallel-file.out' 0 1 2 3 15 # Populate file, and sanity check that qemu-io can issue parallel requests printf '%1024s' . > test-parallel-file.data -$QEMU_IO -f raw -c "aio_write -P 1 0 512" -c "aio_write -P 2 512 512" \ +qemu-io -f raw -c "aio_write -P 1 0 512" -c "aio_write -P 2 512 512" \ -c aio_flush test-parallel-file.data || - { echo "'$QEMU_IO' can't drive parallel requests"; exit 77; } + { echo "'qemu-io' can't drive parallel requests"; exit 77; } # Set up the file plugin to delay both reads and writes (for a good chance # that parallel requests are in flight), and with writes longer than reads @@ -51,7 +57,7 @@ $QEMU_IO -f raw -c "aio_write -P 1 0 512" -c "aio_write -P 2 512 512" \ # With --threads=1, the write should complete first because it was issued first nbdkit -v -t 1 -U - --filter=delay file file=test-parallel-file.data \ - wdelay=2 rdelay=1 --run '$QEMU_IO -f raw -c "aio_write -P 2 512 512" \ + wdelay=2 rdelay=1 --run 'qemu-io -f raw -c "aio_write -P 2 512 512" \ -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-file.out if test "$(grep '512/512' test-parallel-file.out)" != \ @@ -62,7 +68,7 @@ fi # With default --threads, the faster read should complete first nbdkit -v -U - --filter=delay file file=test-parallel-file.data \ - wdelay=2 rdelay=1 --run '$QEMU_IO -f raw -c "aio_write -P 2 512 512" \ + wdelay=2 rdelay=1 --run 'qemu-io -f raw -c "aio_write -P 2 512 512" \ -c "aio_read -P 1 0 512" -c aio_flush $nbd' | tee test-parallel-file.out if test "$(grep '512/512' test-parallel-file.out)" != \ diff --git a/tests/test-parallel-nbd.sh b/tests/test-parallel-nbd.sh index fda0b7d..a8f0d2d 100755 --- a/tests/test-parallel-nbd.sh +++ b/tests/test-parallel-nbd.sh @@ -31,9 +31,15 @@ # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. -# Makefile sets $QEMU_IO, but it's also nice if the # script runs again -# standalone afterwards for diagnosing any failures -: ${QEMU_IO=qemu-io} +# Check file-data was created by Makefile and qemu-io exists. +if ! test -f file-data; then + echo "$0: missing file-data" + exit 77 +fi +if ! qemu-io --version; then + echo "$0: missing qemu-io" + exit 77 +fi # We require --exit-with-parent to work ( nbdkit --exit-with-parent --help ) >/dev/null 2>&1 || @@ -44,9 +50,9 @@ trap 'rm -f $files' 0 1 2 3 15 # Populate file, and sanity check that qemu-io can issue parallel requests printf '%1024s' . > test-parallel-nbd.data -$QEMU_IO -f raw -c "aio_write -P 1 0 512" -c "aio_write -P 2 512 512" \ +qemu-io -f raw -c "aio_write -P 1 0 512" -c "aio_write -P 2 512 512" \ -c aio_flush test-parallel-nbd.data || - { echo "'$QEMU_IO' can't drive parallel requests"; exit 77; } + { echo "'qemu-io' can't drive parallel requests"; exit 77; } # Set up the file plugin to delay both reads and writes (for a good chance # that parallel requests are in flight), and with writes longer than reads @@ -62,7 +68,7 @@ nbdkit --exit-with-parent -v -U test-parallel-nbd.sock \ # With --threads=1, the write should complete first because it was issued first nbdkit -v -t 1 -U - nbd socket=test-parallel-nbd.sock --run ' - $QEMU_IO -f raw -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" \ + qemu-io -f raw -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" \ -c aio_flush $nbd' | tee test-parallel-nbd.out if test "$(grep '512/512' test-parallel-nbd.out)" != \ "wrote 512/512 bytes at offset 512 @@ -72,7 +78,7 @@ fi # With default --threads, the faster read should complete first nbdkit -v -U - nbd socket=test-parallel-nbd.sock --run ' - $QEMU_IO -f raw -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" \ + qemu-io -f raw -c "aio_write -P 2 512 512" -c "aio_read -P 1 0 512" \ -c aio_flush $nbd' | tee test-parallel-nbd.out if test "$(grep '512/512' test-parallel-nbd.out)" != \ "read 512/512 bytes at offset 0 -- 2.13.2 _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://www.redhat.com/mailman/listinfo/libguestfs