1#!/bin/sh
2
3# Check -bexecve behavior.
4
5. "${srcdir=.}/init.sh"
6
7run_strace_redir()
8{
9	args="$*"
10	$STRACE "$@" 2> "$LOG"
11}
12
13run_strace_redir -enone sh -c 'exec false'
14[ $? -eq 1 ] ||
15	dump_log_and_fail_with "$STRACE $args: unexpected exit status"
16
17run_strace_redir -bexecve -enone sh -c 'exec false' ||
18	dump_log_and_fail_with "$STRACE $args: unexpected exit status"
19
20pattern='Process [1-9][0-9]* detached'
21
22LC_ALL=C grep -x "$pattern" "$LOG" > /dev/null ||
23	dump_log_and_fail_with "$STRACE $args: output mismatch"
24
25if LC_ALL=C grep -v -x "$pattern" "$LOG" > /dev/null; then
26	dump_log_and_fail_with "$STRACE $args: unexpected output"
27fi
28
29exit 0
30