lib/tst_test.sh: add TST_MIN_KVER variable check

Message ID 1523877430-15821-1-git-send-email-alexey.kodanev@oracle.com
State Accepted
Delegated to: Cyril Hrubis
Headers show
Series
  • lib/tst_test.sh: add TST_MIN_KVER variable check
Related show

Commit Message

Alexey Kodanev April 16, 2018, 11:17 a.m.
Add the same behavior as in LTP C library with 'min_kver'.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/tst_test.sh |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

Comments

Cyril Hrubis April 17, 2018, 11:26 a.m. | #1
Hi!
Looks good, acked.
Alexey Kodanev April 17, 2018, 3:38 p.m. | #2
On 04/17/2018 02:26 PM, Cyril Hrubis wrote:
> Hi!
> Looks good, acked.

Applied.

Patch

diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index b7aa4a7..4ac09ef 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -251,7 +251,7 @@  tst_run()
 	if [ -n "$TST_TEST_PATH" ]; then
 		for tst_i in $(grep TST_ "$TST_TEST_PATH" | sed 's/.*TST_//; s/[="} \t\/:`].*//'); do
 			case "$tst_i" in
-			SETUP|CLEANUP|TESTFUNC|ID|CNT);;
+			SETUP|CLEANUP|TESTFUNC|ID|CNT|MIN_KVER);;
 			OPTS|USAGE|PARSE_ARGS|POS_ARGS);;
 			NEEDS_ROOT|NEEDS_TMPDIR|NEEDS_DEVICE|DEVICE);;
 			NEEDS_CMDS|NEEDS_MODULE|MODPATH|DATAROOT);;
@@ -290,6 +290,11 @@  tst_run()
 
 	tst_check_cmds $TST_NEEDS_CMDS
 
+	if [ -n "$TST_MIN_KVER" ]; then
+		tst_kvcmp -lt "$TST_MIN_KVER" && \
+			tst_brk TCONF "test requires kernel $TST_MIN_KVER+"
+	fi
+
 	if [ "$TST_NEEDS_TMPDIR" = 1 ]; then
 		if [ -z "$TMPDIR" ]; then
 			export TMPDIR="/tmp"