[Libguestfs] [PATCH nbdkit 2/2] tests: Add a test of VDDK + --run.

Richard W.M. Jones rjones at redhat.com
Wed Aug 5 10:29:44 UTC 2020


---
 tests/Makefile.am      |  8 +++---
 tests/test-vddk-run.sh | 56 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 676e7e68..79be5639 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -913,12 +913,13 @@ if HAVE_VDDK
 noinst_LTLIBRARIES += libvixDiskLib.la
 LIBGUESTFS_TESTS += test-vddk
 TESTS += \
-	test-vddk-reexec.sh \
 	test-vddk-dump-plugin.sh \
 	test-vddk-password-fd.sh \
 	test-vddk-password-interactive.sh \
-	test-vddk-real.sh \
 	test-vddk-real-dump-plugin.sh \
+	test-vddk-real.sh \
+	test-vddk-reexec.sh \
+	test-vddk-run.sh \
 	$(NULL)
 
 test_vddk_SOURCES = test-vddk.c test.h
@@ -944,9 +945,10 @@ EXTRA_DIST += \
 	test-vddk-dump-plugin.sh \
 	test-vddk-password-fd.sh \
 	test-vddk-password-interactive.sh \
-	test-vddk-real.sh \
 	test-vddk-real-dump-plugin.sh \
+	test-vddk-real.sh \
 	test-vddk-reexec.sh \
+	test-vddk-run.sh \
 	$(NULL)
 
 # zero plugin test.
diff --git a/tests/test-vddk-run.sh b/tests/test-vddk-run.sh
new file mode 100755
index 00000000..19055245
--- /dev/null
+++ b/tests/test-vddk-run.sh
@@ -0,0 +1,56 @@
+#!/usr/bin/env bash
+# nbdkit
+# Copyright (C) 2018-2020 Red Hat Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# * Neither the name of Red Hat nor the names of its contributors may be
+# used to endorse or promote products derived from this software without
+# specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+
+# Test VDDK + --run parameter.
+
+source ./functions.sh
+set -e
+set -x
+
+# Testing $LD_LIBRARY_PATH stuff breaks valgrind, so skip the rest of
+# this test if valgrinding.
+if [ "x$NBDKIT_VALGRIND" = "x1" ]; then
+    echo "$0: skipped LD_LIBRARY_PATH test when doing valgrind"
+    exit 77
+fi
+
+requires qemu-img --version
+
+out=test-vddk-run.out
+rm -f $out
+cleanup_fn rm -f $out
+
+nbdkit -U - vddk libdir=.libs /dev/null --run 'qemu-img info $nbd' > $out
+cat $out
+
+grep 'file format: raw' $out
+grep 'virtual size:.*524288 bytes' $out
-- 
2.27.0




More information about the Libguestfs mailing list