dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / dtrace / test / tst / common / usdt / tst.sameprovmulti.ksh
blob04b76207ea7acd029a5e3a8a8303f321cbe61f94
2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
5 # 1.0 of the CDDL.
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
13 # Copyright (c) 2015, Joyent, Inc. All rights reserved.
17 # This test assures that we can have the same provider name across multiple
18 # probe definitions, and that the result will be the union of those
19 # definitions. In particular, libusdt depends on this when (for example)
20 # node modules that create a provider are loaded multiple times due to
21 # being included by different modules.
24 if [ $# != 1 ]; then
25 echo expected one argument: '<'dtrace-path'>'
26 exit 2
29 dtrace=$1
30 DIR=/var/tmp/dtest.$$
32 mkdir $DIR
33 cd $DIR
35 cat > test.c <<EOF
36 #include <unistd.h>
38 void
39 main()
41 EOF
43 objs=
45 for oogle in bagnoogle stalloogle cockoogle; do
46 cat > $oogle.c <<EOF
47 #include <sys/sdt.h>
49 void
50 $oogle()
52 DTRACE_PROBE(doogle, $oogle);
54 EOF
56 cat > $oogle.d <<EOF
57 provider doogle {
58 probe $oogle();
60 EOF
62 gcc -m32 -c $oogle.c
64 if [ $? -ne 0 ]; then
65 print -u2 "failed to compile $oogle.c"
66 exit 1
69 $dtrace -G -32 -s $oogle.d $oogle.o -o $oogle.d.o
71 if [ $? -ne 0 ]; then
72 print -u2 "failed to process $oogle.d"
73 exit 1
76 objs="$objs $oogle.o $oogle.d.o"
77 echo $oogle'();' >> test.c
78 done
80 echo "}" >> test.c
82 gcc -m32 -o test test.c $objs
84 if [ $? -ne 0 ]; then
85 print -u2 "failed to compile test.c"
86 exit 1
89 $dtrace -n 'doogle$target:::{@[probename] = count()}' \
90 -n 'END{printa("%-10s %@d\n", @)}' -x quiet -x aggsortkey -Zc ./test
92 if [ $? -ne 0 ]; then
93 print -u2 "failed to execute test"
94 exit 1
97 cd /
98 /usr/bin/rm -rf $DIR
99 exit 0