10Sstevel@tonic-gate#!/bin/ksh -p 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# CDDL HEADER START 40Sstevel@tonic-gate# 50Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6900Skupfer# Common Development and Distribution License (the "License"). 7900Skupfer# You may not use this file except in compliance with the License. 80Sstevel@tonic-gate# 90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate# See the License for the specific language governing permissions 120Sstevel@tonic-gate# and limitations under the License. 130Sstevel@tonic-gate# 140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate# 200Sstevel@tonic-gate# CDDL HEADER END 210Sstevel@tonic-gate# 224162Skupfer 230Sstevel@tonic-gate# 24*6417Smjnelson# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 250Sstevel@tonic-gate# Use is subject to license terms. 260Sstevel@tonic-gate# 272639Sdduvall#ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate# Quis custodiet ipsos custodies? 300Sstevel@tonic-gate 310Sstevel@tonic-gateif [ -z "$SRC" ]; then 320Sstevel@tonic-gate SRC=$CODEMGR_WS/usr/src 330Sstevel@tonic-gatefi 340Sstevel@tonic-gate 350Sstevel@tonic-gateif [ -z "$CODEMGR_WS" -o ! -d "$CODEMGR_WS" -o ! -d "$SRC" ]; then 360Sstevel@tonic-gate echo "$0: must be run from within a workspace." 370Sstevel@tonic-gate exit 1 380Sstevel@tonic-gatefi 390Sstevel@tonic-gate 400Sstevel@tonic-gatecd $CODEMGR_WS || exit 1 410Sstevel@tonic-gate 420Sstevel@tonic-gate# Use -b to tell this script to ignore derived (built) objects. 430Sstevel@tonic-gateif [ "$1" = "-b" ]; then 440Sstevel@tonic-gate b_flg=y 450Sstevel@tonic-gatefi 460Sstevel@tonic-gate 470Sstevel@tonic-gate# Not currently used; available for temporary workarounds. 480Sstevel@tonic-gateargs="-k NEVER_CHECK" 490Sstevel@tonic-gate 500Sstevel@tonic-gate# We intentionally don't depend on $MACH here, and thus no $ROOT. If 510Sstevel@tonic-gate# a proto area exists, then we use it. This allows this script to be 520Sstevel@tonic-gate# run against gates (which should contain both SPARC and x86 proto 530Sstevel@tonic-gate# areas), build workspaces (which should contain just one proto area), 540Sstevel@tonic-gate# and unbuilt workspaces (which contain no proto areas). 550Sstevel@tonic-gateif [ "$b_flg" = y ]; then 560Sstevel@tonic-gate rootlist= 570Sstevel@tonic-gateelif [ $# -gt 0 ]; then 580Sstevel@tonic-gate rootlist=$* 590Sstevel@tonic-gateelse 600Sstevel@tonic-gate rootlist="$CODEMGR_WS/proto/root_sparc $CODEMGR_WS/proto/root_i386" 610Sstevel@tonic-gatefi 620Sstevel@tonic-gate 632138Scarlsonj# If the closed source is not present, then exclude IKE from validation. 642138Scarlsonjif [ "$CLOSED_IS_PRESENT" = no ]; then 652138Scarlsonj excl="-e ^usr/include/ike/" 662138Scarlsonjfi 672138Scarlsonj 680Sstevel@tonic-gatefor ROOT in $rootlist 690Sstevel@tonic-gatedo 700Sstevel@tonic-gate case "$ROOT" in 714162Skupfer *sparc|*sparc-nd) 724162Skupfer arch=sparc 734162Skupfer ;; 744162Skupfer *i386|*i386-nd) 754162Skupfer arch=i386 764162Skupfer ;; 770Sstevel@tonic-gate *) 780Sstevel@tonic-gate echo "$ROOT has unknown architecture." >&2 790Sstevel@tonic-gate exit 1 800Sstevel@tonic-gate ;; 810Sstevel@tonic-gate esac 820Sstevel@tonic-gate if [ -d $ROOT ]; then 832138Scarlsonj validate_paths '-s/\s*'$arch'$//' -e '^opt/onbld' $excl \ 842138Scarlsonj -b $ROOT $args $SRC/pkgdefs/etc/exception_list_$arch 850Sstevel@tonic-gate fi 860Sstevel@tonic-gatedone 870Sstevel@tonic-gate 880Sstevel@tonic-gate# Two entries in the findunref exception_list deal with things created 890Sstevel@tonic-gate# by nightly. Otherwise, this test could be run on an unmodifed (and 900Sstevel@tonic-gate# unbuilt) workspace. We handle this by flagging the one that is 910Sstevel@tonic-gate# present only on a built workspace (./*.out) and the one that's 920Sstevel@tonic-gate# present only after a run of findunref (./*.ref) with ISUSED, and 930Sstevel@tonic-gate# disabling all checks of them. The assumption is that the entries 940Sstevel@tonic-gate# marked with ISUSED are always known to be good, thus the Latin quote 950Sstevel@tonic-gate# at the top of the file. 960Sstevel@tonic-gateif [ -r $SRC/tools/findunref/exception_list ]; then 972138Scarlsonj # If the closed source is not present, then don't validate it. 982138Scarlsonj if [ "$CLOSED_IS_PRESENT" = no ]; then 992138Scarlsonj excl="-e ^\./closed" 1002138Scarlsonj fi 1012138Scarlsonj validate_paths -k ISUSED -r -e '^\*' $excl -b $SRC/.. \ 1020Sstevel@tonic-gate $SRC/tools/findunref/exception_list 1030Sstevel@tonic-gatefi 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate# These are straightforward. 1060Sstevel@tonic-gateif [ -d $SRC/xmod ]; then 1072138Scarlsonj # If the closed source is not present, then don't validate it. 1082138Scarlsonj if [ "$CLOSED_IS_PRESENT" = no ]; then 1092138Scarlsonj excl_cry="-e ^usr/closed" 1102138Scarlsonj excl_xmod="-e ^../closed" 1112138Scarlsonj fi 1122138Scarlsonj validate_paths $excl_cry $SRC/xmod/cry_files 1132138Scarlsonj validate_paths $excl_xmod -b $SRC $SRC/xmod/xmod_files 1140Sstevel@tonic-gatefi 1150Sstevel@tonic-gate 116*6417Smjnelsonif [ -f $SRC/tools/opensolaris/license-list ]; then 117*6417Smjnelson excl= 118*6417Smjnelson if [ "$CLOSED_IS_PRESENT" = no ]; then 119*6417Smjnelson excl="-e ^usr/closed" 120*6417Smjnelson fi 121*6417Smjnelson sed -e 's/$/.descrip/' < $SRC/tools/opensolaris/license-list | \ 122*6417Smjnelson validate_paths $excl 123*6417Smjnelsonfi 124*6417Smjnelson 1250Sstevel@tonic-gate# Finally, make sure the that (req|inc).flg files are in good shape. 1262138Scarlsonj# If SCCS files are not expected to be present, though, then don't 1272138Scarlsonj# check them. 1282138Scarlsonjif [ ! -d "$CODEMGR_WS/Codemgr_wsdata" ]; then 1292138Scarlsonj f_flg='-f' 1302138Scarlsonjfi 1312138Scarlsonj# If the closed source is not present, then don't validate it. 1322138Scarlsonjif [ "$CLOSED_IS_PRESENT" = no ]; then 1332138Scarlsonj excl="-e ^usr/closed/" 1342138Scarlsonjfi 1352138Scarlsonj 1362138Scarlsonjvalidate_flg $f_flg $excl 1370Sstevel@tonic-gate 1380Sstevel@tonic-gateexit 0 139