Print this page
4522 the build doesn't fail nearly often enough
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Jens Elkner <jel+illumos@cs.uni-magdeburg.de>

@@ -197,12 +197,13 @@
         echo "\n==== Build errors ($LABEL) ====\n" >> $mail_msg_file
         egrep ":" $SRC/${INSTALLOG}.out |
                 egrep -e "(^${MAKE}:|[  ]error[:        \n])" | \
                 egrep -v "Ignoring unknown host" | \
                 egrep -v "cc .* -o error " | \
-                egrep -v "warning" >> $mail_msg_file
-        if [ "$?" = "0" ]; then
+                egrep -v "warning" | tee $TMPDIR/build_errs${SUFFIX} \
+                >> $mail_msg_file
+        if [[ -s $TMPDIR/build_errs${SUFFIX} ]]; then
                 build_ok=n
                 this_build_ok=n
         fi
         grep "bootblock image is .* bytes too big" $SRC/${INSTALLOG}.out \
                 >> $mail_msg_file

@@ -216,11 +217,15 @@
                 | egrep -v '^tic:' \
                 | egrep -v "symbol (\`|')timezone' has differing types:" \
                 | egrep -v "parameter <PSTAMP> set to" \
                 | egrep -v "Ignoring unknown host" \
                 | egrep -v "redefining segment flags attribute for" \
-                >> $mail_msg_file
+                | tee $TMPDIR/build_warnings${SUFFIX} >> $mail_msg_file
+        if [[ -s $TMPDIR/build_warnings${SUFFIX} ]]; then
+                build_ok=n
+                this_build_ok=n
+        fi
 
         echo "\n==== Ended OS-Net source build at `date` ($LABEL) ====\n" \
                 >> $LOGFILE
 
         echo "\n==== Elapsed build time ($LABEL) ====\n" >>$mail_msg_file

@@ -331,12 +336,16 @@
                                 >> $mail_msg_file
 
                         egrep "${MAKE}|ERROR|WARNING" $SRC/pkg/${INSTALLOG}.out | \
                                 grep ':' | \
                                 grep -v PSTAMP | \
-                                egrep -v "Ignoring unknown host" \
-                                >> $mail_msg_file
+                                egrep -v "Ignoring unknown host" | \
+                                tee $TMPDIR/package >> $mail_msg_file
+                        if [[ -s $TMPDIR/package ]]; then
+                                build_extras_ok=n
+                                this_build_ok=n
+                        fi
                 else
                         #
                         # Handle it gracefully if -p was set but there so
                         # no pkg directory.
                         #

@@ -393,14 +402,19 @@
             `find . \( -name SCCS -o -name .hg -o -name .svn -o -name .git \) \
                 -prune -o -type f -name '*.ln' -print `
 
         /bin/time $MAKE -ek lint 2>&1 | \
             tee -a $LINTOUT >> $LOGFILE
+
         echo "\n==== '$MAKE lint' of $base ERRORS ====\n" >> $mail_msg_file
+
         grep "$MAKE:" $LINTOUT |
-                egrep -v "Ignoring unknown host" \
-                >> $mail_msg_file
+                egrep -v "Ignoring unknown host" | \
+                tee $TMPDIR/lint_errs >> $mail_msg_file
+        if [[ -s $TMPDIR/lint_errs ]]; then
+                build_extras_ok=n
+        fi
 
         echo "\n==== Ended '$MAKE lint' of $base at `date` ====\n" >> $LOGFILE
 
         echo "\n==== Elapsed time of '$MAKE lint' of $base ====\n" \
                 >>$mail_msg_file

@@ -418,17 +432,21 @@
                 egrep -v '\.c:$' | \
                 sort | uniq > ${LINTNOISE}.out
         if [ ! -f ${LINTNOISE}.ref ]; then
                 cp ${LINTNOISE}.out ${LINTNOISE}.ref
         fi
+
         if [ "$dodiff" != "n" ]; then
                 echo "\n==== lint warnings $base ====\n" \
                         >>$mail_msg_file
                 # should be none, though there are a few that were filtered out
                 # above
                 egrep -i '(warning|lint):' ${LINTNOISE}.out \
-                        | sort | uniq >> $mail_msg_file
+                        | sort | uniq | tee $TMPDIR/lint_warns >> $mail_msg_file
+                if [[ -s $TMPDIR/lint_warns ]]; then
+                        build_extras_ok=n
+                fi
                 echo "\n==== lint noise differences $base ====\n" \
                         >> $mail_msg_file
                 diff ${LINTNOISE}.ref ${LINTNOISE}.out \
                         >> $mail_msg_file
         fi

