Re: [PATCH bpf-next] selftests/bpf: Add verbosity to ima_setup.sh

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 4, 2020 at 7:25 AM KP Singh <kpsingh@xxxxxxxxxxxx> wrote:
>
> From: KP Singh <kpsingh@xxxxxxxxxx>
>
> Currently, ima_setup.sh spews outputs from commands like mkfs and dd
> on the terminal without taking into account the verbosity level of
> the test framework. Add an option to specify the verbosity for the
> shell script and only print output when verbosity > VERBOSE_NONE.
>
> Since the command line parsing got complicated with the addition of
> verbosity, switched "action" (-a, --action) and "directory" (-d, --dir)
> to command line switches as well.
>
> Fixes: 34b82d3ac105 ("bpf: Add a selftest for bpf_ima_inode_hash")
> Reported-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> Signed-off-by: KP Singh <kpsingh@xxxxxxxxxx>
> ---
>  tools/testing/selftests/bpf/ima_setup.sh      | 36 ++++++++++++++++---
>  .../selftests/bpf/prog_tests/test_ima.c       | 11 ++++--
>  2 files changed, 40 insertions(+), 7 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/ima_setup.sh b/tools/testing/selftests/bpf/ima_setup.sh
> index 2bfc646bc230..d8d063fa7781 100755
> --- a/tools/testing/selftests/bpf/ima_setup.sh
> +++ b/tools/testing/selftests/bpf/ima_setup.sh
> @@ -10,7 +10,7 @@ TEST_BINARY="/bin/true"
>
>  usage()
>  {
> -       echo "Usage: $0 <setup|cleanup|run> <existing_tmp_dir>"
> +       echo "Usage: $0 -a <setup|cleanup|run> -d <existing_tmp_dir> -v <yes|no>"

why -v <yes|no> vs common -v for verbose, and lack of -v for
non-verbose? Seems much cleaner? Yes, C code will need to deal with it
in a bit different way than you implemented it currently.

But honestly, even just setting envvar would do. This script is for
selftests only, so test_progs could have a convention of
SELFTESTS_VERBOSE=1 for verbose mode or something. No arguments
needed.

>         exit 1
>  }
>

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux