1112694Stegge# 2112694Stegge# CDDL HEADER START 3112694Stegge# 4112694Stegge# The contents of this file are subject to the terms of the 5112694Stegge# Common Development and Distribution License (the "License"). 6112694Stegge# You may not use this file except in compliance with the License. 7112694Stegge# 8112694Stegge# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9112694Stegge# or http://www.opensolaris.org/os/licensing. 10112694Stegge# See the License for the specific language governing permissions 11112694Stegge# and limitations under the License. 12112694Stegge# 13112694Stegge# When distributing Covered Code, include this CDDL HEADER in each 14112694Stegge# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15112694Stegge# If applicable, add the following below this CDDL HEADER, with the 16112694Stegge# fields enclosed by brackets "[]" replaced with your own identifying 17112694Stegge# information: Portions Copyright [yyyy] [name of copyright owner] 18112694Stegge# 19112694Stegge# CDDL HEADER END 20112694Stegge# 21112694Stegge 22112694Stegge# 23112694Stegge# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24112694Stegge# Use is subject to license terms. 25112694Stegge# 26112694Stegge#ident "%Z%%M% %I% %E% SMI" 27116192Sobrien 28116192Sobrienif [ $# != 1 ]; then 29116192Sobrien echo expected one argument: '<'dtrace-path'>' 30112694Stegge exit 2 31112694Steggefi 32112694Stegge 33112694Steggedtrace=$1 34112694SteggeDIR=/var/tmp/dtest.$$ 35112694Stegge 36114216Skanmkdir $DIR 37112694Steggecd $DIR 38112694Stegge 39112694Steggecat > prov.d <<EOF 40112694Steggeprovider test_prov { 41112694Stegge probe go(); 42112694Stegge}; 43112694SteggeEOF 44112694Stegge 45248084Sattilio$dtrace -h -s prov.d 46118986Salcif [ $? -ne 0 ]; then 47112694Stegge print -u2 "failed to generate header file" 48112694Stegge exit 1 49118986Salcfi 50119088Salc 51112694Steggecat > test.c <<EOF 52141522Sphk#include <sys/types.h> 53112694Stegge#include "prov.h" 54112694Stegge 55112694Steggeint 56112694Steggemain(int argc, char **argv) 57112694Stegge{ 58112694Stegge if (TEST_PROV_GO_ENABLED()) 59112694Stegge return (2); 60112694Stegge 61112694Stegge return (0); 62112694Stegge} 63112694SteggeEOF 64112694Stegge 65112694Steggecc -c test.c 66112694Steggeif [ $? -ne 0 ]; then 67112694Stegge print -u2 "failed to compile test.c" 68112694Stegge exit 1 69112694Steggefi 70176559Sattilio$dtrace -G -32 -s prov.d test.o 71112694Steggeif [ $? -ne 0 ]; then 72112694Stegge print -u2 "failed to create DOF" 73112694Stegge exit 1 74112694Steggefi 75112694Steggecc -o test test.o prov.o 76112694Steggeif [ $? -ne 0 ]; then 77112694Stegge print -u2 "failed to link final executable" 78112694Stegge exit 1 79112694Steggefi 80112694Stegge 81112694Steggecd / 82112694Stegge/bin/rm -rf $DIR 83112694Stegge