@@ -457,12 +475,16 @@
         echo "\n==== Tools build errors ====\n" >> $mail_msg_file
 
         egrep ":" ${TOOLS}/${INSTALLOG}.out |
                 egrep -e "(${MAKE}:|[   ]error[:        \n])" | \
                 egrep -v "Ignoring unknown host" | \
-                egrep -v warning >> $mail_msg_file
-        return $?
+                egrep -v warning | tee $TMPDIR/tools_errors >> $mail_msg_file
+
+        if [[ -s $TMPDIR/tools_errors ]]; then
+                return 1
+        fi
+        return 0
 }
 
 #
 # Set up to use locally installed tools.
 #

@@ -668,10 +690,11 @@
 u_FLAG=n
 V_FLAG=n
 w_FLAG=n
 #
 build_ok=y
+build_extras_ok=y
 
 #
 # examine arguments
 #
 

@@ -1148,10 +1171,15 @@
                         ;;
                 *)
                         state=Failed
                         ;;
         esac
+
+        if [[ $state != "Interrupted" && $build_extras_ok != "y" ]]; then
+                state=Failed
+        fi
+
         NIGHTLY_STATUS=$state
         export NIGHTLY_STATUS
 
         run_hook POST_NIGHTLY $state
         run_hook SYS_POST_NIGHTLY $state

@@ -1493,12 +1521,16 @@
                 -o -name '.make.*' -print | xargs rm -f
 
         $MAKE -ek clobber 2>&1 | tee -a $SRC/clobber-${MACH}.out >> $LOGFILE
         echo "\n==== Make clobber ERRORS ====\n" >> $mail_msg_file
         grep "$MAKE:" $SRC/clobber-${MACH}.out |
-                egrep -v "Ignoring unknown host" \
-                >> $mail_msg_file
+                egrep -v "Ignoring unknown host" | \
+                tee $TMPDIR/clobber_errs >> $mail_msg_file
+
+        if [[ -s $TMPDIR/clobber_errs ]]; then
+                build_extras_ok=n
+        fi
 
         if [[ "$t_FLAG" = "y" ]]; then
                 echo "\n==== Make tools clobber at `date` ====\n" >> $LOGFILE
                 cd ${TOOLS}
                 rm -f ${TOOLS}/clobber-${MACH}.out

@@ -1506,10 +1538,13 @@
                         tee -a ${TOOLS}/clobber-${MACH}.out >> $LOGFILE
                 echo "\n==== Make tools clobber ERRORS ====\n" \
                         >> $mail_msg_file
                 grep "$MAKE:" ${TOOLS}/clobber-${MACH}.out \
                         >> $mail_msg_file
+                if (( $? == 0 )); then
+                        build_extras_ok=n
+                fi
                 rm -rf ${TOOLS_PROTO}
                 mkdir -p ${TOOLS_PROTO}
         fi
 
         typeset roots=$(allprotos)

@@ -1776,11 +1811,13 @@
 #
 if [[ "$t_FLAG" = "y" ]]; then
         set_non_debug_build_flags
 
         build_tools ${TOOLS_PROTO}
-        if [[ $? != 0  && "$t_FLAG" = y ]]; then
+        if (( $? != 0 )); then
+                build_ok=n
+        else
                 use_tools $TOOLS_PROTO
         fi
 fi
 
 # timestamp the start of the normal build; the findunref tool uses it.

@@ -1834,13 +1871,15 @@
         fi
 
         if [ "$N_FLAG" != "y" -a -d $SRC/pkg ]; then
                 echo "\n==== Validating manifests against proto area ====\n" \
                     >> $mail_msg_file
-                ( cd $SRC/pkg ; $MAKE -e protocmp ROOT="$checkroot" ) \
-                    >> $mail_msg_file
-
+                ( cd $SRC/pkg ; $MAKE -e protocmp ROOT="$checkroot" ) | \
+                    tee $TMPDIR/protocmp_noise >> $mail_msg_file
+                if [[ -s $TMPDIR/protocmp_noise ]]; then
+                        build_extras_ok=n
+                fi
         fi
 
         if [ "$N_FLAG" != "y" -a -f "$REF_PROTO_LIST" ]; then
                 echo "\n==== Impact on proto area ====\n" >> $mail_msg_file
                 if [ -n "$E2" ]; then

@@ -1857,11 +1896,12 @@
                         $ATLOG/proto_list_${MACH} \
                         >> $mail_msg_file
         fi
 fi
 
-if [ "$u_FLAG" = "y"  -a "$build_ok" = "y" ]; then
+if [[ "$u_FLAG" == "y" && "$build_ok" == "y" && \
+    "$build_extras_ok" == "y" ]]; then
         staffer cp $ATLOG/proto_list_${MACH} \
                 $PARENT_WS/usr/src/proto_list_${MACH}
 fi
 
 # Update parent proto area if necessary. This is done now

