12633Sahl#!/bin/ksh -p
22633Sahl#
32633Sahl# CDDL HEADER START
42633Sahl#
52633Sahl# The contents of this file are subject to the terms of the
62633Sahl# Common Development and Distribution License (the "License").
72633Sahl# You may not use this file except in compliance with the License.
82633Sahl#
92633Sahl# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
102633Sahl# or http://www.opensolaris.org/os/licensing.
112633Sahl# See the License for the specific language governing permissions
122633Sahl# and limitations under the License.
132633Sahl#
142633Sahl# When distributing Covered Code, include this CDDL HEADER in each
152633Sahl# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
162633Sahl# If applicable, add the following below this CDDL HEADER, with the
172633Sahl# fields enclosed by brackets "[]" replaced with your own identifying
182633Sahl# information: Portions Copyright [yyyy] [name of copyright owner]
192633Sahl#
202633Sahl# CDDL HEADER END
212633Sahl#
222633Sahl
232633Sahl#
242633Sahl# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
252633Sahl# Use is subject to license terms.
262633Sahl#
272633Sahl
282633Sahl#ident	"%Z%%M%	%I%	%E% SMI"
292633Sahl
302633Sahl##
312633Sahl#
322633Sahl# ASSERTION:
332633Sahl# The -I option can be used to search path for #include files when used
342633Sahl# in conjunction with the -C option. The specified directory is inserted into
352633Sahl# the search path adhead of the default directory list.
362633Sahl#
372633Sahl# SECTION: dtrace Utility/-C Option
382633Sahl# SECTION: dtrace Utility/-I Option
392633Sahl#
402633Sahl##
412633Sahl
422633Sahlscript()
432633Sahl{
442633Sahl	$dtrace -C -I /tmp -s /dev/stdin <<EOF
452633Sahl	#pragma D option quiet
462633Sahl#include "test.h"
472633Sahl
482633Sahl	BEGIN
492633Sahl	/1520 != VALUE/
502633Sahl	{
512633Sahl		printf("VALUE: %d, Test should fail\n", VALUE);
522633Sahl		exit(1);
532633Sahl	}
542633Sahl
552633Sahl	BEGIN
562633Sahl	/1520 == VALUE/
572633Sahl	{
582633Sahl		printf("VALUE: %d, Test should pass\n", VALUE);
592633Sahl		exit(0);
602633Sahl	}
612633SahlEOF
622633Sahl}
632633Sahl
64*2804Stomeeif [ $# != 1 ]; then
65*2804Stomee	echo expected one argument: '<'dtrace-path'>'
66*2804Stomee	exit 2
67*2804Stomeefi
68*2804Stomee
692633Sahltempfile=/tmp/test.h
702633Sahlecho "#define VALUE 1520" > $tempfile
712633Sahl
72*2804Stomeedtrace=$1
732633Sahlscript
742633Sahlstatus=$?
752633Sahl
762633Sahlif [ "$status" -ne 0 ]; then
772633Sahl	echo $tst: dtrace failed
782633Sahl	exit $status
792633Sahlfi
802633Sahl
812633Sahl/usr/bin/rm -f $tempfile
822633Sahlexit 0
83