[PATCH v2] tests: add tests for PR_CAP_AMBIENT, PR_CAPBSET_READ, PR_CAPBSET_DROP, PR_[GS]ET_FP_MODE, PR_MCE_KILL, PR_SVE_[GS]ET_VL, PR_[GS]ET_UNALIGN

Dmitry V. Levin ldv at altlinux.org
Wed Jun 2 20:59:22 UTC 2021


On Wed, Jun 02, 2021 at 02:55:30PM -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.
> ---
> 
>  Changes since V1:
>   - Updated commit message
>   - tests/prctl-capbset.test: Replaced grep filter with awk
>   - tests/prctl-sve.test: Same.
> 
>  I wasn't sure how to fix the grep filter without using negative lookaheads, so I
>  implemented the intended behavior with awk. I don't have access to MIPS hardware,
>  but I think this should work. Let me know if there's a better way of doing this.

We've got quite a few of these ugly grep expressions already,
and I'd prefer to replace all of them with something more robust.

What if we start every prctl test with a marker, e.g.
	syscall(__NR_prctl, -1U, -2U, -3U, -4U, -5U);
and filter out all prctl lines up to this marker from the log, e.g.
	sed '0,/^prctl(0xffffffff \/\* PR_??? \*\/, 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb) = -1 /d' \
		< "$LOG" > "$OUT"

When these ugly grep commands are replaced with this sed command,
most of our tests/prctl-*.test files would become essentially the same,
so it would make sense to create a universal tests/prctl.sh file
and use it in other prctl tests, most of them could be generated
from tests/gen_tests.in the same way as many ioctl.test based tests
(grep '+ioctl.test -' tests/gen_tests.in).

What do you think about this approach?


-- 
ldv


More information about the Strace-devel mailing list