@@ -1902,11 +1942,11 @@
 fi
 
 #
 # ELF verification: ABI (-A) and runtime (-r) checks
 #
-if [[ ($build_ok = y) && ( ($A_FLAG = y) || ($r_FLAG = y) ) ]]; then
+if [[ ($build_ok = y) && (($A_FLAG = y) || ($r_FLAG = y)) ]]; then
         # Directory ELF-data.$MACH holds the files produced by these tests.
         elf_ddir=$SRC/ELF-data.$MACH
 
         # If there is a previous ELF-data backup directory, remove it. Then,
         # rotate current ELF-data directory into its place and create a new

@@ -1930,10 +1970,11 @@
                 interface_check -o -w $elf_ddir -f object_list \
                         -i interface -E interface.err
                 if [[ -s $elf_ddir/interface.err ]]; then
                         tee -a $LOGFILE < $elf_ddir/interface.err \
                                 >> $mail_msg_file
+                        build_extras_ok=n
                 fi
 
                 # If ELF_DATA_BASELINE_DIR is defined, compare the new interface
                 # description file to that from the baseline gate. Issue a
                 # warning if the baseline is not present, and keep going.

@@ -1951,10 +1992,11 @@
                                 if [[ -s $elf_ddir/interface.cmp ]]; then
                                         echo | tee -a $LOGFILE >> $mail_msg_file
                                         tee -a $LOGFILE < \
                                             $elf_ddir/interface.cmp \
                                             >> $mail_msg_file
+                                        build_extras_ok=n
                                 fi
                         else
                                 echo "baseline not available. comparison" \
                                     "skipped" | \
                                     tee -a $LOGFILE >> $mail_msg_file

@@ -1975,20 +2017,24 @@
                         rtime_sflag="-s"
                 fi
                 check_rtime -i -m -v $rtime_sflag -o -w $elf_ddir \
                         -D object_list  -f object_list -E runtime.err \
                         -I runtime.attr.raw
+                if (( $? != 0 )); then
+                        build_extras_ok=n
+                fi
 
                 # check_rtime -I output needs to be sorted in order to 
                 # compare it to that from previous builds.
                 sort $elf_ddir/runtime.attr.raw > $elf_ddir/runtime.attr
                 rm $elf_ddir/runtime.attr.raw
 
                 # Report errors
                 if [[ -s $elf_ddir/runtime.err ]]; then
                         tee -a $LOGFILE < $elf_ddir/runtime.err \
                                 >> $mail_msg_file
+                        build_extras_ok=n
                 fi
 
                 # If there is an ELF-data directory from a previous build,
                 # then diff the attr files. These files contain information
                 # about dependencies, versioning, and runpaths. There is some

@@ -2058,11 +2104,15 @@
             >> $LOGFILE
         echo "\n==== cstyle/hdrchk errors ====\n" >> $mail_msg_file
 
         grep ":" $SRC/check-${MACH}.out |
                 egrep -v "Ignoring unknown host" | \
-                sort | uniq >> $mail_msg_file
+                sort | uniq | tee $TMPDIR/check_errors >> $mail_msg_file
+
+        if [[ -s $TMPDIR/check_errors ]]; then
+                build_extras_ok=n
+        fi
 else
         echo "\n==== No '$MAKE check' ====\n" >> $LOGFILE
 fi
 
 echo "\n==== Find core files ====\n" | \

@@ -2097,11 +2147,15 @@
 if [ "$CHECK_PATHS" = y -a "$N_FLAG" != y ]; then
         echo "\n==== Check lists of files ====\n" | tee -a $LOGFILE \
                 >>$mail_msg_file
         arg=-b
         [ "$build_ok" = y ] && arg=
-        checkpaths $arg $checkroot 2>&1 | tee -a $LOGFILE >>$mail_msg_file
+        checkpaths $arg $checkroot > $SRC/checkpaths.out 2>&1
+        if [[ -s $SRC/checkpaths.out ]]; then
+                tee -a $LOGFILE < $SRC/checkpaths.out >> $mail_msg_file
+                build_extras_ok=n
+        fi
 fi
 
 if [ "$M_FLAG" != "y" -a "$build_ok" = y ]; then
         echo "\n==== Impact on file permissions ====\n" \
                 >> $mail_msg_file

@@ -2180,9 +2234,9 @@
 #
 # All done save for the sweeping up.
 # (whichever exit we hit here will trigger the "cleanup" trap which
 # optionally sends mail on completion).
 #
-if [ "$build_ok" = "y" ]; then
+if [[ "$build_ok" == "y" && "$build_extras_ok" == "y" ]]; then
         exit 0
 fi
 exit 1