Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | #! /bin/sh |
michael@0 | 2 | |
michael@0 | 3 | ######################################################################## |
michael@0 | 4 | # |
michael@0 | 5 | # /u/sonmi/bin/nssqa - /u/svbld/bin/init/nss/nssqa |
michael@0 | 6 | # |
michael@0 | 7 | # this script is supposed to automatically run QA for NSS on all required |
michael@0 | 8 | # Unix and Windows (NT and 2000) platforms |
michael@0 | 9 | # |
michael@0 | 10 | # parameters |
michael@0 | 11 | # ---------- |
michael@0 | 12 | # nssversion (supported: 30b, 31, tip) |
michael@0 | 13 | # builddate (default - today) |
michael@0 | 14 | # |
michael@0 | 15 | # options |
michael@0 | 16 | # ------- |
michael@0 | 17 | # -y answer all questions with y - use at your own risk...ignores warnings |
michael@0 | 18 | # -s silent (only usefull with -y) |
michael@0 | 19 | # -h, -? - you guessed right - displays this text |
michael@0 | 20 | # -d debug |
michael@0 | 21 | # -f <filename> - write the (error)output to filename |
michael@0 | 22 | # -cron equivalient to -y -s -d -f $RESULTDIR/$HOST.nssqa |
michael@0 | 23 | # |
michael@0 | 24 | # 12/1/00 |
michael@0 | 25 | # took out the (unused) local directory for releasebuild QA on NT |
michael@0 | 26 | # cleaned up 32 - 64 bit issues |
michael@0 | 27 | # took hardcoded machinenames out |
michael@0 | 28 | ######################################################################## |
michael@0 | 29 | |
michael@0 | 30 | O_OPTIONS=ON # accept options (see above for listing) |
michael@0 | 31 | WIN_WAIT_FOREVER=ON # first we wait forever for a TESTDIR to appear, than |
michael@0 | 32 | # we wait forever for the build to finish... |
michael@0 | 33 | |
michael@0 | 34 | TBX_EXIT=50 # in case we are running on a tinderbox build, any |
michael@0 | 35 | # early exit needs to return an error |
michael@0 | 36 | . `dirname $0`/header # utilities, shellfunctions etc, global to NSS QA |
michael@0 | 37 | |
michael@0 | 38 | if [ -z "$O_TBX" -o "$O_TBX" != "ON" ] ; then |
michael@0 | 39 | is_running ${TMP}/nssqa |
michael@0 | 40 | # checks if the file exists, if yes Exits, if not |
michael@0 | 41 | # creates to implement a primitive locking mechanism |
michael@0 | 42 | fi |
michael@0 | 43 | |
michael@0 | 44 | KILL_SELFSERV=OFF # cleanup will also kill the leftover selfserv processes |
michael@0 | 45 | |
michael@0 | 46 | ################################ check_distdir ######################### |
michael@0 | 47 | # local shell function to check if the DIST directory exists, if not there |
michael@0 | 48 | # is no use to continue the test |
michael@0 | 49 | ######################################################################## |
michael@0 | 50 | check_distdir() |
michael@0 | 51 | { |
michael@0 | 52 | set_objdir |
michael@0 | 53 | |
michael@0 | 54 | if [ ! -d "$LOCALDIST_BIN" ] |
michael@0 | 55 | then |
michael@0 | 56 | Debug "Dist $DIST" |
michael@0 | 57 | Warning "$LOCALDIST_BIN (the dist binaries dir) does not exist" |
michael@0 | 58 | return 1 |
michael@0 | 59 | fi |
michael@0 | 60 | |
michael@0 | 61 | if [ ! -d "$LOCALDIST" -a ! -h "$LOCALDIST" ] |
michael@0 | 62 | then |
michael@0 | 63 | Debug "Dist $DIST" |
michael@0 | 64 | Warning "$LOCALDIST (the dist directory) does not exist" |
michael@0 | 65 | return 1 |
michael@0 | 66 | fi |
michael@0 | 67 | |
michael@0 | 68 | Debug "LOCALDIST_BIN $LOCALDIST_BIN" |
michael@0 | 69 | Debug "Dist $DIST" |
michael@0 | 70 | return 0 |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | ################################ run_all ############################### |
michael@0 | 74 | # local shell function to start the all.sh after asking user and redirect |
michael@0 | 75 | # the output apropriately |
michael@0 | 76 | ######################################################################## |
michael@0 | 77 | run_all() |
michael@0 | 78 | { |
michael@0 | 79 | check_distdir || return 1 |
michael@0 | 80 | #kill_by_name selfserv |
michael@0 | 81 | ask "Testing $OBJDIR continue with all.sh" "y" "n" || Exit |
michael@0 | 82 | |
michael@0 | 83 | Debug "running all.sh in `pwd`" |
michael@0 | 84 | if [ $O_SILENT = ON ] |
michael@0 | 85 | then |
michael@0 | 86 | if [ $O_DEBUG = ON -a $O_FILE = ON ] |
michael@0 | 87 | then |
michael@0 | 88 | all.sh >>$FILENAME 2>>$FILENAME |
michael@0 | 89 | else |
michael@0 | 90 | all.sh >/dev/null 2>/dev/null |
michael@0 | 91 | fi |
michael@0 | 92 | else |
michael@0 | 93 | all.sh |
michael@0 | 94 | fi |
michael@0 | 95 | Debug "Done with all.sh " |
michael@0 | 96 | line |
michael@0 | 97 | } |
michael@0 | 98 | |
michael@0 | 99 | all_sh() |
michael@0 | 100 | { |
michael@0 | 101 | echo |
michael@0 | 102 | } |
michael@0 | 103 | |
michael@0 | 104 | |
michael@0 | 105 | ########################### wait_for_build ############################# |
michael@0 | 106 | # local shell function to wait until the build is finished |
michael@0 | 107 | ######################################################################## |
michael@0 | 108 | wait_for_build() |
michael@0 | 109 | { |
michael@0 | 110 | if [ $O_WIN = "ON" ] |
michael@0 | 111 | then |
michael@0 | 112 | WaitForever ${OSDIR}/SVbuild.InProgress.1 0 |
michael@0 | 113 | #Wait for the build to finish Windows a lot longer |
michael@0 | 114 | OS_TARGET=WINNT;export OS_TARGET;Debug "OS_TARGET set to $OS_TARGET" |
michael@0 | 115 | QA_OS_NAME=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name | \ |
michael@0 | 116 | sed -e "s/WINNT4.0.*/Windows-NT-4.0/" -e "s/WINNT5.0.*/Windows-2000/"` |
michael@0 | 117 | Echo "WINDOWS-OS-LINE: $QA_OS_NAME" |
michael@0 | 118 | else |
michael@0 | 119 | Wait ${OSDIR}/SVbuild.InProgress.1 0 |
michael@0 | 120 | #Wait for the build to finish... Unix a few hours |
michael@0 | 121 | qa_stat_get_sysinfo |
michael@0 | 122 | Echo "UNIX-OS-LINE: $QA_OS" |
michael@0 | 123 | fi |
michael@0 | 124 | find_nt_masterbuild |
michael@0 | 125 | } |
michael@0 | 126 | |
michael@0 | 127 | |
michael@0 | 128 | ########################### map_os ############################# |
michael@0 | 129 | # local shell function: From the operatingsystem figure out the name of |
michael@0 | 130 | # the build ; needed to detemine if the build finished, passed and for |
michael@0 | 131 | # the directory names |
michael@0 | 132 | ######################################################################## |
michael@0 | 133 | map_os32() |
michael@0 | 134 | { |
michael@0 | 135 | case `uname -s` in |
michael@0 | 136 | SunOS) |
michael@0 | 137 | S_REL=`uname -r | sed -e "s/^[^\.]*\.//g"` |
michael@0 | 138 | if [ `uname -p` = "i386" ] ; then |
michael@0 | 139 | MAPPED_OS=Solaris8_x86 |
michael@0 | 140 | elif [ "$S_REL" -lt 8 ] ; then |
michael@0 | 141 | MAPPED_OS=Solaris2.6 |
michael@0 | 142 | else |
michael@0 | 143 | MAPPED_OS=Solaris8_forte6 |
michael@0 | 144 | fi |
michael@0 | 145 | ;; |
michael@0 | 146 | OSF1) |
michael@0 | 147 | MAPPED_OS=OSF1V4.0 |
michael@0 | 148 | ;; |
michael@0 | 149 | Darwin) |
michael@0 | 150 | MAPPED_OS=Darwin6.5 |
michael@0 | 151 | ;; |
michael@0 | 152 | AIX) |
michael@0 | 153 | MAPPED_OS=AIX4.3 |
michael@0 | 154 | ;; |
michael@0 | 155 | Linux) |
michael@0 | 156 | RH_MR=`cat /etc/redhat-release | sed \ |
michael@0 | 157 | -e "s/Red Hat Linux release //" -e "s/ .*//g" \ |
michael@0 | 158 | -e "s/\..*//g"` |
michael@0 | 159 | |
michael@0 | 160 | if [ "$RH_MR" = "6" ] ; then |
michael@0 | 161 | MAPPED_OS=Linux2.2 |
michael@0 | 162 | else |
michael@0 | 163 | MAPPED_OS=Linux2.4 |
michael@0 | 164 | LD_ASSUME_KERNEL="2.2.5" |
michael@0 | 165 | export LD_ASSUME_KERNEL |
michael@0 | 166 | fi |
michael@0 | 167 | ;; |
michael@0 | 168 | HP-UX) |
michael@0 | 169 | MAPPED_OS=HPUX11.00 |
michael@0 | 170 | ;; |
michael@0 | 171 | *) |
michael@0 | 172 | if [ "$os_name" = "Windows" ] |
michael@0 | 173 | then |
michael@0 | 174 | MAPPED_OS=NT4.0 |
michael@0 | 175 | else |
michael@0 | 176 | Exit "Sorry, operating system `uname -s` is not supported yet" |
michael@0 | 177 | fi |
michael@0 | 178 | ;; |
michael@0 | 179 | esac |
michael@0 | 180 | set_osdir |
michael@0 | 181 | Debug "Mapped OS to $MAPPED_OS" |
michael@0 | 182 | } |
michael@0 | 183 | |
michael@0 | 184 | ############################# nssqa_main ############################### |
michael@0 | 185 | # local shell function main controlling function of the nss qa |
michael@0 | 186 | ######################################################################## |
michael@0 | 187 | nssqa_main() |
michael@0 | 188 | { |
michael@0 | 189 | Debug "In function nssqa_main" |
michael@0 | 190 | |
michael@0 | 191 | if [ $O_WIN = "OFF" -a "$O_TBX" = "OFF" -a $O_LOCAL = "OFF" ] ; then |
michael@0 | 192 | if [ ! -h ${NTDIST}/WINNT5.0_DBG.OBJ -o \ |
michael@0 | 193 | ! -h ${UXDIST}/SunOS5.8_OPT.OBJ -o \ |
michael@0 | 194 | ! -h ${UXDIST}/OSF1V5.0_DBG.OBJ ] ; then |
michael@0 | 195 | # determine if all needed symbolic links are present, in case |
michael@0 | 196 | # we build on one platform and QA on another |
michael@0 | 197 | # create the symbolic links |
michael@0 | 198 | #mksymlinks $* || |
michael@0 | 199 | `dirname $0`/mksymlinks $NSSVER $BUILDDATE || |
michael@0 | 200 | Warning "Can't make the neccessary symbolic links" |
michael@0 | 201 | fi |
michael@0 | 202 | fi |
michael@0 | 203 | |
michael@0 | 204 | if [ -d $TESTSCRIPTDIR ] #the directory mozilla/security/nss/tests, |
michael@0 | 205 | then # where all.sh lives |
michael@0 | 206 | cd $TESTSCRIPTDIR |
michael@0 | 207 | else |
michael@0 | 208 | Exit "cant cd to $TESTSCRIPTDIR Exiting" |
michael@0 | 209 | fi |
michael@0 | 210 | |
michael@0 | 211 | Debug "Testing from `pwd`" |
michael@0 | 212 | line |
michael@0 | 213 | Debug "HOST: $HOST, DOMSUF: $DOMSUF" |
michael@0 | 214 | |
michael@0 | 215 | if [ "$O_TBX" = "OFF" ] ; then |
michael@0 | 216 | map_os32 # From the operatingsystem figure out the name of the build |
michael@0 | 217 | Debug Testing build for $MAPPED_OS in $OSDIR |
michael@0 | 218 | wait_for_build |
michael@0 | 219 | fi |
michael@0 | 220 | run_all |
michael@0 | 221 | BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT" |
michael@0 | 222 | run_all |
michael@0 | 223 | |
michael@0 | 224 | # now for the 64 bit build! |
michael@0 | 225 | map_os64 # From the operatingsystem figure out the name of the build |
michael@0 | 226 | if [ -n "$IS_64" ] ; then #Wait for the 64 bit build to finish... |
michael@0 | 227 | Debug "This is a $IS_64 platform" |
michael@0 | 228 | USE_64=1;export USE_64;Debug "Use_64 set to $USE_64" |
michael@0 | 229 | unset BUILD_OPT;export BUILD_OPT;Debug "BUILD_OPT $BUILD_OPT" |
michael@0 | 230 | |
michael@0 | 231 | run_all |
michael@0 | 232 | BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT" |
michael@0 | 233 | run_all |
michael@0 | 234 | elif [ "$O_WIN" = "ON" ] ; then |
michael@0 | 235 | OS_TARGET=WIN95;export OS_TARGET |
michael@0 | 236 | Debug "OS_TARGET set to $OS_TARGET" |
michael@0 | 237 | #Echo "WINDOWS-OS-LINE: $os_name $os_full $OS_TARGET" |
michael@0 | 238 | unset BUILD_OPT;export BUILD_OPT;Debug "BUILD_OPT $BUILD_OPT" |
michael@0 | 239 | #if [ "$TEST_LEVEL" = "0" ] ; then |
michael@0 | 240 | #QA_OS_NAME=`cd ${TESTSCRIPTDIR}/common; gmake objdir_name | \ |
michael@0 | 241 | #sed -e "s/WINNT4.0.*/Windows-NT-4.0/" -e \ |
michael@0 | 242 | #"s/WINNT5.0.*/Windows-2000/"` |
michael@0 | 243 | #Echo "WINDOWS-OS-LINE: $QA_OS_NAME $OS_TARGET" |
michael@0 | 244 | #fi |
michael@0 | 245 | run_all |
michael@0 | 246 | BUILD_OPT=1; export BUILD_OPT; Debug "BUILD_OPT $BUILD_OPT" |
michael@0 | 247 | run_all |
michael@0 | 248 | else |
michael@0 | 249 | Debug "This is a 32 bit platform" |
michael@0 | 250 | fi |
michael@0 | 251 | } |
michael@0 | 252 | |
michael@0 | 253 | TEST_LEVEL=0 |
michael@0 | 254 | |
michael@0 | 255 | while [ $TEST_LEVEL -lt 2 ] ; do |
michael@0 | 256 | export TEST_LEVEL |
michael@0 | 257 | unset BUILD_OPT;export BUILD_OPT;Debug "BUILD_OPT $BUILD_OPT" |
michael@0 | 258 | unset USE_64;export USE_64;Debug "USE_64 $USE_64" |
michael@0 | 259 | bc $TEST_LEVEL |
michael@0 | 260 | Debug "About to start nssqa_main" |
michael@0 | 261 | if [ $O_FILE = ON -a "$O_WIN" != "ON" ] ; then |
michael@0 | 262 | nssqa_main 2>>$FILENAME |
michael@0 | 263 | else |
michael@0 | 264 | nssqa_main |
michael@0 | 265 | fi |
michael@0 | 266 | if [ "$O_TBX" = "ON" ] ; then # do not do backward compatibility |
michael@0 | 267 | TEST_LEVEL=3 # testing on tinderbox |
michael@0 | 268 | else |
michael@0 | 269 | TEST_LEVEL=`expr $TEST_LEVEL + 1 ` |
michael@0 | 270 | fi |
michael@0 | 271 | done |
michael@0 | 272 | |
michael@0 | 273 | if [ "$O_TBX" = "ON" -o "$O_LOCAL" = "ON" ] ; then |
michael@0 | 274 | #FIXME - maybe it should be copied back to the networkdrive later (-ln) |
michael@0 | 275 | if [ -n "${TMPFILES}" ] ; then #caused problems on tinderbox machines |
michael@0 | 276 | Debug "rm -f ${TMPFILES}" |
michael@0 | 277 | rm -f $TMPFILES 2>/dev/null |
michael@0 | 278 | fi |
michael@0 | 279 | Debug "running qa_stat" |
michael@0 | 280 | . `dirname $0`/qa_stat |
michael@0 | 281 | fi |
michael@0 | 282 | |
michael@0 | 283 | |
michael@0 | 284 | qa_stat_get_sysinfo |
michael@0 | 285 | |
michael@0 | 286 | Exit "nssqa completed. Done `uname -n` $QA_OS_STRING" |