17c478bd9Sstevel@tonic-gate#!/bin/ksh -p 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6fb23a357Skupfer# Common Development and Distribution License (the "License"). 7fb23a357Skupfer# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 224e5b757fSkupfer 237c478bd9Sstevel@tonic-gate# 24*99dda208Smjnelson# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 257c478bd9Sstevel@tonic-gate# Use is subject to license terms. 267c478bd9Sstevel@tonic-gate# 277c478bd9Sstevel@tonic-gate#ident "%Z%%M% %I% %E% SMI" 287c478bd9Sstevel@tonic-gate 297c478bd9Sstevel@tonic-gate# Quis custodiet ipsos custodies? 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gateif [ -z "$SRC" ]; then 327c478bd9Sstevel@tonic-gate SRC=$CODEMGR_WS/usr/src 337c478bd9Sstevel@tonic-gatefi 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gateif [ -z "$CODEMGR_WS" -o ! -d "$CODEMGR_WS" -o ! -d "$SRC" ]; then 367c478bd9Sstevel@tonic-gate echo "$0: must be run from within a workspace." 377c478bd9Sstevel@tonic-gate exit 1 387c478bd9Sstevel@tonic-gatefi 397c478bd9Sstevel@tonic-gate 407c478bd9Sstevel@tonic-gatecd $CODEMGR_WS || exit 1 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate# Use -b to tell this script to ignore derived (built) objects. 437c478bd9Sstevel@tonic-gateif [ "$1" = "-b" ]; then 447c478bd9Sstevel@tonic-gate b_flg=y 457c478bd9Sstevel@tonic-gatefi 467c478bd9Sstevel@tonic-gate 477c478bd9Sstevel@tonic-gate# Not currently used; available for temporary workarounds. 487c478bd9Sstevel@tonic-gateargs="-k NEVER_CHECK" 497c478bd9Sstevel@tonic-gate 507c478bd9Sstevel@tonic-gate# We intentionally don't depend on $MACH here, and thus no $ROOT. If 517c478bd9Sstevel@tonic-gate# a proto area exists, then we use it. This allows this script to be 527c478bd9Sstevel@tonic-gate# run against gates (which should contain both SPARC and x86 proto 537c478bd9Sstevel@tonic-gate# areas), build workspaces (which should contain just one proto area), 547c478bd9Sstevel@tonic-gate# and unbuilt workspaces (which contain no proto areas). 557c478bd9Sstevel@tonic-gateif [ "$b_flg" = y ]; then 567c478bd9Sstevel@tonic-gate rootlist= 577c478bd9Sstevel@tonic-gateelif [ $# -gt 0 ]; then 587c478bd9Sstevel@tonic-gate rootlist=$* 597c478bd9Sstevel@tonic-gateelse 607c478bd9Sstevel@tonic-gate rootlist="$CODEMGR_WS/proto/root_sparc $CODEMGR_WS/proto/root_i386" 617c478bd9Sstevel@tonic-gatefi 627c478bd9Sstevel@tonic-gate 63f136dc05Scarlsonj# If the closed source is not present, then exclude IKE from validation. 64f136dc05Scarlsonjif [ "$CLOSED_IS_PRESENT" = no ]; then 65f136dc05Scarlsonj excl="-e ^usr/include/ike/" 66f136dc05Scarlsonjfi 67f136dc05Scarlsonj 687c478bd9Sstevel@tonic-gatefor ROOT in $rootlist 697c478bd9Sstevel@tonic-gatedo 707c478bd9Sstevel@tonic-gate case "$ROOT" in 714e5b757fSkupfer *sparc|*sparc-nd) 724e5b757fSkupfer arch=sparc 734e5b757fSkupfer ;; 744e5b757fSkupfer *i386|*i386-nd) 754e5b757fSkupfer arch=i386 764e5b757fSkupfer ;; 777c478bd9Sstevel@tonic-gate *) 787c478bd9Sstevel@tonic-gate echo "$ROOT has unknown architecture." >&2 797c478bd9Sstevel@tonic-gate exit 1 807c478bd9Sstevel@tonic-gate ;; 817c478bd9Sstevel@tonic-gate esac 827c478bd9Sstevel@tonic-gate if [ -d $ROOT ]; then 83f136dc05Scarlsonj validate_paths '-s/\s*'$arch'$//' -e '^opt/onbld' $excl \ 84f136dc05Scarlsonj -b $ROOT $args $SRC/pkgdefs/etc/exception_list_$arch 857c478bd9Sstevel@tonic-gate fi 867c478bd9Sstevel@tonic-gatedone 877c478bd9Sstevel@tonic-gate 887c478bd9Sstevel@tonic-gate# Two entries in the findunref exception_list deal with things created 897c478bd9Sstevel@tonic-gate# by nightly. Otherwise, this test could be run on an unmodifed (and 907c478bd9Sstevel@tonic-gate# unbuilt) workspace. We handle this by flagging the one that is 917c478bd9Sstevel@tonic-gate# present only on a built workspace (./*.out) and the one that's 927c478bd9Sstevel@tonic-gate# present only after a run of findunref (./*.ref) with ISUSED, and 937c478bd9Sstevel@tonic-gate# disabling all checks of them. The assumption is that the entries 947c478bd9Sstevel@tonic-gate# marked with ISUSED are always known to be good, thus the Latin quote 957c478bd9Sstevel@tonic-gate# at the top of the file. 967c478bd9Sstevel@tonic-gateif [ -r $SRC/tools/findunref/exception_list ]; then 97f136dc05Scarlsonj # If the closed source is not present, then don't validate it. 98f136dc05Scarlsonj if [ "$CLOSED_IS_PRESENT" = no ]; then 99f136dc05Scarlsonj excl="-e ^\./closed" 100f136dc05Scarlsonj fi 101f136dc05Scarlsonj validate_paths -k ISUSED -r -e '^\*' $excl -b $SRC/.. \ 1027c478bd9Sstevel@tonic-gate $SRC/tools/findunref/exception_list 1037c478bd9Sstevel@tonic-gatefi 1047c478bd9Sstevel@tonic-gate 1057c478bd9Sstevel@tonic-gate# These are straightforward. 1067c478bd9Sstevel@tonic-gateif [ -d $SRC/xmod ]; then 107f136dc05Scarlsonj # If the closed source is not present, then don't validate it. 108f136dc05Scarlsonj if [ "$CLOSED_IS_PRESENT" = no ]; then 109f136dc05Scarlsonj excl_cry="-e ^usr/closed" 110f136dc05Scarlsonj excl_xmod="-e ^../closed" 111f136dc05Scarlsonj fi 112f136dc05Scarlsonj validate_paths $excl_cry $SRC/xmod/cry_files 113f136dc05Scarlsonj validate_paths $excl_xmod -b $SRC $SRC/xmod/xmod_files 1147c478bd9Sstevel@tonic-gatefi 1157c478bd9Sstevel@tonic-gate 116*99dda208Smjnelsonif [ -f $SRC/tools/opensolaris/license-list ]; then 117*99dda208Smjnelson excl= 118*99dda208Smjnelson if [ "$CLOSED_IS_PRESENT" = no ]; then 119*99dda208Smjnelson excl="-e ^usr/closed" 120*99dda208Smjnelson fi 121*99dda208Smjnelson sed -e 's/$/.descrip/' < $SRC/tools/opensolaris/license-list | \ 122*99dda208Smjnelson validate_paths $excl 123*99dda208Smjnelsonfi 124*99dda208Smjnelson 1257c478bd9Sstevel@tonic-gate# Finally, make sure the that (req|inc).flg files are in good shape. 126f136dc05Scarlsonj# If SCCS files are not expected to be present, though, then don't 127f136dc05Scarlsonj# check them. 128f136dc05Scarlsonjif [ ! -d "$CODEMGR_WS/Codemgr_wsdata" ]; then 129f136dc05Scarlsonj f_flg='-f' 130f136dc05Scarlsonjfi 131f136dc05Scarlsonj# If the closed source is not present, then don't validate it. 132f136dc05Scarlsonjif [ "$CLOSED_IS_PRESENT" = no ]; then 133f136dc05Scarlsonj excl="-e ^usr/closed/" 134f136dc05Scarlsonjfi 135f136dc05Scarlsonj 136f136dc05Scarlsonjvalidate_flg $f_flg $excl 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gateexit 0 139