6 # The contents of this file are subject to the terms of the
7 # Common Development and Distribution License (the "License").
8 # You may not use this file except in compliance with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
25 # Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
26 # Copyright 2008, 2010, Richard Lowe
27 # Copyright 2011 Nexenta Systems, Inc. All rights reserved.
28 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
29 # Copyright 2014 Garrett D'Amore <garrett@damore.org>
31 # Based on the nightly script from the integration folks,
32 # Mostly modified and owned by mike_s.
33 # Changes also by kjc, dmk.
35 # -i on the command line, means fast options, so when it's on the
36 # command line (only), check builds are skipped no matter what
37 # the setting of their individual flags are in NIGHTLY_OPTIONS.
39 # OPTHOME may be set in the environment to override /opt
43 # The CDPATH variable causes ksh's `cd' builtin to emit messages to stdout
44 # under certain circumstances, which can really screw things up; unset it.
48 # Get the absolute path of the nightly script that the user invoked. This
49 # may be a relative path, and we need to do this before changing directory.
50 nightly_path
=`whence $0`
54 print
-u2 "nightly: $*"
59 # Function to do a DEBUG and non-DEBUG build. Needed because we might
60 # need to do another for the source build, and since we only deliver DEBUG or
65 function normal_build
{
67 typeset orig_p_FLAG
="$p_FLAG"
69 if [ "$D_FLAG" = "n" ]; then
70 set_non_debug_build_flags
81 # usage: run_hook HOOKNAME ARGS...
83 # If variable "$HOOKNAME" is defined, insert a section header into
84 # our logs and then run the command with ARGS
88 eval HOOKCMD
=\$
$HOOKNAME
91 if [ -n "$HOOKCMD" ]; then
93 echo "\n==== Running $HOOKNAME command: $HOOKCMD ====\n"
94 ( $HOOKCMD "$@" 2>&1 )
95 if [ "$?" -ne 0 ]; then
96 # Let exit status propagate up
101 if [ -f $TMPDIR/abort
]; then
103 echo "\nAborting at request of $HOOKNAME"
109 # Return library search directive as function of given root.
111 echo "-L$1/lib -L$1/usr/lib"
114 # Return header search directive as function of given root.
116 echo "-I$1/usr/include"
120 # Function to do the build, including package generation.
122 # - LABEL is used to tag build output.
126 INSTALLOG
=install-
${MACH}
131 export ENVLDLIBS1
=`myldlibs $ROOT`
132 export ENVCPPFLAGS1
=`myheaders $ROOT`
137 # Before we build anything via dmake, we need to install
138 # bmake-ified headers to the proto area
140 bmake_build_step_user_dir
$SRCTOP/include all
141 bmake_build_step_user_dir
$SRCTOP/include
install
144 # Build the legacy part of the source
146 echo "\n==== Building legacy source at `date` ($LABEL) ====\n"
149 echo "\n==== dmake install ====\n" >&2
150 if ! /bin
/time $MAKE -e install; then
156 # Build the new part of the source
158 bmake_build_step_user build
160 echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n"
165 if [ "$p_FLAG" = "y" -a "$this_build_ok" = "y" ]; then
166 if [ -d $SRC/pkg
]; then
167 echo "\n==== Creating $LABEL packages at `date` ====\n"
168 echo "Clearing out $PKGARCHIVE ..."
172 rm -f $SRC/pkg
/${INSTALLOG}.out
174 echo "\n==== package build errors ($LABEL) ====\n" >&2
175 if ! /bin
/time $MAKE -e install; then
181 # Handle it gracefully if -p was set but there so
184 echo "\n==== No $LABEL packages to build ====\n"
187 echo "\n==== Not creating $LABEL packages ====\n"
192 # Build and install the onbld tools.
194 # usage: build_tools DESTROOT
196 # returns non-zero status if the build was successful.
198 function build_tools
{
201 INSTALLOG
=install-
${MACH}
203 echo "\n==== Building tools at `date` ====\n" \
205 rm -f ${TOOLS}/${INSTALLOG}.out
207 echo "\n==== Tools build errors ====\n" >&2
208 if ! /bin
/time $MAKE TOOLS_PROTO
=${DESTROOT} -e install; then
215 # Set up to use locally installed tools.
217 # usage: use_tools TOOLSROOT
223 # If we're not building ON workspace, then the TOOLSROOT
224 # settings here are clearly ignored by the workspace
225 # makefiles, prepending nonexistent directories to PATH is
226 # harmless, and we clearly do not wish to override
229 # If we're building an ON workspace, then the prepended PATH
230 # elements should supercede the preexisting ONBLD_TOOLS paths,
231 # and we want to override ONBLD_TOOLS to catch the tools that
232 # don't have specific path env vars here.
234 # So the only conditional behavior is overriding ONBLD_TOOLS,
235 # and we check for "an ON workspace" by looking for
236 # ${TOOLSROOT}/opt/onbld.
239 STABS
=${TOOLSROOT}/opt
/onbld
/bin
/${MACH}/stabs
241 CTFSTABS
=${TOOLSROOT}/opt
/onbld
/bin
/${MACH}/ctfstabs
243 GENOFFSETS
=${TOOLSROOT}/opt
/onbld
/bin
/genoffsets
247 PATH
="${TOOLSROOT}/opt/onbld/bin/${MACH}:${PATH}"
248 PATH
="${TOOLSROOT}/opt/onbld/bin:${PATH}"
251 if [ -d "${TOOLSROOT}/opt/onbld" ]; then
252 ONBLD_TOOLS
=${TOOLSROOT}/opt
/onbld
256 echo "\n==== New environment settings. ====\n"
257 echo "STABS=${STABS}"
258 echo "CTFSTABS=${CTFSTABS}"
260 echo "ONBLD_TOOLS=${ONBLD_TOOLS}"
264 # wrapper over wsdiff.
265 # usage: do_wsdiff LABEL OLDPROTO NEWPROTO
274 echo "\n==== Getting object changes since last build at `date`" \
275 "($label) ====\n" >&2
276 $wsdiff -s -r ${TMPDIR}/wsdiff.results
$oldproto $newproto >&2
277 echo "\n==== Object changes determined at `date` ($label) ====\n" >&2
281 # Functions for setting build flags (DEBUG/non-DEBUG). Keep them
285 function set_non_debug_build_flags
{
286 export RELEASE_BUILD
; RELEASE_BUILD
=
291 function set_debug_build_flags
{
300 if [ "$OPTHOME" = "" ]; then
305 USAGE
='Usage: nightly [-in] [-V VERS ] <env_file>
308 -i Fast incremental options (no clobber, check)
309 -V VERS set the build version string to VERS
311 <env_file> file in Bourne shell syntax that sets and exports
312 variables that configure the operation of this script and many of
313 the scripts this one calls.
315 non-DEBUG is the default build type. Build options can be set in the
316 NIGHTLY_OPTIONS variable in the <env_file> as follows:
318 -A check for ABI differences in .so files
319 -C check for cstyle/hdrchk errors
320 -D do a build with DEBUG on
321 -G gate keeper default group of options (-au)
322 -I integration engineer default group of options (-ampu)
323 -M do not run pmodes (safe file permission checker)
324 -N do not run protocmp
325 -R default group of options for building a release (-mp)
326 -U update proto area in the parent
327 -V VERS set the build version string to VERS
328 -i do an incremental build (no "make clobber")
329 -m send mail to $MAILTO at end of build
331 -r check ELF runtime attributes in the proto area
332 -u update proto_list_$MACH and friends in the parent workspace
333 -w report on differences between previous and current proto areas
336 # A log file will be generated under the name $LOGFILE
337 # for partially completed build and log.`date '+%F'`
338 # in the same directory for fully completed builds.
341 # default values for low-level FLAGS; G I R are group FLAGS
345 i_FLAG
=n
; i_CMD_LINE_FLAG
=n
363 while getopts +iV
:W FLAG
366 i
) i_FLAG
=y
; i_CMD_LINE_FLAG
=y
379 # correct argument count after options
380 shift `expr $OPTIND - 1`
382 # test that the path to the environment-setting file was given
383 if [ $# -ne 1 ]; then
391 LC_ALL
=C
; export LC_ALL
392 LC_COLLATE
=C
; export LC_COLLATE
393 LC_CTYPE
=C
; export LC_CTYPE
394 LC_MESSAGES
=C
; export LC_MESSAGES
395 LC_MONETARY
=C
; export LC_MONETARY
396 LC_NUMERIC
=C
; export LC_NUMERIC
397 LC_TIME
=C
; export LC_TIME
399 # clear environment variables we know to be bad for the build
401 unset LD_AUDIT LD_AUDIT_32 LD_AUDIT_64
402 unset LD_BIND_NOW LD_BIND_NOW_32 LD_BIND_NOW_64
403 unset LD_BREADTH LD_BREADTH_32 LD_BREADTH_64
404 unset LD_CONFIG LD_CONFIG_32 LD_CONFIG_64
405 unset LD_DEBUG LD_DEBUG_32 LD_DEBUG_64
406 unset LD_DEMANGLE LD_DEMANGLE_32 LD_DEMANGLE_64
407 unset LD_FLAGS LD_FLAGS_32 LD_FLAGS_64
408 unset LD_LIBRARY_PATH LD_LIBRARY_PATH_32 LD_LIBRARY_PATH_64
409 unset LD_LOADFLTR LD_LOADFLTR_32 LD_LOADFLTR_64
410 unset LD_NOAUDIT LD_NOAUDIT_32 LD_NOAUDIT_64
411 unset LD_NOAUXFLTR LD_NOAUXFLTR_32 LD_NOAUXFLTR_64
412 unset LD_NOCONFIG LD_NOCONFIG_32 LD_NOCONFIG_64
413 unset LD_NODIRCONFIG LD_NODIRCONFIG_32 LD_NODIRCONFIG_64
414 unset LD_NODIRECT LD_NODIRECT_32 LD_NODIRECT_64
415 unset LD_NOLAZYLOAD LD_NOLAZYLOAD_32 LD_NOLAZYLOAD_64
416 unset LD_NOOBJALTER LD_NOOBJALTER_32 LD_NOOBJALTER_64
417 unset LD_NOVERSION LD_NOVERSION_32 LD_NOVERSION_64
418 unset LD_ORIGIN LD_ORIGIN_32 LD_ORIGIN_64
419 unset LD_PRELOAD LD_PRELOAD_32 LD_PRELOAD_64
420 unset LD_PROFILE LD_PROFILE_32 LD_PROFILE_64
432 # To get ONBLD_TOOLS from the environment, it must come from the env file.
433 # If it comes interactively, it is generally TOOLS_PROTO, which will be
434 # clobbered before the compiler version checks, which will therefore fail.
439 # Setup environmental variables
442 if [[ $1 = */* ]]; then
448 echo "Cannot find env file as either $1"
452 # Check if we have sufficient data to continue...
454 fatal_error
"Error: Variable SRCTOP not set."
455 [[ -d "${SRCTOP}" ]] || \
456 fatal_error
"Error: ${SRCTOP} is not a directory."
457 [[ -f "${SRCTOP}/usr/src/Makefile" ]] || \
458 fatal_error
"Error: ${SRCTOP}/usr/src/Makefile not found."
461 # place ourselves in a new task, respecting BUILD_PROJECT if set.
463 if [ -z "$BUILD_PROJECT" ]; then
464 /usr
/bin
/newtask
-c $$
466 /usr
/bin
/newtask
-c $$
-p $BUILD_PROJECT
469 ps
-o taskid
= -p $$ |
read build_taskid
470 ps
-o project
= -p $$ |
read build_project
473 # See if NIGHTLY_OPTIONS is set
475 if [ "$NIGHTLY_OPTIONS" = "" ]; then
476 NIGHTLY_OPTIONS
="-aBm"
480 # Note: changes to the option letters here should also be applied to the
481 # bldenv script. `d' is listed for backward compatibility.
483 NIGHTLY_OPTIONS
=-${NIGHTLY_OPTIONS#-}
485 while getopts +ABCDdfGIiMmNpRrwW FLAG
$NIGHTLY_OPTIONS
491 ;; # old version of D
525 if [ -z "$MAILTO" -o "$MAILTO" = "nobody" ]; then
526 MAILTO
=`/usr/bin/id -un`
530 PATH
="$OPTHOME/onbld/bin:$OPTHOME/onbld/bin/${MACH}:/usr/ccs/bin"
531 PATH
="$PATH:/usr/bin:/usr/sbin:/usr/ucb"
532 PATH
="$PATH:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:.:$OPTHOME/SUNWspro/bin"
535 # roots of source trees, both relative to $SRC and absolute.
539 PROTOCMPTERSE
="protocmp.terse -gu"
541 # have we set RELEASE_DATE in our env file?
542 if [ -z "$RELEASE_DATE" ]; then
543 RELEASE_DATE
=$
(LC_ALL
=C
date +"%B %Y")
545 BUILD_DATE
=$
(LC_ALL
=C
date +%Y-
%b-
%d
)
546 BASEWSDIR
=$
(basename $SRCTOP)
547 DEV_CM
="\"@(#)illumos Development: $LOGNAME $BUILD_DATE [$BASEWSDIR]\""
548 RELEASE_MICRO
=$
(( ($
(date +%Y
) * 12 + $
(date +%m
) - 1) - (2010 * 12 + 8 - 1) ))
550 # we export POUND_SIGN, RELEASE_DATE and DEV_CM to speed up the build process
551 # by avoiding repeated shell invocations to evaluate Makefile.master
553 export POUND_SIGN RELEASE_DATE DEV_CM RELEASE_MICRO
555 maketype
="distributed"
556 if [[ -z "$MAKE" ]]; then
558 elif [[ ! -x "$MAKE" ]]; then
559 echo "\$MAKE is set to garbage in the environment"
566 if [[ $DMAKE_MAX_JOBS != +([0-9]) ||
$DMAKE_MAX_JOBS -eq 0 ]]
569 if [[ -f $HOME/.
make.machines
]]
571 # Note: there is a hard tab and space character in the []s
573 egrep -i "^[ ]*$hostname[ \.]" \
574 $HOME/.
make.machines |
read host jobs
578 if [[ $maxjobs != +([0-9]) ||
$maxjobs -eq 0 ]]
584 export DMAKE_MAX_JOBS
=$maxjobs
590 if [ -z "${ROOT}" ]; then
591 echo "ROOT must be set."
596 # if -V flag was given, reset VERSION to V_ARG
598 if [ "$V_FLAG" = "y" ]; then
602 TMPDIR
="/tmp/nightly.tmpdir.$$"
605 mkdir
-p $TMPDIR ||
exit 1
607 # Tools should only be built non-DEBUG. Keep track of the tools proto
608 # area path relative to $TOOLS, because the latter changes in an
611 # TOOLS_PROTO is included below for builds other than usr/src/tools
612 # that look for this location. For usr/src/tools, this will be
613 # overridden on the $MAKE command line in build_tools().
616 TOOLS_PROTO_REL
=proto
/root_
${MACH}-nd
617 TOOLS_PROTO
=${TOOLS}/${TOOLS_PROTO_REL}; export TOOLS_PROTO
619 unset CFLAGS LD_LIBRARY_PATH LDFLAGS
621 # create directories that are automatically removed if the nightly script
622 # fails to start correctly
626 while [ ! -d $dir ]; do
632 for dir
in $toadd; do
634 newlist
="$dir $newlist"
637 [ -z "$torm" ] ||
rmdir $torm
641 newdirlist
="$newlist $newdirlist"
646 [ -d $SRCTOP ] || newdir
$SRCTOP ||
exit 1
648 # since this script assumes the build is from full source, it nullifies
649 # variables likely to have been set by a "ws" script; nullification
650 # confines the search space for headers and libraries to the proto area
651 # built from this immediate source.
660 export ENVLDLIBS3 ENVCPPFLAGS1 ENVCPPFLAGS2 ENVCPPFLAGS3 ENVCPPFLAGS4 \
661 ENVLDLIBS1 ENVLDLIBS2
664 # Juggle the logs and optionally send mail on completion.
667 function logshuffle
{
668 LLOG
="$ATLOG/log.`date '+%F.%H:%M'`"
669 if [ -f $LLOG -o -d $LLOG ]; then
675 if [ "$build_ok" = "y" ]; then
676 mv $ATLOG/proto_list_
${MACH} $LLOG
678 if [ -f $ATLOG/proto_list_tools_
${MACH} ]; then
679 mv $ATLOG/proto_list_tools_
${MACH} $LLOG
682 if [ -f $TMPDIR/wsdiff.results
]; then
683 mv $TMPDIR/wsdiff.results
$LLOG
686 if [ -f $TMPDIR/wsdiff-nd.results
]; then
687 mv $TMPDIR/wsdiff-nd.results
$LLOG
704 if [[ $state != "Interrupted" && $build_extras_ok != "y" ]]; then
708 NIGHTLY_STATUS
=$state
709 export NIGHTLY_STATUS
711 run_hook POST_NIGHTLY
$state
712 run_hook SYS_POST_NIGHTLY
$state
714 echo "Subject: Nightly ${MACH} Build of `basename ${SRCTOP}` ${state}." \
716 cat $build_time_file $mail_msg_file \
718 if [ "$m_FLAG" = "y" ]; then
719 /usr
/bin
/mail ${MAILTO} < ${LLOG}/mail_msg
726 # Remove the temporary files on any exit
732 while [ $# -gt 0 ]; do
739 function cleanup_signal
{
741 # this will trigger cleanup(), above.
746 trap cleanup_signal
1 2 3 15
751 # Create mail_msg_file
753 mail_msg_file
="${TMPDIR}/mail_msg"
755 build_time_file
="${TMPDIR}/build_time"
759 # Move old LOGFILE aside
761 if [ -f $LOGFILE ]; then
762 mv -f $LOGFILE ${LOGFILE}-
765 mkfifo ${TMPDIR}/err.fifo
${TMPDIR}/out.fifo
766 tee $mail_msg_file < ${TMPDIR}/err.fifo
>> $LOGFILE &
768 tee ${TMPDIR}/stdout.txt
< ${TMPDIR}/out.fifo
>> $LOGFILE &
770 exec > ${TMPDIR}/out.fifo
771 exec 2> ${TMPDIR}/err.fifo
778 echo "\n==== Nightly $maketype build started: $START_DATE ====" | \
779 tee -a $build_time_file
781 echo "\nBuild project: $build_project\nBuild taskid: $build_taskid" >&2
783 run_hook SYS_PRE_NIGHTLY
786 echo "\n==== list of environment variables ====\n"
789 echo "\n==== Nightly argument issues ====\n" >&2
791 if [ "$N_FLAG" = "y" ]; then
792 if [ "$p_FLAG" = "y" ]; then
794 WARNING: the p option (create packages) is set, but so is the N option (do
795 not run protocmp); this is dangerous; you should unset the N option
799 Warning: the N option (do not run protocmp) is set; it probably shouldn't be
805 if [ "$w_FLAG" = "y" -a ! -d $ROOT ]; then
806 echo "WARNING: -w specified, but $ROOT does not exist;" \
811 echo "\n==== Build version ====\n" >&2
814 # Save the current proto area if we're comparing against the last build
815 if [ "$w_FLAG" = "y" -a -d "$ROOT" ]; then
816 if [ -d "$ROOT.prev" ]; then
823 echo "\n==== bmake $@ ====\n" >&2
824 /bin
/time env
-i PATH
=${GCC_ROOT}/bin
:/usr
/bin \
826 bmake
-j $DMAKE_MAX_JOBS \
831 # usage: bmake_build_step_args <dir> <target> <args...>
832 function bmake_build_step_args
{
836 echo "\n==== \`bmake -C $D $@\` at `date` ($LABEL) ====\n"
838 if ! run_bmake
-C $D "$@"; then
847 # usage: bmake_build_step_user <target>
848 function bmake_build_step_user
{
849 bmake_build_step_args
$SRCTOP $1 \
853 # usage: bmake_build_step_user_dir <dir> <target>
854 function bmake_build_step_user_dir
{
855 bmake_build_step_args
$1 $2 \
860 [[ -v SRCTOP
]] || fatal_error
"Error: Variable SRCTOP not set."
861 [[ -d "${SRCTOP}" ]] || fatal_error
"Error: ${SRCTOP} is not a directory."
862 [[ -f "${SRCTOP}/usr/src/Makefile" ]] || fatal_error
"Error: ${SRCTOP}/usr/src/Makefile not found."
865 # Generate the cfgparam files
867 # We have to do this before running *any* make commands.
869 bmake_build_step_args
$SRCTOP gen-config || build_extras_ok
=n
872 # Decide whether to clobber
874 if [ "$i_FLAG" = "n" -a -d "$SRC" ]; then
875 echo "\n==== Make clobber at `date` ====\n"
878 # remove old clobber file
879 rm -f $SRC/clobber.out
880 rm -f $SRC/clobber-
${MACH}.out
882 # Remove all .make.state* files, just in case we are restarting
883 # the build after having interrupted a previous 'make clobber'.
884 find . \
( -name SCCS
-o -name .hg
-o -name .svn
-o -name .git \
885 -o -name 'interfaces.*' \
) -prune \
886 -o -name '.make.*' -print |
xargs rm -f
888 echo "\n==== Make clobber ERRORS ====\n" >&2
889 if ! $MAKE -ek clobber
; then
893 echo "\n==== Make tools clobber at `date` ====\n"
895 rm -f ${TOOLS}/clobber-
${MACH}.out
897 echo "\n==== Make tools clobber ERRORS ====\n" >&2
898 if ! $MAKE TOOLS_PROTO
=$TOOLS_PROTO -ek clobber
; then
901 rm -rf ${TOOLS_PROTO}
902 mkdir
-p ${TOOLS_PROTO}
905 echo "\n\nClearing $roots"
908 # Get back to a clean workspace as much as possible to catch
909 # problems that only occur on fresh workspaces.
910 # Remove all .make.state* files, libraries, and .o's that may
911 # have been omitted from clobber. A couple of libraries are
912 # under source code control, so leave them alone.
913 # We should probably blow away temporary directories too.
915 find $relsrcdirs \
( -name SCCS
-o -name .hg
-o -name .svn \
916 -o -name .git
-o -name 'interfaces.*' \
) -prune -o \
917 \
( -name '.make.*' -o -name 'lib*.a' -o -name 'lib*.so*' -o \
918 -name '*.o' \
) -print | \
919 grep -v 'tools/ctf/dwarf/.*/libdwarf' |
xargs rm -f
920 echo "\n==== bmake cleandir ====\n"
921 run_bmake
-C $SRCTOP cleandir
923 echo "\n==== No clobber at `date` ====\n"
926 echo "\n==== Build environment ====\n" >&2
936 echo "number of concurrent jobs = $DMAKE_MAX_JOBS" >&2
939 # Report the compiler versions.
942 if [[ ! -f $SRC/Makefile
]]; then
944 echo "\nUnable to find \"Makefile\" in $SRC." >&2
952 # Build and use the workspace's tools if requested
954 set_non_debug_build_flags
956 build_tools
${TOOLS_PROTO}
957 if (( $?
!= 0 )); then
960 use_tools
$TOOLS_PROTO
966 BINARCHIVE
=${SRCTOP}/bin-
${MACH}.
cpio.Z
968 if [ "$build_ok" = "y" ]; then
969 echo "\n==== Creating protolist system file at `date` ====" \
970 protolist
$ROOT > $ATLOG/proto_list_
${MACH}
971 echo "==== protolist system file created at `date` ====\n" \
973 if [ "$N_FLAG" != "y" ]; then
985 if [ -d "$SRC/pkg" ]; then
986 f2
="$f2 exceptions/packaging"
996 if [ "$N_FLAG" != "y" -a -d $SRC/pkg
]; then
997 echo "\n==== Validating manifests against proto area ====\n" >&2
998 if ! ( cd $SRC/pkg
; $MAKE -e protocmp ROOT
="$ROOT" ) >&2; then
1005 # ELF verification: ABI (-A) and runtime (-r) checks
1007 if [[ ($build_ok = y
) && (($A_FLAG = y
) ||
($r_FLAG = y
)) ]]; then
1008 # Directory ELF-data.$MACH holds the files produced by these tests.
1009 elf_ddir
=$SRC/ELF-data.
$MACH
1011 # If there is a previous ELF-data backup directory, remove it. Then,
1012 # rotate current ELF-data directory into its place and create a new
1014 rm -rf $elf_ddir.ref
1015 if [[ -d $elf_ddir ]]; then
1016 mv $elf_ddir $elf_ddir.ref
1020 # Call find_elf to produce a list of the ELF objects in the proto area.
1021 # This list is passed to check_rtime and interface_check, preventing
1022 # them from separately calling find_elf to do the same work twice.
1023 find_elf
-fr $ROOT > $elf_ddir/object_list
1025 if [[ $A_FLAG = y
]]; then
1026 echo "\n==== Check versioning and ABI information ====\n" >&2
1028 # Produce interface description for the proto. Report errors.
1029 interface_check
-o -w $elf_ddir -f object_list \
1030 -i interface
-E interface.err
1031 if [[ -s $elf_ddir/interface.err
]]; then
1032 cat $elf_ddir/interface.err
>&2
1036 # If ELF_DATA_BASELINE_DIR is defined, compare the new interface
1037 # description file to that from the baseline gate. Issue a
1038 # warning if the baseline is not present, and keep going.
1039 if [[ "$ELF_DATA_BASELINE_DIR" != '' ]]; then
1040 base_ifile
="$ELF_DATA_BASELINE_DIR/interface"
1042 echo "\n==== Compare versioning and ABI information" \
1043 "to baseline ====\n" >&2
1044 echo "Baseline: $base_ifile\n"
1046 if [[ -f $base_ifile ]]; then
1047 interface_cmp
-d -o $base_ifile \
1048 $elf_ddir/interface
> $elf_ddir/interface.
cmp
1049 if [[ -s $elf_ddir/interface.
cmp ]]; then
1051 cat $elf_ddir/interface.
cmp >&2
1055 echo "baseline not available. comparison" \
1062 if [[ $r_FLAG = y
]]; then
1063 echo "\n==== Check ELF runtime attributes ====\n" >&2
1065 # If we're doing a DEBUG build the proto area will be left
1066 # with debuggable objects, thus don't assert -s.
1067 if [[ $D_FLAG = y
]]; then
1072 check_rtime
-i -v $rtime_sflag -o -w $elf_ddir \
1073 -D object_list
-f object_list
-E runtime.err \
1075 if (( $?
!= 0 )); then
1079 # check_rtime -I output needs to be sorted in order to
1080 # compare it to that from previous builds.
1081 sort $elf_ddir/runtime.attr.raw
> $elf_ddir/runtime.attr
1082 rm $elf_ddir/runtime.attr.raw
1085 if [[ -s $elf_ddir/runtime.err
]]; then
1086 cat $elf_ddir/runtime.err
>&2
1090 # If there is an ELF-data directory from a previous build,
1091 # then diff the attr files. These files contain information
1092 # about dependencies, versioning, and runpaths. There is some
1093 # overlap with the ABI checking done above, but this also
1094 # flushes out non-ABI interface differences along with the
1095 # other information.
1096 echo "\n==== Diff ELF runtime attributes" \
1097 "(since last build) ====\n" >&2
1099 if [[ -f $elf_ddir.ref
/runtime.attr
]]; then
1100 diff $elf_ddir.ref
/runtime.attr \
1101 $elf_ddir/runtime.attr
>&2
1106 # "make check" begins
1108 if [ "$i_CMD_LINE_FLAG" = "n" -a "$C_FLAG" = "y" ]; then
1109 # remove old check.out
1110 rm -f $SRC/check.out
1112 rm -f $SRC/check-
${MACH}.out
1114 echo "\n==== cstyle/hdrchk errors ====\n" >&2
1115 if ! $MAKE -ek check ROOT
="$ROOT"; then
1119 echo "\n==== No '$MAKE check' ====\n"
1122 echo "\n==== Find core files ====\n" >&2
1124 find $abssrcdirs -name core
-a -type f
-exec file {} \
; >&2
1126 # Verify that the usual lists of files, such as exception lists,
1127 # contain only valid references to files. If the build has failed,
1128 # then don't check the proto area.
1129 CHECK_PATHS
=${CHECK_PATHS:-y}
1130 if [ "$CHECK_PATHS" = y
-a "$N_FLAG" != y
]; then
1131 echo "\n==== Check lists of files ====\n" >&2
1133 [ "$build_ok" = y
] && arg
=
1134 checkpaths
$arg $ROOT > $SRC/check-paths.out
2>&1
1135 if [[ -s $SRC/check-paths.out
]]; then
1136 cat $SRC/check-paths.out
>&2
1141 if [ "$M_FLAG" != "y" -a "$build_ok" = y
]; then
1142 echo "\n==== Impact on file permissions ====\n" >&2
1145 for d
in $abssrcdirs; do
1146 if [ -d "$d/pkg" ]; then
1151 if [ -n "$abspkg" ]; then
1152 for d
in "$abspkg"; do
1153 ( cd $d/pkg
; $MAKE -e pmodes
) >&2
1158 if [ "$w_FLAG" = "y" -a "$build_ok" = "y" ]; then
1159 if [[ "$D_FLAG" = y
]]; then
1160 do_wsdiff DEBUG
$ROOT.prev
$ROOT
1162 do_wsdiff non-DEBUG
$ROOT.prev
$ROOT
1167 echo "==== Nightly $maketype build completed: $END_DATE ====" | \
1168 tee -a $build_time_file
1174 elapsed_time
=$SECONDS
1175 ((hours
= elapsed_time
/ 3600 ))
1176 ((minutes
= elapsed_time
/ 60 % 60))
1177 ((seconds
= elapsed_time
% 60))
1179 echo "\n==== Total build time ====" | \
1180 tee -a $build_time_file
1181 echo "\nreal ${hours}:${minutes}:${seconds}" | \
1182 tee -a $build_time_file
1185 # All done save for the sweeping up.
1186 # (whichever exit we hit here will trigger the "cleanup" trap which
1187 # optionally sends mail on completion).
1189 if [[ "$build_ok" == "y" ]]; then
1190 if [[ "$W_FLAG" == "y" ||
"$build_extras_ok" == "y" ]]; then