]> granicus.if.org Git - strace/blob - tests/strace-S.test
tests: add strace-S.test
[strace] / tests / strace-S.test
1 #!/bin/sh
2
3 # Check -S option.
4
5 . "${srcdir=.}/init.sh"
6
7 run_prog_skip_if_failed date > /dev/null
8 run_strace -c -S calls $args
9 OUT="$LOG.out"
10 EXP="$LOG.exp"
11
12 rm -f "$OUT" "$EXP"
13
14 check_prog awk
15 check_prog sort
16 awk '{print $4}' "$LOG" > "$OUT"
17
18 exec 4<&0 0<"$OUT"
19 while
20 read item
21 do
22         if [ "$item" = "---------" ]
23         then
24                 break
25         fi
26 done
27
28 while
29 read item
30 do
31         if [ "$item" = "---------" ]
32         then
33                 break
34         fi
35
36         echo "$item" >> "$EXP"
37 done
38
39 exec 0<&4
40
41 if [ -s $EXP ]
42 then
43         sort -c -g -r "$EXP"
44         if [ "$?" = "1" ]
45         then
46                 fail_ "not sorted"
47         fi
48 else
49         fail_ "no file"
50 fi
51
52 rm -f "$OUT" "$EXP"