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@xxxxxx> > --- > 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 >