/
githubmirror
/
strace
Обзор
Документация
Войти
/
githubmirror
/
strace
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/strace-D.test
72 строки
2 KB
Dmitry V. Levin
Update copyright headers
15 июн 2026, 11:00
15 июн 2026, 11:00
726d2e4
Код
Авторство
О чём код?
#!/bin/sh -efu # # Check -D option. # # Copyright (c) 2019 Dmitry V. Levin <ldv@strace.io> # Copyright (c) 2019-2026 The strace developers. # All rights reserved. # # SPDX-License-Identifier: GPL-2.0-or-later . "${srcdir=.}/init.sh" check_prog sed run_prog_skip_if_failed \ kill -0 $$ get_parent_pid() { get_prefix_value 'PPid:[[:space:]]*' } get_tracer_pid() { get_prefix_value 'TracerPid:[[:space:]]*' } set -- ../print_ppid_tracerpid "$@" > "$LOG" || framework_skip_ "$* does not work" # not traced: PPid > 0, TracerPid == 0 [ "$(get_parent_pid < "$LOG")" -gt 0 ] && [ "$(get_tracer_pid < "$LOG")" -eq 0 ] || dump_log_and_fail_with "$*: unexpected output" # !-D: PPid > 0, TracerPid > 0, PPid == TracerPid run_strace -e q=attach,personality -enone "$@" > "$OUT" [ "$(get_parent_pid < "$OUT")" -gt 0 ] && [ "$(get_tracer_pid < "$OUT")" -gt 0 ] && [ "$(get_parent_pid < "$OUT")" = "$(get_tracer_pid < "$OUT")" ] || { cat < "$OUT" > "$LOG" dump_log_and_fail_with "$STRACE $args: unexpected output" } match_diff test_parent_tracer_pid() { local d parent_pid tracer_pid d="$1"; shift # -D/-DD/-DDD: PPid > 0, TracerPid > 0, PPid != TracerPid run_strace $d -q -enone "$@" > "$OUT" parent_pid="$(get_parent_pid < "$OUT")" && [ "$parent_pid" -gt 0 ] && tracer_pid="$(get_tracer_pid < "$OUT")" && [ "$tracer_pid" -gt 0 ] && [ "$parent_pid" != "$tracer_pid" ] || { cat < "$OUT" > "$LOG" dump_log_and_fail_with "$STRACE $args: unexpected output" } while kill -0 "$tracer_pid" 2> /dev/null; do $SLEEP_A_BIT done match_diff } test_parent_tracer_pid -D "$@" test_parent_tracer_pid -DD "$@" test_parent_tracer_pid -DDD "$@"