]> granicus.if.org Git - strace/blob - tests/bexecve.test
Update copyright headers
[strace] / tests / bexecve.test
1 #!/bin/sh
2 #
3 # Check -bexecve behavior.
4 #
5 # Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
6 # Copyright (c) 2015-2018 The strace developers.
7 # All rights reserved.
8 #
9 # SPDX-License-Identifier: GPL-2.0-or-later
10
11 . "${srcdir=.}/init.sh"
12
13 run_strace_redir()
14 {
15         args="$*"
16         $STRACE "$@" 2> "$LOG"
17 }
18
19 run_strace_redir -enone ../set_ptracer_any true ||
20         dump_log_and_fail_with "$STRACE $args: unexpected exit status"
21
22 run_strace_redir -enone ../set_ptracer_any false
23 [ $? -eq 1 ] ||
24         dump_log_and_fail_with "$STRACE $args: unexpected exit status"
25
26 run_strace_redir -bexecve -enone ../set_ptracer_any false ||
27         dump_log_and_fail_with "$STRACE $args: unexpected exit status"
28
29 pattern_detached='[^:]*strace: Process [1-9][0-9]* detached'
30 pattern_personality='[^:]*strace: \[ Process PID=[1-9][0-9]* runs in .* mode. \]'
31
32 LC_ALL=C grep -x "$pattern_detached" "$LOG" > /dev/null ||
33         dump_log_and_fail_with "$STRACE $args: output mismatch"
34
35 if LC_ALL=C grep -E -v -x "($pattern_detached|$pattern_personality)" "$LOG" > /dev/null; then
36         dump_log_and_fail_with "$STRACE $args: unexpected output"
37 fi
38
39 exit 0