Skip to contentSkip to conversation

Check for -i0

PATCH In review Petr Vorel 2 participants 6 messages May 20, 2022 – Jun 2, 2022 Library code

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

cover Check for -i0

NOTE: this should be merged after Cyril's runtime patch (will need to get rebased).

Kind regards,
Petr

Petr Vorel (3):
tst_test.sh: Allow -i0
tst_test: Check for -i >= 0
doc/maintainer: Check also -i0

 doc/maintainer-patch-review-checklist.txt | 1 +
 lib/tst_test.c                            | 2 ++
 testcases/lib/tst_test.sh                 | 4 ++--
 3 files changed, 5 insertions(+), 2 deletions(-)
Signature · 5 lines
2.36.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

PATCH 1/3 tst_test.sh: Allow -i0

-i0 is supported in C API, allowing to test only that setup and cleanup are coded properly (no test is being run), which is useful for debugging.

---
 testcases/lib/tst_test.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
testcases/lib/tst_test.sh +2 -2
index 28b7d12ba..c6e0752f3 100644
@@ -646,8 +646,8 @@ tst_run()
 		tst_brk TBROK "Expected number (-i) not '$TST_ITERATIONS'"
 	fi
 
-	if [ "$TST_ITERATIONS" -le 0 ]; then
-		tst_brk TBROK "Number of iterations (-i) must be > 0"
+	if [ "$TST_ITERATIONS" -lt 0 ]; then
+		tst_brk TBROK "Number of iterations (-i) must be >= 0"
 	fi
 
 	[ "$TST_NEEDS_ROOT" = 1 ] && tst_require_root
Signature · 5 lines
2.36.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#2 lore raw

PATCH 2/3 tst_test: Check for -i >= 0

In reply to Petr Vorel
---
 lib/tst_test.c | 2 ++
 1 file changed, 2 insertions(+)
lib/tst_test.c +2 -0
index 8e258594a..34cf1333b 100644
@@ -618,6 +618,8 @@ static void parse_opts(int argc, char *argv[])
 			exit(0);
 		case 'i':
 			iterations = atoi(optarg);
+			if (iterations < 0)
+				tst_brk(TBROK, "Number of iterations (-i) must be >= 0");
 		break;
 		case 'I':
 			duration = atof(optarg);
Signature · 5 lines
2.36.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#3 lore raw

PATCH 3/3 doc/maintainer: Check also -i0

In reply to Petr Vorel
---
 doc/maintainer-patch-review-checklist.txt | 1 +
 1 file changed, 1 insertion(+)
doc/maintainer-patch-review-checklist.txt +1 -0
index 4e10dc514..5d3c6886a 100644
@@ -30,6 +30,7 @@ New test should
 * Have a record in runtest file
 * Test should work fine with more than one iteration
   (e.g. run with `-i 100`)
+* Run with `-i 0` to check that setup and cleanup are coded properly (no test is being run)
 * Have a brief description
 * License: the default license for new tests is GPL v2 or later, use
   GPL-2.0-or-later; the licence for test (e.g. GPL-2.0) should not change
Signature · 5 lines
2.36.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#5 lore raw

Hi Cyril,

Quoted 2 lines

Hi!
Looks good to me:

Thanks, merged!

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp