tst.libdepfullyconnected.ksh revision c9d6cd77e4180c3831afde367c7eb129e72f0b2c
2796N/A#
2796N/A# CDDL HEADER START
2796N/A#
2796N/A# The contents of this file are subject to the terms of the
2796N/A# Common Development and Distribution License (the "License").
2796N/A# You may not use this file except in compliance with the License.
2796N/A#
2796N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2796N/A# or http://www.opensolaris.org/os/licensing.
2796N/A# See the License for the specific language governing permissions
2796N/A# and limitations under the License.
2796N/A#
2796N/A# When distributing Covered Code, include this CDDL HEADER in each
2796N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2796N/A# If applicable, add the following below this CDDL HEADER, with the
2796N/A# fields enclosed by brackets "[]" replaced with your own identifying
2796N/A# information: Portions Copyright [yyyy] [name of copyright owner]
2796N/A#
2796N/A# CDDL HEADER END
2796N/A#
2796N/A
2796N/A#
2796N/A# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
2796N/A# Use is subject to license terms.
2796N/A#
2796N/A# ident "%Z%%M% %I% %E% SMI"
2796N/A
2796N/A#
2796N/A# This test verifies that we can generate the correct ordering for
2796N/A# a given dependency specification. All files either have a dependency
2796N/A# on another file or are the dependent of another file. In this way we
2796N/A# guarantee consistent ordering as no nodes in the dependency graph will
2796N/A# be isolated.
2796N/A#
2796N/A
2796N/Aif [ $# != 1 ]; then
2796N/A echo expected one argument: '<'dtrace-path'>'
2796N/A exit 2
2796N/Afi
2796N/A
2796N/Atmpfile=/tmp/libdeporder.$$
2796N/Alibdir=${TMPDIR:-/tmp}/libdep.$$
2796N/Adtrace=$1
2796N/A
2796N/Asetup_libs()
2796N/A{
2796N/A mkdir $libdir
2796N/A cat > $libdir/liba.$$.d <<EOF
2796N/A#pragma D depends_on library libd.$$.d
2796N/AEOF
2796N/A cat > $libdir/libb.$$.d <<EOF
2796N/AEOF
2796N/A cat > $libdir/libc.$$.d <<EOF
2796N/A#pragma D depends_on library libe.$$.d
2796N/AEOF
2796N/A cat > $libdir/libd.$$.d <<EOF
2796N/A#pragma D depends_on library libb.$$.d
2796N/AEOF
2796N/A cat > $libdir/libe.$$.d <<EOF
2796N/A#pragma D depends_on library liba.$$.d
2796N/AEOF
2796N/A}
2796N/A
2796N/A
2796N/Asetup_libs
2796N/A
2796N/ADTRACE_DEBUG=1 $dtrace -L$libdir -e >$tmpfile 2>&1
2796N/A
2796N/Aperl /dev/stdin $tmpfile <<EOF
2796N/A
2796N/A @order = qw(libc libe liba libd libb);
2796N/A
2796N/A while (<>) {
2796N/A if (\$_ =~ /lib[a-e]\.[0-9]+.d/) {
2796N/A \$pos = length \$_;
2796N/A for (\$i=0; \$i<=1;\$i++) {
2796N/A \$pos = rindex(\$_, "/", \$pos);
2796N/A \$pos--;
2796N/A }
2796N/A
2796N/A push(@new, substr(\$_, \$pos+2, 4));
2796N/A next;
2796N/A }
2796N/A next;
2796N/A }
2796N/A
2796N/A exit 1 if @new != @order;
2796N/A
2796N/A while (@new) {
2796N/A exit 1 if pop(@new) ne pop(@order);
2796N/A }
2796N/A
2796N/A exit 0;
2796N/AEOF
2796N/A
2796N/A
2796N/Astatus=$?
3863N/Arm -rf $libdir
2796N/Arm $tmpfile
2796N/Areturn $status
2796N/A