Subject: Re: [PATCH 1/2] test-lib: show missing prereq summary

From: Ævar Arnfjörð Bjarmason <[email-masked]>
Date: Mon, 15 Nov 2021 18:44:14 +0100

On Mon, Nov 15 2021, Fabian Stelzer wrote:

> When running the full test suite many tests can be skipped because of
> missing prerequisites. It not easy right now to get an overview of which
> ones are missing.
> When switching to a new machine or environment some libraries and tools
> might be missing or maybe a dependency broke completely. In this case
> the tests would indicate nothing since all dependant tests are simply
> skipped. This could hide broken behaviour or missing features in the
> build. Therefore this patch summarizes the missing prereqs at the end of
> the test run making it easier to spot such cases.
>
>  - Add failed prereqs to the test results.
>  - Aggregate and then show them with the totals.
>
> Signed-off-by: Fabian Stelzer <[email-masked]>
> ---
>  t/aggregate-results.sh | 17 +++++++++++++++++
>  t/test-lib.sh          | 11 +++++++++++
>  2 files changed, 28 insertions(+)
>
> diff --git a/t/aggregate-results.sh b/t/aggregate-results.sh
> index 7913e206ed..87c16fcee1 100755
> --- a/t/aggregate-results.sh
> +++ b/t/aggregate-results.sh
> @@ -6,6 +6,7 @@ success=0
>  failed=0
>  broken=0
>  total=0
> +missing_prereq=
>  
>  while read file
>  do
> @@ -30,10 +31,26 @@ do
>  			broken=$(($broken + $value)) ;;
>  		total)
>  			total=$(($total + $value)) ;;
> +		missing_prereq)
> +			missing_prereq="$missing_prereq,$value" ;;
>  		esac
>  	done <"$file"
>  done
>  
> +if test -n "$missing_prereq"
> +then
> +	unique_missing_prereq=$(
> +		echo $missing_prereq |
> +		tr -s "," "\n" |
> +		grep -v '^$' |
> +		sort -u |
> +		paste -s -d ',')

What is paste? Some out-of-tree debugging utility?

I think you might find a better way to do this shown in my
"ab/generate-command-list" topic, currently in seen. It removed most of
the same sort of tr|grep|sort etc. chain in generate-cmdlist.sh.