1#!/bin/sh
2
3# Ensure that strace tests kernel PTRACE_O_TRACECLONE
4# and PTRACE_O_TRACESYSGOOD support properly.
5
6. "${srcdir=.}/init.sh"
7
8[ "$(uname -s)" = Linux ] ||
9	skip_ 'The kernel is not a Linux kernel'
10case "$(uname -r)" in
11	2.[6-9]*|2.[1-5][0-9]*|[3-9].*|[12][0-9]*) ;;
12	*) skip_ 'The kernel is not Linux 2.6.* or newer' ;;
13esac
14
15$STRACE -df -enone / > /dev/null 2> $LOG
16grep -F -x 'ptrace_setoptions = 0xe' $LOG > /dev/null || {
17	cat $LOG
18	fail_ 'strace -f failed to recognize proper kernel PTRACE_O_TRACECLONE support'
19}
20
21grep -F -x 'ptrace_setoptions = 0x1f' $LOG > /dev/null || {
22	cat $LOG
23	fail_ 'strace -f failed to recognize proper kernel PTRACE_O_TRACESYSGOOD support'
24}
25
26$STRACE -d -enone / > /dev/null 2> $LOG
27grep -F -x 'ptrace_setoptions = 0x11' $LOG > /dev/null || {
28	cat $LOG
29	fail_ 'strace failed to recognize proper kernel PTRACE_O_TRACESYSGOOD support'
30}
31