linux-nvdimm.lists.01.org archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH] ndctl/test: add checking the presence of jq command ahead
@ 2021-02-03 13:21 QI Fuli
  2021-02-22  6:59 ` qi.fuli
  2021-02-25  9:45 ` Santosh Sivaraj
  0 siblings, 2 replies; 4+ messages in thread
From: QI Fuli @ 2021-02-03 13:21 UTC (permalink / raw)
  To: linux-nvdimm; +Cc: QI Fuli

Due to the lack of jq command, the result of the test will be 'fail'.
This patch adds checking the presence of jq commmand ahead.
If there is no jq command in the system, the test will be marked as 'skip'.

Signed-off-by: QI Fuli <qi.fuli@fujitsu.com>
Link: https://github.com/pmem/ndctl/issues/141
---
 test/daxdev-errors.sh           | 1 +
 test/inject-error.sh            | 2 ++
 test/inject-smart.sh            | 1 +
 test/label-compat.sh            | 1 +
 test/max_available_extent_ns.sh | 1 +
 test/monitor.sh                 | 2 ++
 test/multi-dax.sh               | 1 +
 test/sector-mode.sh             | 2 ++
 8 files changed, 11 insertions(+)

diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
index 6281f32..9547d78 100755
--- a/test/daxdev-errors.sh
+++ b/test/daxdev-errors.sh
@@ -9,6 +9,7 @@ rc=77
 . $(dirname $0)/common

 check_min_kver "4.12" || do_skip "lacks dax dev error handling"
+check_prereq "jq"

 trap 'err $LINENO' ERR

diff --git a/test/inject-error.sh b/test/inject-error.sh
index c636033..7d0b826 100755
--- a/test/inject-error.sh
+++ b/test/inject-error.sh
@@ -11,6 +11,8 @@ err_count=8

 . $(dirname $0)/common

+check_prereq "jq"
+
 trap 'err $LINENO' ERR

 # sample json:
diff --git a/test/inject-smart.sh b/test/inject-smart.sh
index 94705df..4ca83b8 100755
--- a/test/inject-smart.sh
+++ b/test/inject-smart.sh
@@ -166,6 +166,7 @@ do_tests()
 }

 check_min_kver "4.19" || do_skip "kernel $KVER may not support smart (un)injection"
+check_prereq "jq"
 modprobe nfit_test
 rc=1

diff --git a/test/label-compat.sh b/test/label-compat.sh
index 340b93d..8ab2858 100755
--- a/test/label-compat.sh
+++ b/test/label-compat.sh
@@ -10,6 +10,7 @@ BASE=$(dirname $0)
 . $BASE/common

 check_min_kver "4.11" || do_skip "may not provide reliable isetcookie values"
+check_prereq "jq"

 trap 'err $LINENO' ERR

diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
index 14d741d..343f3c9 100755
--- a/test/max_available_extent_ns.sh
+++ b/test/max_available_extent_ns.sh
@@ -9,6 +9,7 @@ rc=77
 trap 'err $LINENO' ERR

 check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size"
