tests: workaround a bug in GNU grep
Workaround a bug introduced in GNU grep 2.27, for details see https://lists.gnu.org/archive/html/bug-grep/2016-12/msg00011.html * tests/init.sh (grep_pid_status): New function. * tests/detach-running.test: Use it instead of grep to search in /proc/$pid/status. * tests/detach-sleeping.test: Likewise. * tests/detach-stopped.test: Likewise.
This commit is contained in:
parent
34283c2f82
commit
3dac7272e8
@ -79,8 +79,8 @@ if [ -f /proc/self/status ]; then
|
||||
cleanup
|
||||
dump_log_and_fail_with 'tracee died after detach'
|
||||
}
|
||||
grep '^State:.*R (running)' < /proc/$tracee_pid/status > /dev/null || {
|
||||
grep '^State:' < /proc/$tracee_pid/status
|
||||
grep_pid_status "$tracee_pid" '^State:.*R (running)' > /dev/null || {
|
||||
grep_pid_status "$tracee_pid" '^State:'
|
||||
cleanup
|
||||
dump_log_and_fail_with 'tracee is not running after detach'
|
||||
}
|
||||
|
@ -80,8 +80,8 @@ if [ -f /proc/self/status ]; then
|
||||
cleanup
|
||||
dump_log_and_fail_with 'tracee died after detach'
|
||||
}
|
||||
grep '^State:.*S (sleeping)' < /proc/$tracee_pid/status > /dev/null || {
|
||||
grep '^State:' < /proc/$tracee_pid/status
|
||||
grep_pid_status "$tracee_pid" '^State:.*S (sleeping)' > /dev/null || {
|
||||
grep_pid_status "$tracee_pid" '^State:'
|
||||
cleanup
|
||||
dump_log_and_fail_with 'tracee is not sleeping after detach'
|
||||
}
|
||||
|
@ -95,8 +95,8 @@ if [ -f /proc/self/status ]; then
|
||||
cleanup
|
||||
dump_log_and_fail_with 'tracee died after detach'
|
||||
}
|
||||
grep '^State:.*T (stopped)' < /proc/$tracee_pid/status > /dev/null || {
|
||||
grep '^State:' < /proc/$tracee_pid/status
|
||||
grep_pid_status "$tracee_pid" '^State:.*T (stopped)' > /dev/null || {
|
||||
grep_pid_status "$tracee_pid" '^State:'
|
||||
cleanup
|
||||
dump_log_and_fail_with 'tracee is not group-stopped after detach'
|
||||
}
|
||||
|
@ -242,6 +242,14 @@ require_min_kernel_version_or_skip()
|
||||
skip_ "the kernel release $uname_r is not $1 or newer"
|
||||
}
|
||||
|
||||
# Usage: grep_pid_status $pid GREP-OPTIONS...
|
||||
grep_pid_status()
|
||||
{
|
||||
local pid
|
||||
pid=$1; shift
|
||||
cat < "/proc/$pid/status" | grep "$@"
|
||||
}
|
||||
|
||||
check_prog cat
|
||||
check_prog rm
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user