xref: /freebsd-src/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.provregex1.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 2008 Sun Microsystems, Inc.  All rights reserved.
252be1a816SJohn Birrell# Use is subject to license terms.
262be1a816SJohn Birrell#
272be1a816SJohn Birrell# ident	"%Z%%M%	%I%	%E% SMI"
282be1a816SJohn Birrell
292be1a816SJohn Birrell#
302be1a816SJohn Birrell# This test verifies that specifying a glob in a pid provider name
312be1a816SJohn Birrell# (e.g., p*d$target) works.
322be1a816SJohn Birrell#
332be1a816SJohn Birrell
342be1a816SJohn Birrellif [ $# != 1 ]; then
352be1a816SJohn Birrell	echo expected one argument: '<'dtrace-path'>'
362be1a816SJohn Birrell	exit 2
372be1a816SJohn Birrellfi
382be1a816SJohn Birrell
392be1a816SJohn Birrelldtrace=$1
402be1a816SJohn BirrellDIR=${TMPDIR:-/tmp}/dtest.$$
412be1a816SJohn Birrell
422be1a816SJohn Birrellmkdir $DIR
432be1a816SJohn Birrellcd $DIR
442be1a816SJohn Birrell
452be1a816SJohn Birrellcat > Makefile <<EOF
462be1a816SJohn Birrellall: main
472be1a816SJohn Birrell
482be1a816SJohn Birrellmain: main.o
492be1a816SJohn Birrell	cc -o main main.o
502be1a816SJohn Birrell
512be1a816SJohn Birrellmain.o: main.c
522be1a816SJohn Birrell	cc -c main.c
532be1a816SJohn BirrellEOF
542be1a816SJohn Birrell
552be1a816SJohn Birrellcat > main.c <<EOF
562be1a816SJohn Birrellvoid
572be1a816SJohn Birrellgo(void)
582be1a816SJohn Birrell{
592be1a816SJohn Birrell}
602be1a816SJohn Birrell
612be1a816SJohn Birrellint
622be1a816SJohn Birrellmain(int argc, char **argv)
632be1a816SJohn Birrell{
642be1a816SJohn Birrell	go();
652be1a816SJohn Birrell
662be1a816SJohn Birrell	return (0);
672be1a816SJohn Birrell}
682be1a816SJohn BirrellEOF
692be1a816SJohn Birrell
702be1a816SJohn Birrellmake > /dev/null
712be1a816SJohn Birrellif [ $? -ne 0 ]; then
722be1a816SJohn Birrell	print -u2 "failed to build"
732be1a816SJohn Birrell	exit 1
742be1a816SJohn Birrellfi
752be1a816SJohn Birrell
762be1a816SJohn Birrellcat > main.d <<'EOF'
772be1a816SJohn Birrellp*d$target::go:entry
782be1a816SJohn Birrell{
792be1a816SJohn Birrell	printf("%s:%s:%s\n", probemod, probefunc, probename);
802be1a816SJohn Birrell}
812be1a816SJohn BirrellEOF
822be1a816SJohn Birrell
832be1a816SJohn Birrellscript() {
842be1a816SJohn Birrell	$dtrace -q -s ./main.d -c ./main
852be1a816SJohn Birrell}
862be1a816SJohn Birrell
872be1a816SJohn Birrellscript
882be1a816SJohn Birrellstatus=$?
892be1a816SJohn Birrell
902be1a816SJohn Birrellcd /tmp
91*b2db7608SRui Paulo/bin/rm -rf $DIR
922be1a816SJohn Birrell
932be1a816SJohn Birrellexit $status
94