xref: /freebsd-src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/dtraceUtil/tst.AddSearchPath.d.ksh (revision b2db760808f74bb53c232900091c9da801ebbfcc)
12be1a816SJohn Birrell#!/bin/ksh -p
22be1a816SJohn Birrell#
32be1a816SJohn Birrell# CDDL HEADER START
42be1a816SJohn Birrell#
52be1a816SJohn Birrell# The contents of this file are subject to the terms of the
62be1a816SJohn Birrell# Common Development and Distribution License (the "License").
72be1a816SJohn Birrell# You may not use this file except in compliance with the License.
82be1a816SJohn Birrell#
92be1a816SJohn Birrell# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
102be1a816SJohn Birrell# or http://www.opensolaris.org/os/licensing.
112be1a816SJohn Birrell# See the License for the specific language governing permissions
122be1a816SJohn Birrell# and limitations under the License.
132be1a816SJohn Birrell#
142be1a816SJohn Birrell# When distributing Covered Code, include this CDDL HEADER in each
152be1a816SJohn Birrell# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
162be1a816SJohn Birrell# If applicable, add the following below this CDDL HEADER, with the
172be1a816SJohn Birrell# fields enclosed by brackets "[]" replaced with your own identifying
182be1a816SJohn Birrell# information: Portions Copyright [yyyy] [name of copyright owner]
192be1a816SJohn Birrell#
202be1a816SJohn Birrell# CDDL HEADER END
212be1a816SJohn Birrell#
222be1a816SJohn Birrell
232be1a816SJohn Birrell#
242be1a816SJohn Birrell# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
252be1a816SJohn Birrell# Use is subject to license terms.
262be1a816SJohn Birrell#
272be1a816SJohn Birrell
282be1a816SJohn Birrell#ident	"%Z%%M%	%I%	%E% SMI"
292be1a816SJohn Birrell
302be1a816SJohn Birrell##
312be1a816SJohn Birrell#
322be1a816SJohn Birrell# ASSERTION:
332be1a816SJohn Birrell# The -I option can be used to search path for #include files when used
342be1a816SJohn Birrell# in conjunction with the -C option. The specified directory is inserted into
352be1a816SJohn Birrell# the search path adhead of the default directory list.
362be1a816SJohn Birrell#
372be1a816SJohn Birrell# SECTION: dtrace Utility/-C Option
382be1a816SJohn Birrell# SECTION: dtrace Utility/-I Option
392be1a816SJohn Birrell#
402be1a816SJohn Birrell##
412be1a816SJohn Birrell
422be1a816SJohn Birrellscript()
432be1a816SJohn Birrell{
442be1a816SJohn Birrell	$dtrace -C -I /tmp -s /dev/stdin <<EOF
452be1a816SJohn Birrell	#pragma D option quiet
462be1a816SJohn Birrell#include "test.h"
472be1a816SJohn Birrell
482be1a816SJohn Birrell	BEGIN
492be1a816SJohn Birrell	/1520 != VALUE/
502be1a816SJohn Birrell	{
512be1a816SJohn Birrell		printf("VALUE: %d, Test should fail\n", VALUE);
522be1a816SJohn Birrell		exit(1);
532be1a816SJohn Birrell	}
542be1a816SJohn Birrell
552be1a816SJohn Birrell	BEGIN
562be1a816SJohn Birrell	/1520 == VALUE/
572be1a816SJohn Birrell	{
582be1a816SJohn Birrell		printf("VALUE: %d, Test should pass\n", VALUE);
592be1a816SJohn Birrell		exit(0);
602be1a816SJohn Birrell	}
612be1a816SJohn BirrellEOF
622be1a816SJohn Birrell}
632be1a816SJohn Birrell
642be1a816SJohn Birrellif [ $# != 1 ]; then
652be1a816SJohn Birrell	echo expected one argument: '<'dtrace-path'>'
662be1a816SJohn Birrell	exit 2
672be1a816SJohn Birrellfi
682be1a816SJohn Birrell
692be1a816SJohn Birrelltempfile=/tmp/test.h
702be1a816SJohn Birrellecho "#define VALUE 1520" > $tempfile
712be1a816SJohn Birrell
722be1a816SJohn Birrelldtrace=$1
732be1a816SJohn Birrellscript
742be1a816SJohn Birrellstatus=$?
752be1a816SJohn Birrell
762be1a816SJohn Birrellif [ "$status" -ne 0 ]; then
772be1a816SJohn Birrell	echo $tst: dtrace failed
782be1a816SJohn Birrell	exit $status
792be1a816SJohn Birrellfi
802be1a816SJohn Birrell
81*b2db7608SRui Paulo/bin/rm -f $tempfile
822be1a816SJohn Birrellexit 0
83