tst.multiple.ksh revision 23b5c241225a8ade2b6b9f06ebb891ee459e3b02
530N/A#!/bin/ksh -p
530N/A#
530N/A# CDDL HEADER START
530N/A#
530N/A# The contents of this file are subject to the terms of the
919N/A# Common Development and Distribution License (the "License").
530N/A# You may not use this file except in compliance with the License.
530N/A#
919N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
919N/A# or http://www.opensolaris.org/os/licensing.
919N/A# See the License for the specific language governing permissions
919N/A# and limitations under the License.
919N/A#
919N/A# When distributing Covered Code, include this CDDL HEADER in each
919N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
919N/A# If applicable, add the following below this CDDL HEADER, with the
919N/A# fields enclosed by brackets "[]" replaced with your own identifying
919N/A# information: Portions Copyright [yyyy] [name of copyright owner]
919N/A#
919N/A# CDDL HEADER END
919N/A#
919N/A
919N/A#
919N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
919N/A# Use is subject to license terms.
530N/A#
530N/A#ident "%Z%%M% %I% %E% SMI"
530N/A
530N/Aif [ $# != 1 ]; then
530N/A echo expected one argument: '<'dtrace-path'>'
530N/A exit 2
530N/Afi
530N/A
530N/Adtrace=$1
530N/ADIR=/var/tmp/dtest.$$
530N/A
530N/Amkdir $DIR
530N/Acd $DIR
cat > prov.d <<EOF
provider test_prov {
probe go();
};
EOF
$dtrace -h -s prov.d
if [ $? -ne 0 ]; then
print -u2 "failed to generate header file"
exit 1
fi
cat > test.c <<EOF
#include <sys/types.h>
#include "prov.h"
int
main(int argc, char **argv)
{
TEST_PROV_GO();
TEST_PROV_GO();
TEST_PROV_GO();
TEST_PROV_GO();
return (0);
}
EOF
cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
fi
$dtrace -G -32 -s prov.d test.o
if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1
fi
script() {
$dtrace -c ./test -qs /dev/stdin <<EOF
test_prov\$target:::
{
printf("%s:%s:%s\n", probemod, probefunc, probename);
}
EOF
}
script
status=$?
cd /
/usr/bin/rm -rf $DIR
exit $status