10063 basic support for smatch
[unleashed.git] / usr / src / tools / scripts / checkpaths.sh
blobe4a9b21b61ba1c40710521f21de3fdaeb94d44d6
1 #!/bin/ksh -p
3 # CDDL HEADER START
5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
20 # CDDL HEADER END
22 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
25 # Copyright (c) 2019, Joyent, Inc.
27 # Quis custodiet ipsos custodies?
29 if [ -z "$SRC" ]; then
30 SRC=$CODEMGR_WS/usr/src
33 if [ -z "$CODEMGR_WS" -o ! -d "$CODEMGR_WS" -o ! -d "$SRC" ]; then
34 echo "$0: must be run from within a workspace."
35 exit 1
38 cd $CODEMGR_WS || exit 1
40 # Use -b to tell this script to ignore derived (built) objects.
41 if [ "$1" = "-b" ]; then
42 b_flg=y
45 # Not currently used; available for temporary workarounds.
46 args="-k NEVER_CHECK"
48 # We intentionally don't depend on $MACH here, and thus no $ROOT. If
49 # a proto area exists, then we use it. This allows this script to be
50 # run against gates (which should contain both SPARC and x86 proto
51 # areas), build workspaces (which should contain just one proto area),
52 # and unbuilt workspaces (which contain no proto areas).
53 if [ "$b_flg" = y ]; then
54 rootlist=
55 elif [ $# -gt 0 ]; then
56 rootlist=$*
57 else
58 rootlist="$CODEMGR_WS/proto/root_sparc $CODEMGR_WS/proto/root_i386"
61 for ROOT in $rootlist
63 case "$ROOT" in
64 *sparc|*sparc-nd)
65 arch=sparc
67 *i386|*i386-nd)
68 arch=i386
71 echo "$ROOT has unknown architecture." >&2
72 exit 1
74 esac
75 done
77 # Two entries in the findunref exception_list deal with things created
78 # by nightly. Otherwise, this test could be run on an unmodifed (and
79 # unbuilt) workspace. We handle this by flagging the one that is
80 # present only on a built workspace (./*.out) and the one that's
81 # present only after a run of findunref (./*.ref) with ISUSED, and
82 # disabling all checks of them. The assumption is that the entries
83 # marked with ISUSED are always known to be good, thus the Latin quote
84 # at the top of the file.
86 # The exception_list is generated from whichever input files are appropriate
87 # for this workspace, so checking it obviates the need to check the inputs.
89 if [ -r $SRC/tools/findunref/exception_list ]; then
90 validate_paths -k ISUSED -r -e '^\*' $SRC/tools/findunref/exception_list
93 if [ -f $SRC/tools/opensolaris/license-list ]; then
94 sed -e 's/$/.descrip/' < $SRC/tools/opensolaris/license-list | \
95 validate_paths -n SRC/tools/opensolaris/license-list
98 validate_flg -f
100 exit 0