strace/tests/strace-t.test
Dmitry V. Levin 92e347b556 Add copyright headers to some files that lack them
We do our best to keep copyright headers up to date, yet
git history provides better information on this subject
and is more accurate than copyright headers.
2018-12-24 23:46:43 +00:00

35 lines
746 B
Bash
Executable File

#!/bin/sh
#
# Check -t option.
#
# Copyright (c) 2016-2018 The strace developers.
# All rights reserved.
#
# SPDX-License-Identifier: GPL-2.0-or-later
. "${srcdir=.}/init.sh"
run_prog_skip_if_failed date +%s > "$LOG"
run_prog_skip_if_failed date +%T --date "@$(cat "$LOG")" > /dev/null
run_prog ../sleep 0
s0="$(date +%s)"
run_strace -t -eexecve $args
s1="$(date +%s)"
s="$s0"
t_reg=
while [ "$s" -le "$s1" ]; do
t="$(date +%T --date "@$s")"
[ -z "$t_reg" ] && t_reg="$t" || t_reg="$t_reg|$t"
s=$(($s + 1))
done
t_reg="($t_reg)"
cat > "$EXP" << __EOF__
$t_reg execve\\("\\.\\./sleep", \\["\\.\\./sleep", "0"\\], 0x[[:xdigit:]]* /\\* [[:digit:]]* vars \\*/\\) = 0
$t_reg \\+\\+\\+ exited with 0 \\+\\+\\+
__EOF__
match_grep "$LOG" "$EXP"