strace/tests/ioctl_perf-success.test
Eugene Syromyatnikov bd19a4d271 tests: check decoding of successful PERF_EVENT_IOC_{ID,QUERY_BPF} ioctls
As these have some argument output on the exit path.

* tests/ioctl_perf-success.c: New file.
* tests/ioctl_perf-success.test: New test.
* tests/Makefile.am (DECODER_TESTS): Add it.
(check_PROGRAMS): Add ioctl_perf-success.
* tests/.gitignore: Likewise.
* tests/ioctl_perf.c: Remove TODO.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
2018-05-28 17:34:50 +00:00

16 lines
452 B
Bash
Executable File

#!/bin/sh -efu
# Check decoding of successful PERF_EVENT_IOC_{ID,QUERY_BPF} ioctls.
. "${srcdir=.}/scno_tampering.sh"
: ${IOCTL_INJECT_START=256}
: ${IOCTL_INJECT_RETVAL=42}
run_prog
run_strace -a35 -e trace=ioctl \
-e inject=ioctl:retval="${IOCTL_INJECT_RETVAL}":when="${IOCTL_INJECT_START}+" \
../ioctl_perf-success "${IOCTL_INJECT_START}" "${IOCTL_INJECT_RETVAL}" > "$EXP"
grep -v '^ioctl([012][,<]' < "$LOG" > "$OUT"
match_diff "$OUT" "$EXP"