blob: c49f08b08da820a89409a02969fd5c03d12bc79e [file] [log] [blame]
Dmitry V. Levinaa801922015-02-07 18:48:55 +00001#!/bin/sh
2
3# Check -bexecve behavior.
4
5. "${srcdir=.}/init.sh"
6
Dmitry V. Levin8f546642015-03-17 17:07:57 +00007run_strace_redir()
8{
9 args="$*"
10 $STRACE "$@" 2> "$LOG"
Dmitry V. Levinaa801922015-02-07 18:48:55 +000011}
12
Dmitry V. Levin8f546642015-03-17 17:07:57 +000013run_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
Dmitry V. Levinaa801922015-02-07 18:48:55 +000020pattern='Process [1-9][0-9]* detached'
21
Dmitry V. Levin8f546642015-03-17 17:07:57 +000022LC_ALL=C grep -x "$pattern" "$LOG" > /dev/null ||
23 dump_log_and_fail_with "$STRACE $args: output mismatch"
Dmitry V. Levinaa801922015-02-07 18:48:55 +000024
25if LC_ALL=C grep -v -x "$pattern" "$LOG" > /dev/null; then
Dmitry V. Levin8f546642015-03-17 17:07:57 +000026 dump_log_and_fail_with "$STRACE $args: unexpected output"
Dmitry V. Levinaa801922015-02-07 18:48:55 +000027fi
28
29exit 0