[PATCH] tests: improve test coverage of prctl syscall decoder

Dmitry V. Levin ldv at altlinux.org
Tue Jun 1 23:41:03 UTC 2021


Hi,

On Tue, Mar 23, 2021 at 07:39:45PM -0400, Srikavin Ramkumar wrote:
> * tests/.gitignore: Add new test binaries.
> * tests/Makefile.am: Add new tests.
> * tests/pure_executables.list: Likewise.
> * tests/prctl-cap-ambient.c: New file.
> * tests/prctl-cap-ambient.test: Likewise.
> * tests/prctl-capbset.c: Likewise.
> * tests/prctl-capbset.test: Likewise.
> * tests/prctl-fp-mode.c: Likewise.
> * tests/prctl-fp-mode.test: Likewise.
> * tests/prctl-mce-kill.c: Likewise.
> * tests/prctl-mce-kill.test: Likewise.
> * tests/prctl-sve.c: Likewise.
> * tests/prctl-sve.test: Likewise.
> * tests/prctl-unalign.c: Likewise.
> * tests/prctl-unalign.test: Likewise.

I suggest to mention in the commit message the list of prctl operations
covered by this change.

[...]
> diff --git a/tests/prctl-capbset.test b/tests/prctl-capbset.test
> new file mode 100755
> index 00000000..2002bcdd
> --- /dev/null
> +++ b/tests/prctl-capbset.test
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# Check decoding of prctl PR_CAPBSET_READ/PR_CAPBSET_DROP operations.
> +#
> +# Copyright (c) 2021 The strace developers.
> +# All rights reserved.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +. "${srcdir=.}/init.sh"
> +
> +check_prog grep
> +run_prog > /dev/null
> +run_strace -a21 -eprctl $args > "$EXP"
> +grep -Ev '^prctl\(PR_[^C][^A][^P][^B][^S][^E][^T]_(DROP|READ)' < "$LOG" > "$OUT"

I've tried this patch on mips, and here grep failed to filter out
prctl(PR_GET_FP_MODE)

[...]
> diff --git a/tests/prctl-sve.test b/tests/prctl-sve.test
> new file mode 100755
> index 00000000..14c2805f
> --- /dev/null
> +++ b/tests/prctl-sve.test
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# Check decoding of prctl PR_SVE_SET_VL/PR_SVE_GET_VL operations.
> +#
> +# Copyright (c) 2021 The strace developers.
> +# All rights reserved.
> +#
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +
> +. "${srcdir=.}/init.sh"
> +
> +check_prog grep
> +run_prog > /dev/null
> +run_strace -a21 -eprctl $args > "$EXP"
> +grep -v '^prctl(PR_[^S][^V][^E]_[GS]ET_[^V][^L]' < "$LOG" > "$OUT"

Likewise, this grep failed to filter out prctl(PR_GET_FP_MODE).


-- 
ldv


More information about the Strace-devel mailing list