+check_prereq "jq"

 init()
 {
diff --git a/test/monitor.sh b/test/monitor.sh
index cdab5e1..28c5541 100755
--- a/test/monitor.sh
+++ b/test/monitor.sh
@@ -13,6 +13,8 @@ smart_supported_bus=""

 . $(dirname $0)/common

+check_prereq "jq"
+
 trap 'err $LINENO' ERR

 check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
diff --git a/test/multi-dax.sh b/test/multi-dax.sh
index e932569..8496619 100755
--- a/test/multi-dax.sh
+++ b/test/multi-dax.sh
@@ -9,6 +9,7 @@ rc=77
 . $(dirname $0)/common

 check_min_kver "4.13" || do_skip "may lack multi-dax support"
+check_prereq "jq"

 trap 'err $LINENO' ERR

diff --git a/test/sector-mode.sh b/test/sector-mode.sh
index dd7013e..54fa806 100755
--- a/test/sector-mode.sh
+++ b/test/sector-mode.sh
@@ -6,6 +6,8 @@ rc=77

 . $(dirname $0)/common

+check_prereq "jq"
+
 set -e
 trap 'err $LINENO' ERR

--
2.29.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [ndctl PATCH] ndctl/test: add checking the presence of jq command ahead
  2021-02-03 13:21 [ndctl PATCH] ndctl/test: add checking the presence of jq command ahead QI Fuli
@ 2021-02-22  6:59 ` qi.fuli
  2021-02-25  9:45 ` Santosh Sivaraj
  1 sibling, 0 replies; 4+ messages in thread
From: qi.fuli @ 2021-02-22  6:59 UTC (permalink / raw)
  To: linux-nvdimm

Ping

> -----Original Message-----
> From: QI Fuli <qi.fuli@fujitsu.com>
> Sent: Wednesday, February 3, 2021 10:21 PM
> To: linux-nvdimm@lists.01.org
> Cc: QI Fuli <qi.fuli@fujitsu.com>
> Subject: [ndctl PATCH] ndctl/test: add checking the presence of jq command
> ahead
> 
> Due to the lack of jq command, the result of the test will be 'fail'.
> This patch adds checking the presence of jq commmand ahead.
> If there is no jq command in the system, the test will be marked as 'skip'.
> 
> Signed-off-by: QI Fuli <qi.fuli@fujitsu.com>
> Link: https://github.com/pmem/ndctl/issues/141
> ---
>  test/daxdev-errors.sh           | 1 +
>  test/inject-error.sh            | 2 ++
>  test/inject-smart.sh            | 1 +
>  test/label-compat.sh            | 1 +
>  test/max_available_extent_ns.sh | 1 +
>  test/monitor.sh                 | 2 ++
>  test/multi-dax.sh               | 1 +
>  test/sector-mode.sh             | 2 ++
>  8 files changed, 11 insertions(+)
> 
> diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh index
> 6281f32..9547d78 100755
> --- a/test/daxdev-errors.sh
> +++ b/test/daxdev-errors.sh
> @@ -9,6 +9,7 @@ rc=77
>  . $(dirname $0)/common
> 
>  check_min_kver "4.12" || do_skip "lacks dax dev error handling"
> +check_prereq "jq"
> 
>  trap 'err $LINENO' ERR
> 
> diff --git a/test/inject-error.sh b/test/inject-error.sh index c636033..7d0b826
> 100755
> --- a/test/inject-error.sh
> +++ b/test/inject-error.sh
> @@ -11,6 +11,8 @@ err_count=8
> 
>  . $(dirname $0)/common
> 
> +check_prereq "jq"
> +
>  trap 'err $LINENO' ERR
> 
>  # sample json:
> diff --git a/test/inject-smart.sh b/test/inject-smart.sh index 94705df..4ca83b8
> 100755
> --- a/test/inject-smart.sh
> +++ b/test/inject-smart.sh
> @@ -166,6 +166,7 @@ do_tests()
>  }
> 
>  check_min_kver "4.19" || do_skip "kernel $KVER may not support smart
> (un)injection"
> +check_prereq "jq"
>  modprobe nfit_test
>  rc=1
> 
> diff --git a/test/label-compat.sh b/test/label-compat.sh index 340b93d..8ab2858
> 100755
> --- a/test/label-compat.sh
> +++ b/test/label-compat.sh
> @@ -10,6 +10,7 @@ BASE=$(dirname $0)
>  . $BASE/common
> 
>  check_min_kver "4.11" || do_skip "may not provide reliable isetcookie values"
> +check_prereq "jq"
> 
>  trap 'err $LINENO' ERR
> 
> diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
> index 14d741d..343f3c9 100755
> --- a/test/max_available_extent_ns.sh
> +++ b/test/max_available_extent_ns.sh
> @@ -9,6 +9,7 @@ rc=77
>  trap 'err $LINENO' ERR
> 
>  check_min_kver "4.19" || do_skip "kernel $KVER may not support
> max_available_size"
> +check_prereq "jq"
> 
>  init()
>  {
> diff --git a/test/monitor.sh b/test/monitor.sh index cdab5e1..28c5541 100755
> --- a/test/monitor.sh
> +++ b/test/monitor.sh
> @@ -13,6 +13,8 @@ smart_supported_bus=""
> 
>  . $(dirname $0)/common
> 
> +check_prereq "jq"
> +
>  trap 'err $LINENO' ERR
> 
>  check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor
> service"
> diff --git a/test/multi-dax.sh b/test/multi-dax.sh index e932569..8496619
> 100755
> --- a/test/multi-dax.sh
> +++ b/test/multi-dax.sh
> @@ -9,6 +9,7 @@ rc=77
>  . $(dirname $0)/common
> 
>  check_min_kver "4.13" || do_skip "may lack multi-dax support"
> +check_prereq "jq"
> 
>  trap 'err $LINENO' ERR
> 
> diff --git a/test/sector-mode.sh b/test/sector-mode.sh index dd7013e..54fa806
> 100755
> --- a/test/sector-mode.sh
> +++ b/test/sector-mode.sh
> @@ -6,6 +6,8 @@ rc=77
> 
>  . $(dirname $0)/common
> 
> +check_prereq "jq"
> +
>  set -e
>  trap 'err $LINENO' ERR
> 
> --
> 2.29.2
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ndctl PATCH] ndctl/test: add checking the presence of jq command ahead
  2021-02-03 13:21 [ndctl PATCH] ndctl/test: add checking the presence of jq command ahead QI Fuli
  2021-02-22  6:59 ` qi.fuli
@ 2021-02-25  9:45 ` Santosh Sivaraj
  2021-02-26 10:11   ` qi.fuli
  1 sibling, 1 reply; 4+ messages in thread
From: Santosh Sivaraj @ 2021-02-25  9:45 UTC (permalink / raw)
  To: QI Fuli, linux-nvdimm; +Cc: QI Fuli


Hi QI,

QI Fuli <qi.fuli@fujitsu.com> writes:

> Due to the lack of jq command, the result of the test will be 'fail'.
> This patch adds checking the presence of jq commmand ahead.
> If there is no jq command in the system, the test will be marked as 'skip'.
>
> Signed-off-by: QI Fuli <qi.fuli@fujitsu.com>
> Link: https://github.com/pmem/ndctl/issues/141

Could this dependency be made part of configure.ac? Something like

diff --git a/configure.ac b/configure.ac
index 5ec8d2f..0f2c6c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -65,6 +65,13 @@ fi
 AC_SUBST([XMLTO])
 fi
 
+AC_CHECK_PROG(JQ, [jq], [$(which jq)], [missing])
+if test "x$JQ" = xmissing; then
+       AC_MSG_ERROR([jq needed to validate tests])
+fi
+AC_SUBST([JQ])
+
+
 AC_C_TYPEOF
 AC_DEFINE([HAVE_STATEMENT_EXPR], 1, [Define to 1 if you have statement expressions.])

Thanks,
Santosh

> ---
>  test/daxdev-errors.sh           | 1 +
>  test/inject-error.sh            | 2 ++
>  test/inject-smart.sh            | 1 +
>  test/label-compat.sh            | 1 +
>  test/max_available_extent_ns.sh | 1 +
>  test/monitor.sh                 | 2 ++
>  test/multi-dax.sh               | 1 +
>  test/sector-mode.sh             | 2 ++
>  8 files changed, 11 insertions(+)
>
> diff --git a/test/daxdev-errors.sh b/test/daxdev-errors.sh
> index 6281f32..9547d78 100755
> --- a/test/daxdev-errors.sh
> +++ b/test/daxdev-errors.sh
> @@ -9,6 +9,7 @@ rc=77
>  . $(dirname $0)/common
>
>  check_min_kver "4.12" || do_skip "lacks dax dev error handling"
> +check_prereq "jq"
>
>  trap 'err $LINENO' ERR
>
> diff --git a/test/inject-error.sh b/test/inject-error.sh
> index c636033..7d0b826 100755
> --- a/test/inject-error.sh
> +++ b/test/inject-error.sh
> @@ -11,6 +11,8 @@ err_count=8
>
>  . $(dirname $0)/common
>
> +check_prereq "jq"
> +
>  trap 'err $LINENO' ERR
>
>  # sample json:
> diff --git a/test/inject-smart.sh b/test/inject-smart.sh
> index 94705df..4ca83b8 100755
> --- a/test/inject-smart.sh
> +++ b/test/inject-smart.sh
> @@ -166,6 +166,7 @@ do_tests()
>  }
>
>  check_min_kver "4.19" || do_skip "kernel $KVER may not support smart (un)injection"
> +check_prereq "jq"
>  modprobe nfit_test
>  rc=1
>
> diff --git a/test/label-compat.sh b/test/label-compat.sh
> index 340b93d..8ab2858 100755
> --- a/test/label-compat.sh
> +++ b/test/label-compat.sh
> @@ -10,6 +10,7 @@ BASE=$(dirname $0)
>  . $BASE/common
>
>  check_min_kver "4.11" || do_skip "may not provide reliable isetcookie values"
> +check_prereq "jq"
>
>  trap 'err $LINENO' ERR
>
> diff --git a/test/max_available_extent_ns.sh b/test/max_available_extent_ns.sh
> index 14d741d..343f3c9 100755
> --- a/test/max_available_extent_ns.sh
> +++ b/test/max_available_extent_ns.sh
> @@ -9,6 +9,7 @@ rc=77
>  trap 'err $LINENO' ERR
>
>  check_min_kver "4.19" || do_skip "kernel $KVER may not support max_available_size"
> +check_prereq "jq"
>
>  init()
>  {
> diff --git a/test/monitor.sh b/test/monitor.sh
> index cdab5e1..28c5541 100755
> --- a/test/monitor.sh
> +++ b/test/monitor.sh
> @@ -13,6 +13,8 @@ smart_supported_bus=""
>
>  . $(dirname $0)/common
>
> +check_prereq "jq"
> +
>  trap 'err $LINENO' ERR
>
>  check_min_kver "4.15" || do_skip "kernel $KVER may not support monitor service"
> diff --git a/test/multi-dax.sh b/test/multi-dax.sh
> index e932569..8496619 100755
> --- a/test/multi-dax.sh
> +++ b/test/multi-dax.sh
> @@ -9,6 +9,7 @@ rc=77
>  . $(dirname $0)/common
>
>  check_min_kver "4.13" || do_skip "may lack multi-dax support"
> +check_prereq "jq"
>
>  trap 'err $LINENO' ERR
>
> diff --git a/test/sector-mode.sh b/test/sector-mode.sh
> index dd7013e..54fa806 100755
> --- a/test/sector-mode.sh
> +++ b/test/sector-mode.sh
> @@ -6,6 +6,8 @@ rc=77
>
>  . $(dirname $0)/common
>
> +check_prereq "jq"
> +
>  set -e
>  trap 'err $LINENO' ERR
>
> --
> 2.29.2
> _______________________________________________
> Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
> To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [ndctl PATCH] ndctl/test: add checking the presence of jq command ahead
  2021-02-25  9:45 ` Santosh Sivaraj
@ 2021-02-26 10:11   ` qi.fuli
  0 siblings, 0 replies; 4+ messages in thread
From: qi.fuli @ 2021-02-26 10:11 UTC (permalink / raw)
  To: 'Santosh Sivaraj', linux-nvdimm; +Cc: qi.fuli

> 
> Hi QI,
> 
> QI Fuli <qi.fuli@fujitsu.com> writes:
> 
> > Due to the lack of jq command, the result of the test will be 'fail'.
> > This patch adds checking the presence of jq commmand ahead.
> > If there is no jq command in the system, the test will be marked as 'skip'.
> >
> > Signed-off-by: QI Fuli <qi.fuli@fujitsu.com>
> > Link: https://github.com/pmem/ndctl/issues/141
> 
> Could this dependency be made part of configure.ac? Something like
> 
> diff --git a/configure.ac b/configure.ac index 5ec8d2f..0f2c6c1 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -65,6 +65,13 @@ fi
>  AC_SUBST([XMLTO])
>  fi
> 
> +AC_CHECK_PROG(JQ, [jq], [$(which jq)], [missing]) if test "x$JQ" =
> +xmissing; then
> +       AC_MSG_ERROR([jq needed to validate tests]) fi
> +AC_SUBST([JQ])
> +
> +
>  AC_C_TYPEOF
>  AC_DEFINE([HAVE_STATEMENT_EXPR], 1, [Define to 1 if you have statement
> expressions.])
> 
> Thanks,
> Santosh

Hi Santosh,

Thank you very much for the comments.
Yes, making this dependency part of configure.ac sounds good.
Meanwhile I think the tests should be improved, because the test result should not be "fail" if there is no jq command in the system.
I will make a V2 patch.

Best,
QI
_______________________________________________
Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org
To unsubscribe send an email to linux-nvdimm-leave@lists.01.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-26 10:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 13:21 [ndctl PATCH] ndctl/test: add checking the presence of jq command ahead QI Fuli
2021-02-22  6:59 ` qi.fuli
2021-02-25  9:45 ` Santosh Sivaraj
2021-02-26 10:11   ` qi.fuli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).