diff mbox

[nft] tests: shell: allow to execute a single testcase

Message ID 147930071248.11586.102674356702325099.stgit@nfdev2.cica.es
State Accepted
Delegated to: Pablo Neira
Headers show

Commit Message

Arturo Borrero Nov. 16, 2016, 12:51 p.m. UTC
From: Arturo Borrero Gonzalez <arturo@debian.org>

Using, for example:
 % sudo ./run-tests.sh testcase/mytest_0

Will result in an execution of this single testcase rather than
the complete suite.

This is useful while working with a concrete testcase.

Signed-off-by: Arturo Borrero Gonzalez <arturo@debian.org>
---
 tests/shell/run-tests.sh |   11 +++++++++++
 1 file changed, 11 insertions(+)


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Pablo Neira Ayuso Nov. 24, 2016, 12:01 p.m. UTC | #1
On Wed, Nov 16, 2016 at 01:51:52PM +0100, Arturo Borrero Gonzalez wrote:
> From: Arturo Borrero Gonzalez <arturo@debian.org>
> 
> Using, for example:
>  % sudo ./run-tests.sh testcase/mytest_0
> 
> Will result in an execution of this single testcase rather than
> the complete suite.
> 
> This is useful while working with a concrete testcase.

Applied, thanks Arturo.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/shell/run-tests.sh b/tests/shell/run-tests.sh
index d9c44c8..4e41893 100755
--- a/tests/shell/run-tests.sh
+++ b/tests/shell/run-tests.sh
@@ -43,6 +43,13 @@  if [ ! -x "$MODPROBE" ] ; then
 	msg_error "no modprobe binary found"
 fi
 
+if [ -x "$1" ] ; then
+	if grep ^.*${RETURNCODE_SEPARATOR}[0-9]\\+$ <<< $1 >/dev/null ; then
+		SINGLE=$1
+		VERBOSE=y
+	fi
+fi
+
 if [ "$1" == "-v" ] ; then
 	VERBOSE=y
 fi
@@ -65,6 +72,10 @@  kernel_cleanup() {
 }
 
 find_tests() {
+	if [ ! -z "$SINGLE" ] ; then
+		echo $SINGLE
+		return
+	fi
 	${FIND} ${TESTDIR} -executable -regex \
 		.*${RETURNCODE_SEPARATOR}[0-9]+ | sort
 }