netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [nft PATCH] tests: shell: allow to execute a single testcase
@ 2016-11-16 12:51 Arturo Borrero Gonzalez
  2016-11-24 12:01 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Arturo Borrero Gonzalez @ 2016-11-16 12:51 UTC (permalink / raw)
  To: netfilter-devel

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(+)

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
 }


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

* Re: [nft PATCH] tests: shell: allow to execute a single testcase
  2016-11-16 12:51 [nft PATCH] tests: shell: allow to execute a single testcase Arturo Borrero Gonzalez
@ 2016-11-24 12:01 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2016-11-24 12:01 UTC (permalink / raw)
  To: Arturo Borrero Gonzalez; +Cc: netfilter-devel

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.

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

end of thread, other threads:[~2016-11-24 12:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-16 12:51 [nft PATCH] tests: shell: allow to execute a single testcase Arturo Borrero Gonzalez
2016-11-24 12:01 ` Pablo Neira Ayuso

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).