1 #!/bin/sh
2 #
3 #
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
8 #
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
12 #
13
14 #
15 # Copyright (c) 2013 by Delphix. All rights reserved.
16 # Copyright 2013 Nexenta Systems, Inc. All rights reserved.
17 #
18
19 # This is a POST_NIGHTLY hook script to check the mail_msg file.
20 #
21 # Checks the given mail_msg file ($1) section starting $2 and ending $3
22 # If that section exists is non-empty, set the abort flag.
23 #
24 function check
25 {
26 typeset mail_msg start end
27
28 mail_msg="$1"
29 start="==== $(echo "$2" | sed "s@/@\\\\/@") ===="
30 end="==== $(echo "$3" | sed "s@/@\\\\/@") ===="
31
32 if [[ ! -z "$(sed -n "/^$start\$/,/^$end\$/p" $mail_msg |\
33 sed -e "/^$start\$/d" -e "/^$end\$/d" -e "/^$/d")" ]]; then
34 echo "Noise in section: $2"
35 touch $TMPDIR/abort
36 fi
37 }
38
39 #
40 # Leave a copy of the mail_msg file in the top of the WS where it's
41 # easier for build automation to find it. The Jenkins script may
42 # "cat $workspace/mail_msg.txt" after nightly runs so that it's
43 # "console" output shows any build noise, etc.
44 #
45 cd ${CODEMGR_WS}
46 cp ${LLOG}/mail_msg mail_msg.txt
47
48 # Check sections that should be empty:
49
50 check mail_msg.txt "Build errors" "Build warnings"
51 check mail_msg.txt "Build errors (DEBUG)" "Build warnings (DEBUG)"
52 check mail_msg.txt "Build errors (non-DEBUG)" "Build warnings (non-DEBUG)"
53
54 # nza-kernel has warnings. Fix those, then uncomment these...
55 #check mail_msg.txt "Build warnings" "Elapsed build time"
56 #check mail_msg.txt "Build warnings (DEBUG)" "Elapsed build time (DEBUG)"
57 #check mail_msg.txt "Build warnings (non-DEBUG)" \
58 # "Elapsed build time (non-DEBUG)"
59
60 # nza-kernel has warnings. Fix those, then uncomment these too.
61 #check mail_msg.txt "Validating manifests against proto area" \
62 # "Check ELF runtime attributes"
63 #check mail_msg.txt "lint warnings src" "lint noise differences src"
64 #check mail_msg.txt "cstyle/hdrchk errors" "Find core files"
65
66 if [ -f $TMPDIR/abort ]; then
67 echo "\nmail_msg has noise. FAIL" >> mail_msg.txt
68 exit 1
69 fi
70
71 exit 0