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]
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
37 echo expected one argument
: '<'dtrace-path
'>'
41 tmpfile
=/tmp
/libdeporder.$$
42 libdir
=${TMPDIR:-/tmp}/libdep.$$
48 cat > $libdir/liba.$$.d
<<EOF
49 #pragma D depends_on library libd.$$.d
51 cat > $libdir/libb.$$.d
<<EOF
53 cat > $libdir/libc.$$.d
<<EOF
54 #pragma D depends_on library libe.$$.d
56 cat > $libdir/libd.$$.d
<<EOF
57 #pragma D depends_on library libb.$$.d
59 cat > $libdir/libe.$$.d
<<EOF
60 #pragma D depends_on library liba.$$.d
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);
74 if (\$_ =~ /lib[a-e]\.[0-9]+.d/) {
76 for (\$i=0; \$i<=1;\$i++) {
77 \$pos = rindex(\$_, "/", \$pos);
81 push(@new, substr(\$_, \$pos+2, 4));
87 exit 1 if @new != @order;
90 exit 1 if pop(@new) ne pop(@order);