8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / dtrace / test / tst / common / pragma / tst.libdepfullyconnected.ksh
blobe95de696dd238258d0a07ea331ecaa599fa879e2
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
23 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
26 # ident "%Z%%M% %I% %E% SMI"
29 # This test verifies that we can generate the correct ordering for
30 # a given dependency specification. All files either have a dependency
31 # on another file or are the dependent of another file. In this way we
32 # guarantee consistent ordering as no nodes in the dependency graph will
33 # be isolated.
36 if [ $# != 1 ]; then
37 echo expected one argument: '<'dtrace-path'>'
38 exit 2
41 tmpfile=/tmp/libdeporder.$$
42 libdir=${TMPDIR:-/tmp}/libdep.$$
43 dtrace=$1
45 setup_libs()
47 mkdir $libdir
48 cat > $libdir/liba.$$.d <<EOF
49 #pragma D depends_on library libd.$$.d
50 EOF
51 cat > $libdir/libb.$$.d <<EOF
52 EOF
53 cat > $libdir/libc.$$.d <<EOF
54 #pragma D depends_on library libe.$$.d
55 EOF
56 cat > $libdir/libd.$$.d <<EOF
57 #pragma D depends_on library libb.$$.d
58 EOF
59 cat > $libdir/libe.$$.d <<EOF
60 #pragma D depends_on library liba.$$.d
61 EOF
65 setup_libs
67 DTRACE_DEBUG=1 $dtrace -L$libdir -e >$tmpfile 2>&1
69 perl /dev/stdin $tmpfile <<EOF
71 @order = qw(libc libe liba libd libb);
73 while (<>) {
74 if (\$_ =~ /lib[a-e]\.[0-9]+.d/) {
75 \$pos = length \$_;
76 for (\$i=0; \$i<=1;\$i++) {
77 \$pos = rindex(\$_, "/", \$pos);
78 \$pos--;
81 push(@new, substr(\$_, \$pos+2, 4));
82 next;
84 next;
87 exit 1 if @new != @order;
89 while (@new) {
90 exit 1 if pop(@new) ne pop(@order);
93 exit 0;
94 EOF
97 status=$?
98 rm -rf $libdir
99 rm $tmpfile
100 return $status