5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2012 by Delphix. All rights reserved.
21 ############################################################################
23 # temporal option causes output to be sorted
27 # NOTES: The temporal option has no effect on a single-CPU system, so
28 # this needs to be run on a multi-CPU system to effectively test the
31 ############################################################################
34 echo expected one argument
: '<'dtrace-path
'>'
43 $dtrace -o $file -c 'sleep 3' -s /dev
/stdin
<<EOF
44 #pragma D option quiet
45 #pragma D option temporal
55 /* Bump @lines every time we print a line. */
57 printf("%u end\n", timestamp);
59 printa("99999999999999999 lines %@u\n", @lines);
65 printf("%u\n", timestamp);
70 if [ "$status" -ne 0 ]; then
71 echo $tst: dtrace failed
75 # dtrace outputs a blank line at the end, which will sort to the beginning,
76 # so use head to remove the blank line.
77 head -n -1 $file > $file.2
79 sort -n $file.2 |
diff $file.2 -
81 if [ "$status" -ne 0 ]; then
82 echo $tst: output is not sorted
86 head -n 1 $file.2 |
grep begin
>/dev
/null
88 if [ "$status" -ne 0 ]; then
89 echo $tst: begin probe did not fire
93 tail -n 2 $file.2 |
grep end
>/dev
/null
95 if [ "$status" -ne 0 ]; then
96 echo $tst: end probe did not fire
100 if [ $
(tail -n 1 $file.2 | cut
-f3 -d ' ') -ne \
101 $
(wc -l $file.2) ]; then
102 echo $tst: incorrect number of lines output