tst.provregex1.ksh revision 211545
1258882Semaste#!/bin/ksh -p
2258882Semaste#
3258882Semaste# CDDL HEADER START
4258882Semaste#
5258882Semaste# The contents of this file are subject to the terms of the
6258882Semaste# Common Development and Distribution License (the "License").
7258882Semaste# You may not use this file except in compliance with the License.
8258882Semaste#
9258882Semaste# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10258882Semaste# or http://www.opensolaris.org/os/licensing.
11258882Semaste# See the License for the specific language governing permissions
12258882Semaste# and limitations under the License.
13258882Semaste#
14258882Semaste# When distributing Covered Code, include this CDDL HEADER in each
15258882Semaste# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16258882Semaste# If applicable, add the following below this CDDL HEADER, with the
17258882Semaste# fields enclosed by brackets "[]" replaced with your own identifying
18258882Semaste# information: Portions Copyright [yyyy] [name of copyright owner]
19258882Semaste#
20258882Semaste# CDDL HEADER END
21258882Semaste#
22258882Semaste
23258882Semaste#
24258882Semaste# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
25258882Semaste# Use is subject to license terms.
26258882Semaste#
27258882Semaste# ident	"%Z%%M%	%I%	%E% SMI"
28258882Semaste
29258882Semaste#
30258882Semaste# This test verifies that specifying a glob in a pid provider name
31258882Semaste# (e.g., p*d$target) works.
32258882Semaste#
33258882Semaste
34258882Semasteif [ $# != 1 ]; then
35258882Semaste	echo expected one argument: '<'dtrace-path'>'
36258882Semaste	exit 2
37258882Semastefi
38258882Semaste
39258882Semastedtrace=$1
40258882SemasteDIR=${TMPDIR:-/tmp}/dtest.$$
41258882Semaste
42258882Semastemkdir $DIR
43258882Semastecd $DIR
44258882Semaste
45258882Semastecat > Makefile <<EOF
46258882Semasteall: main
47258882Semaste
48258882Semastemain: main.o
49258882Semaste	cc -o main main.o
50258882Semaste
51258882Semastemain.o: main.c
52258882Semaste	cc -c main.c
53258882SemasteEOF
54258882Semaste
55258882Semastecat > main.c <<EOF
56258882Semastevoid
57258882Semastego(void)
58258882Semaste{
59258882Semaste}
60258882Semaste
61258882Semasteint
62258882Semastemain(int argc, char **argv)
63258882Semaste{
64258882Semaste	go();
65258882Semaste
66258882Semaste	return (0);
67258882Semaste}
68258882SemasteEOF
69258882Semaste
70258882Semastemake > /dev/null
71258882Semasteif [ $? -ne 0 ]; then
72	print -u2 "failed to build"
73	exit 1
74fi
75
76cat > main.d <<'EOF'
77p*d$target::go:entry
78{
79	printf("%s:%s:%s\n", probemod, probefunc, probename);
80}
81EOF
82
83script() {
84	$dtrace -q -s ./main.d -c ./main
85}
86
87script
88status=$?
89
90cd /tmp
91/bin/rm -rf $DIR
92
93exit $status
94