[PATCH v3 1/2] tests: unify common code in prctl decoder tests

Dmitry V. Levin ldv at altlinux.org
Sun Jun 6 14:47:35 UTC 2021


On Thu, Jun 03, 2021 at 04:17:53PM -0400, Srikavin Ramkumar wrote:
> * tests/prctl.sh: Extract common test code.
> * tests/gen_tests.in: Add entries.

We usually list these entries.

> * tests/Makefile.am: Remove entries for deleted tests.

Likewise, e.g.
(DECODER_TESTS): Remove this, that, and that.
(EXTRA_DIST): Add this.

> * tests/prctl-arg2-intptr.c: Add marker to indicate start of expected output.

a marker, the start.

> * tests/prctl-arg2-intptr.test: Delete file.

It's remove rather than delete.

[...]
> diff --git a/tests/prctl-name.c b/tests/prctl-name.c
> index 419a31062..3b95361dd 100644
> --- a/tests/prctl-name.c
> +++ b/tests/prctl-name.c
> @@ -9,6 +9,7 @@
>   * SPDX-License-Identifier: GPL-2.0-or-later
>   */
>  
> +#include "scno.h"
>  #include "tests.h"

"tests.h" should be included first.

[...]
> diff --git a/tests/prctl.sh b/tests/prctl.sh
> new file mode 100644
> index 000000000..3d4f37d3f
> --- /dev/null
> +++ b/tests/prctl.sh
> @@ -0,0 +1,16 @@
> +#!/bin/sh
> +#
> +# Check prctl syscall decoding.
> +#
> +# Copyright (c) 2021 The strace developers.
> +# All rights reserved.
> +#
> +# SPDX-License-Identifier: LGPL-2.1-or-later
> +
> +. "${srcdir=.}/init.sh"
> +
> +check_prog sed
> +run_prog > /dev/null
> +run_strace -a25 -eprctl "$@" $args > "$EXP"
> +sed '0,/^prctl(0xffffffff \/\* PR_??? \*\/, 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb) = -1 /d' < "$LOG" > "$OUT"
> +match_diff "$OUT" "$EXP"

I don't think -a25 is needed in this file.

Overall this looks almost ready, but I have a question:
could we extend this approach to prctl-seccomp-filter-v.test,
prctl-seccomp-strict.test, and maybe even getuid.test?


-- 
ldv


More information about the Strace-devel mailing list