Blame SOURCES/0013-tests-monitor-Support-running-individual-test-cases.patch

f1d1c0
From 67f168ebfbeb26a8d7e4f1b9284cc32f13ceff9b Mon Sep 17 00:00:00 2001
f1d1c0
From: Phil Sutter <psutter@redhat.com>
f1d1c0
Date: Wed, 12 Feb 2020 22:35:27 +0100
f1d1c0
Subject: [PATCH] tests: monitor: Support running individual test cases
f1d1c0
f1d1c0
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1754047
f1d1c0
Upstream Status: nftables commit eb5034108cdc6
f1d1c0
f1d1c0
commit eb5034108cdc60341b2d61599077db935b6bbc4f
f1d1c0
Author: Phil Sutter <phil@nwl.cc>
f1d1c0
Date:   Fri Jan 10 11:15:45 2020 +0100
f1d1c0
f1d1c0
    tests: monitor: Support running individual test cases
f1d1c0
f1d1c0
    Recognize testcase paths on command line and limit testing on those
f1d1c0
    only.
f1d1c0
f1d1c0
    Signed-off-by: Phil Sutter <phil@nwl.cc>
f1d1c0
    Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
f1d1c0
---
f1d1c0
 tests/monitor/run-tests.sh | 9 +++++++--
f1d1c0
 1 file changed, 7 insertions(+), 2 deletions(-)
f1d1c0
f1d1c0
diff --git a/tests/monitor/run-tests.sh b/tests/monitor/run-tests.sh
f1d1c0
index 0478cf6..efacdaa 100755
f1d1c0
--- a/tests/monitor/run-tests.sh
f1d1c0
+++ b/tests/monitor/run-tests.sh
f1d1c0
@@ -108,6 +108,7 @@ echo_run_test() {
f1d1c0
 	touch $output_file
f1d1c0
 }
f1d1c0
 
f1d1c0
+testcases=""
f1d1c0
 while [ -n "$1" ]; do
f1d1c0
 	case "$1" in
f1d1c0
 	-d|--debug)
f1d1c0
@@ -118,11 +119,15 @@ while [ -n "$1" ]; do
f1d1c0
 		test_json=true
f1d1c0
 		shift
f1d1c0
 		;;
f1d1c0
+	testcases/*.t)
f1d1c0
+		testcases+=" $1"
f1d1c0
+		shift
f1d1c0
+		;;
f1d1c0
 	*)
f1d1c0
 		echo "unknown option '$1'"
f1d1c0
 		;&
f1d1c0
 	-h|--help)
f1d1c0
-		echo "Usage: $(basename $0) [-j|--json] [-d|--debug]"
f1d1c0
+		echo "Usage: $(basename $0) [-j|--json] [-d|--debug] [testcase ...]"
f1d1c0
 		exit 1
f1d1c0
 		;;
f1d1c0
 	esac
f1d1c0
@@ -138,7 +143,7 @@ for variant in $variants; do
f1d1c0
 	run_test=${variant}_run_test
f1d1c0
 	output_append=${variant}_output_append
f1d1c0
 
f1d1c0
-	for testcase in testcases/*.t; do
f1d1c0
+	for testcase in ${testcases:-testcases/*.t}; do
f1d1c0
 		echo "$variant: running tests from file $(basename $testcase)"
f1d1c0
 		# files are like this:
f1d1c0
 		#
f1d1c0
-- 
f1d1c0
1.8.3.1
f1d1c0