a0a3b4
From 15ec719501af349a3b02495d6151e3b92854572b Mon Sep 17 00:00:00 2001
a0a3b4
From: Harald Hoyer <harald@redhat.com>
a0a3b4
Date: Tue, 1 Mar 2016 12:32:23 +0100
a0a3b4
Subject: [PATCH] test/NBD: add checks for needed binaries
a0a3b4
a0a3b4
---
a0a3b4
 test/TEST-40-NBD/test.sh | 10 ++++++----
a0a3b4
 1 file changed, 6 insertions(+), 4 deletions(-)
a0a3b4
a0a3b4
diff --git a/test/TEST-40-NBD/test.sh b/test/TEST-40-NBD/test.sh
1755ca
index 1a6524de..848a103f 100755
a0a3b4
--- a/test/TEST-40-NBD/test.sh
a0a3b4
+++ b/test/TEST-40-NBD/test.sh
a0a3b4
@@ -95,7 +95,6 @@ client_test() {
a0a3b4
 }
a0a3b4
 
a0a3b4
 test_run() {
a0a3b4
-    modinfo nbd &>/dev/null || { echo "Kernel does not support nbd"; exit 1; }
a0a3b4
     if ! run_server; then
a0a3b4
         echo "Failed to start server" 1>&2
a0a3b4
         return 1
a0a3b4
@@ -325,9 +324,6 @@ make_server_root() {
a0a3b4
 }
a0a3b4
 
a0a3b4
 test_setup() {
a0a3b4
-
a0a3b4
-    modinfo nbd &>/dev/null || { echo "Kernel does not support nbd"; exit 1; }
a0a3b4
-
a0a3b4
     make_encrypted_root || return 1
a0a3b4
     make_client_root || return 1
a0a3b4
     make_server_root || return 1
a0a3b4
@@ -370,6 +366,12 @@ kill_server() {
a0a3b4
     fi
a0a3b4
 }
a0a3b4
 
a0a3b4
+test_check() {
a0a3b4
+    modinfo nbd &>/dev/null || { echo "Kernel does not support nbd"; return 1; }
a0a3b4
+    command -v nbd-client &>/dev/null || { echo "No nbd-client available"; return 1; }
a0a3b4
+    command -v nbd-server &>/dev/null || { echo "No nbd-server available"; return 1; }
a0a3b4
+}
a0a3b4
+
a0a3b4
 test_cleanup() {
a0a3b4
     kill_server
a0a3b4
 }