anitazha / rpms / ndctl

Forked from rpms/ndctl 2 years ago
Clone

Blame SOURCES/0011-ndctl-test-add-checking-the-presence-of-jq-command-a.patch

e0018b
From 7ce2fddfa3f108036a2d81de4d2e66ac29e4631e Mon Sep 17 00:00:00 2001
e0018b
From: QI Fuli <qi.fuli@fujitsu.com>
e0018b
Date: Wed, 3 Feb 2021 22:21:08 +0900
e0018b
Subject: [PATCH 011/217] ndctl/test: add checking the presence of jq command
e0018b
 ahead
e0018b
e0018b
Due to the lack of jq command, the result of the test will be 'fail'.
e0018b
This patch adds checking the presence of jq commmand ahead.
e0018b
If there is no jq command in the system, the test will be marked as 'skip'.
e0018b
e0018b
Signed-off-by: QI Fuli <qi.fuli@fujitsu.com>
e0018b
Link: https://github.com/pmem/ndctl/issues/141
e0018b
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
e0018b
Link: https://lore.kernel.org/r/20210203132108.6246-1-qi.fuli@fujitsu.com
e0018b
---
e0018b
 test/daxdev-errors.sh           | 1 +
e0018b
 test/inject-error.sh            | 2 ++
e0018b
 test/inject-smart.sh            | 1 +
e0018b
 test/label-compat.sh            | 1 +
e0018b
 test/max_available_extent_ns.sh | 1 +
e0018b
 test/monitor.sh                 | 2 ++
e0018b
 test/multi-dax.sh               | 1 +
e0018b
 test/sector-mode.sh             | 2 ++
e0018b
 8 files changed, 11 insertions(+)
e0018b
e0018b
diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
e0018b
index 6281f32..9547d78 100755
e0018b
--- a/test/daxdev-errors.sh
e0018b
+++ b/test/daxdev-errors.sh
e0018b
@@ -9,6 +9,7 @@ rc=77
e0018b
 . $(dirname $0)/common
e0018b
 
e0018b
 check_min_kver "4.12" || do_skip "lacks dax dev error handling"
e0018b
+check_prereq "jq"
e0018b
 
e0018b
 trap 'err $LINENO' ERR
e0018b
 
e0018b
diff --git a/test/inject-error.sh b/test/inject-error.sh
e0018b
index c636033..7d0b826 100755
e0018b
--- a/test/inject-error.sh
e0018b
+++ b/test/inject-error.sh
e0018b
@@ -11,6 +11,8 @@ err_count=8
e0018b
 
e0018b
 . $(dirname $0)/common
e0018b
 
e0018b
+check_prereq "jq"
e0018b
+
e0018b
 trap 'err $LINENO' ERR
e0018b
 
e0018b
 # sample json:
e0018b
diff --git a/test/inject-smart.sh b/test/inject-smart.sh
e0018b
index 94705df..4ca83b8 100755
e0018b
--- a/test/inject-smart.sh
e0018b
+++ b/test/inject-smart.sh
e0018b
@@ -166,6 +166,7 @@ do_tests()
e0018b
 }
e0018b
 
e0018b
 check_min_kver "4.19" || do_skip "kernel $KVER may not support smart (un)injection"
e0018b
+check_prereq "jq"
e0018b
 modprobe nfit_test
e0018b
 rc=1
e0018b
 
e0018b
diff --git a/test/label-compat.sh b/test/label-compat.sh
e0018b
index 340b93d..8ab2858 100755
e0018b
--- a/test/label-compat.sh
e0018b
+++ b/test/label-compat.sh
e0018b
@@ -10,6 +10,7 @@ BASE=$(dirname $0)
e0018b
 . $BASE/common
e0018b
 
e0018b
 check_min_kver "4.11" || do_skip "may not provide reliable isetcookie values"
e0018b
+check_prereq "jq"
e0018b
 
e0018b
 trap 'err $LINENO' ERR
e0018b
 
e0018b
diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
e0018b
index 14d741d..343f3c9 100755
e0018b
--- a/test/max_available_extent_ns.sh
e0018b
+++ b/test/max_available_extent_ns.sh
e0018b
@@ -9,6 +9,7 @@ rc=77
e0018b
 trap 'err $LINENO' ERR
e0018b
 
e0018b
 check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size"
e0018b
+check_prereq "jq"
e0018b
 
e0018b
 init()
e0018b
 {
e0018b
diff --git a/test/monitor.sh b/test/monitor.sh
e0018b
index cdab5e1..28c5541 100755
e0018b
--- a/test/monitor.sh
e0018b
+++ b/test/monitor.sh
e0018b
@@ -13,6 +13,8 @@ smart_supported_bus=""
e0018b
 
e0018b
 . $(dirname $0)/common
e0018b
 
e0018b
+check_prereq "jq"
e0018b
+
e0018b
 trap 'err $LINENO' ERR
e0018b
 
e0018b
 check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
e0018b
diff --git a/test/multi-dax.sh b/test/multi-dax.sh
e0018b
index e932569..8496619 100755
e0018b
--- a/test/multi-dax.sh
e0018b
+++ b/test/multi-dax.sh
e0018b
@@ -9,6 +9,7 @@ rc=77
e0018b
 . $(dirname $0)/common
e0018b
 
e0018b
 check_min_kver "4.13" || do_skip "may lack multi-dax support"
e0018b
+check_prereq "jq"
e0018b
 
e0018b
 trap 'err $LINENO' ERR
e0018b
 
e0018b
diff --git a/test/sector-mode.sh b/test/sector-mode.sh
e0018b
index dd7013e..54fa806 100755
e0018b
--- a/test/sector-mode.sh
e0018b
+++ b/test/sector-mode.sh
e0018b
@@ -6,6 +6,8 @@ rc=77
e0018b
 
e0018b
 . $(dirname $0)/common
e0018b
 
e0018b
+check_prereq "jq"
e0018b
+
e0018b
 set -e
e0018b
 trap 'err $LINENO' ERR
e0018b
 
e0018b
-- 
e0018b
2.27.0
e0018b