All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Phil Sutter <phil@nwl.cc>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH v2 2/7] tests: monitor: Support running all tests in one go
Date: Tue, 2 Sep 2025 16:43:59 +0200	[thread overview]
Message-ID: <aLcCr2YxUkRFH6UH@calendula> (raw)
In-Reply-To: <20250829155203.29000-3-phil@nwl.cc>

On Fri, Aug 29, 2025 at 05:51:58PM +0200, Phil Sutter wrote:
> Detect RUN_FULL_TESTSUITE env variable set by automake and do an
> "unattended" full testrun.

This test is so small that I think it is better to enable both modes:
w/json and w/o json by default.

> Signed-off-by: Phil Sutter <phil@nwl.cc>
> ---
>  tests/monitor/run-tests.sh | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/tests/monitor/run-tests.sh b/tests/monitor/run-tests.sh
> index 969afe249201b..b8589344a9732 100755
> --- a/tests/monitor/run-tests.sh
> +++ b/tests/monitor/run-tests.sh
> @@ -58,7 +58,7 @@ json_output_filter() { # (filename)
>  monitor_run_test() {
>  	monitor_output=$(mktemp -p $testdir)
>  	monitor_args=""
> -	$test_json && monitor_args="vm json"
> +	$json_mode && monitor_args="vm json"
>  	local rc=0
>  
>  	$nft -nn monitor $monitor_args >$monitor_output &
> @@ -77,7 +77,7 @@ monitor_run_test() {
>  	sleep 0.5
>  	kill $monitor_pid
>  	wait >/dev/null 2>&1
> -	$test_json && json_output_filter $monitor_output
> +	$json_mode && json_output_filter $monitor_output
>  	mydiff -q $monitor_output $output_file >/dev/null 2>&1
>  	if [[ $rc == 0 && $? != 0 ]]; then
>  		err "monitor output differs!"
> @@ -156,20 +156,29 @@ while [ -n "$1" ]; do
>  	esac
>  done
>  
> -if $test_json; then
> -	variants="monitor"
> +if [[ $RUN_FULL_TESTSUITE == 1 ]]; then
> +	variants="monitor_json monitor echo"
> +elif $test_json; then
> +	variants="monitor_json"
>  else
>  	variants="monitor echo"
>  fi
>  
>  rc=0
>  for variant in $variants; do
> +	orig_variant=$variant
> +	if [[ $variant =~ .*_json ]]; then
> +		variant=${variant%_json}
> +		json_mode=true
> +	else
> +		json_mode=false
> +	fi
>  	run_test=${variant}_run_test
>  	output_append=${variant}_output_append
>  
>  	for testcase in ${testcases:-testcases/*.t}; do
>  		filename=$(basename $testcase)
> -		echo "$variant: running tests from file $filename"
> +		echo "$orig_variant: running tests from file $filename"
>  		rc_start=$rc
>  
>  		# files are like this:
> @@ -194,11 +203,11 @@ for variant in $variants; do
>  				;;
>  			O)
>  				input_complete=true
> -				$test_json || $output_append "$line"
> +				$json_mode || $output_append "$line"
>  				;;
>  			J)
>  				input_complete=true
> -				$test_json && $output_append "$line"
> +				$json_mode && $output_append "$line"
>  				;;
>  			'#'|'')
>  				# ignore comments and empty lines
> -- 
> 2.51.0
> 

  reply	other threads:[~2025-09-02 14:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29 15:51 [nft PATCH v2 0/7] Run all test suites via 'make check' Phil Sutter
2025-08-29 15:51 ` [nft PATCH v2 1/7] tests: Prepare exit codes for automake Phil Sutter
2025-08-29 15:51 ` [nft PATCH v2 2/7] tests: monitor: Support running all tests in one go Phil Sutter
2025-09-02 14:43   ` Pablo Neira Ayuso [this message]
2025-09-03 11:04     ` Phil Sutter
2025-08-29 15:51 ` [nft PATCH v2 3/7] tests: py: Set default options based on RUN_FULL_TESTSUITE Phil Sutter
2025-09-02 15:33   ` Pablo Neira Ayuso
2025-09-03 11:13     ` Phil Sutter
2025-08-29 15:52 ` [nft PATCH v2 4/7] tests: json_echo: Skip if run as non-root Phil Sutter
2025-08-29 15:52 ` [nft PATCH v2 5/7] tests: shell: Skip packetpath/nat_ftp in fake root env Phil Sutter
2025-08-29 15:52 ` [nft PATCH v2 6/7] tests: build: Do not assume caller's CWD Phil Sutter
2025-08-29 15:52 ` [nft PATCH v2 7/7] Makefile: Enable support for 'make check' Phil Sutter
2025-09-02 14:45   ` Pablo Neira Ayuso
2025-09-03 11:06     ` Phil Sutter
2025-09-03 11:11       ` Pablo Neira Ayuso
2025-09-03 11:17         ` Phil Sutter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aLcCr2YxUkRFH6UH@calendula \
    --to=pablo@netfilter.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=phil@nwl.cc \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.