Code Block | ||
---|---|---|
| ||
#!/bin/bash print_time_diff() { end_time=$(date +%s) delta=$(($end_time - $1)) sec=$(($delta % 60)) let "amin = $delta / 60" let "hour = $amin / 60" min=$(($amin%60)) if [ -n "$2" ]; then printf " Running time: %02d:%02d:%02d\n" $hour $min $sec >> ${ULOG} else printf " Running time: %02d:%02d:%02d\n" $hour $min $sec fi } boot_zone() { echo Shutting down zone $1... sudo zoneadm -z $1 halt echo Cleaning zone $1 dataset... sudo zoneadm -z $1 uninstall -F sudo zfs destroy -fr rpool/zones/$1 echo Booting zone $1... sudo zoneadm -z $1 clone $1-orig && sudo zoneadm -z $1 boot ip="" while [ "${ip}" == "" ] || [ "${ip}" == "0.0.0.0" ] do ip=$(sudo zlogin -l root $1 ifconfig | grep -A 1 "${2}" | sed "/${2}/d; s/^[ \t]*inet[ \t]*//; s/[ \t]*netmask.*$//") done echo "Zone:$1 ------> $2:$ip" 2>&1 | /usr/bin/tee -a >> $3 } LLOG="/var/tmp/libc-stability.$(date +%F-%T).txt" echo "================== Stability libc tests $(date +%F-%T) ==================" > ${LLOG} ELOG="/var/tmp/elf-stability.$(date +%F-%T).txt" echo "================== Stability elf tests $(date +%F-%T) ==================" > ${ELOG} OLOG="/var/tmp/os-stability.$(date +%F-%T).txt" echo "================== Stability os tests $(date +%F-%T) ==================" > ${OLOG} ULOG="/var/tmp/util-stability.$(date +%F-%T).txt" echo "================== Stability util & mdb tests $(date +%F-%T) ==================" > ${ULOG} NLOG="/var/tmp/net-stability.$(date +%F-%T).txt" echo "================== Stability net tests \$(date +%F-%T) ==================" > ${NLOG} ipa=$(sudo ifconfig | grep -A 1 vmxnet3s0 | sed '1d; s/^[ \t]*inet[ \t]*//; s/[ \t]*netmask.*$//') GLOB_START_TIME=$(date +%s) for (( i=1; i<=$1; i++ )) do echo "------------------ Pass ${i} ---------------------" 2>&1 | /usr/bin/tee -a ${LLOG} LOG="/var/tmp/libc-test.$i.txt" uname -a > ${LOG} echo "IP Address : \${ipa}" >> ${LOG} /opt/libc-tests/bin/libctest 2>&1 | /usr/bin/tee -a ${LOG} percent="$(grep 'Percent passed:' ${LOG} | sed 's/Percent passed:[ \t]*//; s/[ \t]*$//')" folder="$(grep 'Log directory:' ${LOG} | sed 's/Log directory:[ \t]*//; s/[ \t]*$//')" rt="$(grep 'Running Time:' ${LOG} | sed 's/Running Time:[ \t]*//; s/[ \t]*$//')" echo " Percent passed: ${percent}" >> ${LLOG} echo " Running Time: ${rt}" >> ${LLOG} sed -n '/Results Summary/,/Log directory:/p' ${LOG} > a.tmp echo "---------------------------------------------------------" >> a.tmp echo "" >> a.tmp cat ${LOG} >> a.tmp mv -f a.tmp ${LOG} if [ "${percent}" == "100.0%" ]; then sudo rm -f ${LOG} sudo rm -r -f ${folder} else print_time_diff ${GLOB_START_TIME} echo " PASS ${i} IS FAILED! (See ${LOG})" >> ${LLOG} echo "Fault on ${i} pass! Just ${percent} are successfull. You can find logs in ${folder}." 2>&1 | /usr/bin/tee -a ${LOG} exit 1 fi echo "------------------ Pass ${i} ---------------------" 2>&1 | /usr/bin/tee -a ${ELOG} LOG="/var/tmp/elftest.$i.txt" uname -a > ${LOG} sudo /opt/elf-tests/bin/elftest 2>&1 | /usr/bin/tee -a ${LOG} percent="$(grep 'Percent passed:' ${LOG} | sed 's/Percent passed:[ \t]*//; s/[ \t]*$//')" folder="$(grep 'Log directory:' ${LOG} | sed 's/Log directory:[ \t]*//; s/[ \t]*$//')" rt="$(grep 'Running Time:' ${LOG} | sed 's/Running Time:[ \t]*//; s/[ \t]*$//')" echo " Percent passed: ${percent}" >> ${ELOG} echo " Running Time: ${rt}" >> ${ELOG} sed -n '/Results Summary/,/Log directory:/p' ${LOG} > a.tmp echo "---------------------------------------------------------" >> a.tmp echo "" >> a.tmp cat ${LOG} >> a.tmp mv -f a.tmp ${LOG} if [ "${percent}" == "100.0%" ]; then sudo rm -f ${LOG} sudo rm -f /var/tmp/*.o /var/tmp/*.c /var/tmp/*.le sudo rm -r -f ${folder} else print_time_diff ${GLOB_START_TIME} echo " PASS ${i} IS FAILED! (See ${LOG})" >> ${ELOG} echo "Fault on ${i} pass! Just ${percent} are successfull. You can find logs in ${folder}." 2>&1 | /usr/bin/tee -a ${LOG} exit 1 fi echo "------------------ Pass ${i} ---------------------" 2>&1 | /usr/bin/tee -a ${OLOG} LOG="/var/tmp/ostest-test.$i.txt" uname -a > ${LOG} echo "IP Address : \${ipa}" >> ${LOG} sudo /opt/os-tests/bin/ostest /var/tmp 2>&1 | /usr/bin/tee -a ${LOG} percent="$(grep 'Percent passed:' ${LOG} | sed 's/Percent passed:[ \t]*//; s/[ \t]*$//')" folder="$(grep 'Log directory:' ${LOG} | sed 's/Log directory:[ \t]*//; s/[ \t]*$//')" rt="$(grep 'Running Time:' ${LOG} | sed 's/Running Time:[ \t]*//; s/[ \t]*$//')" echo " Percent passed: ${percent}" >> ${OLOG} echo " Running Time: ${rt}" >> ${OLOG} sed -n '/Results Summary/,/Log directory:/p' ${LOG} > a.tmp echo "---------------------------------------------------------" >> a.tmp echo "" >> a.tmp cat ${LOG} >> a.tmp mv -f a.tmp ${LOG} if [ "${percent}" == "100.0%" ]; then sudo rm -f ${LOG} sudo rm -f /tmp/otst* sudo rm -r -f ${folder} else print_time_diff ${GLOB_START_TIME} echo " PASS ${i} IS FAILED! (See ${LOG})" >> ${OLOG} echo "Fault on ${i} pass! Just ${percent} are successfull. You can find logs in ${folder}." 2>&1 | /usr/bin/tee -a ${LOG} exit 1 fi echo "--------------------------------------- Pass ${i} ------------------------------------" 2>&1 | /usr/bin/tee -a ${ULOG} START_TIME=$(date +%s) LOG="/var/tmp/util-test.$i.txt" uname -a > ${LOG} echo "IP Address : \${ipa}" >> ${LOG} echo "---------------------------------------- UTILS --------------------------------------" 2>&1 | /usr/bin/tee -a ${LOG} /opt/util-tests/bin/utiltest 2>&1 | /usr/bin/tee -a ${LOG} percent="$(grep 'Percent passed:' ${LOG} | sed 's/Percent passed:[ \t]*//; s/[ \t]*$//')" echo " UTILS percent passed: ${percent}" >> ${ULOG} folder="$(grep 'Log directory:' ${LOG} | sed 's/Log directory:[ \t]*//; s/[ \t]*$//')" if [ "${percent}" != "100.0%" ]; then print_time_diff ${START_TIME} ${ULOG} print_time_diff ${GLOB_START_TIME} echo " PASS ${i} IS FAILED! (See ${LOG})" >> ${ULOG} echo "Fault on ${i} pass! Just ${percent} are successfull. You can find logs in ${folder}." 2>&1 | /usr/bin/tee -a ${LOG} exit 1 fi sudo rm -r -f ${folder} echo "---------------------------------------- MDB --------------------------------------" 2>&1 | /usr/bin/tee -a ${LOG} /opt/util-tests/bin/utiltest -c /opt/util-tests/runfiles/mdb.run 2>&1 | /usr/bin/tee -a ${LOG} percent="$(sed '/- UTILS -/,/- MDB -/d' ${LOG} | grep 'Percent passed:' | sed 's/Percent passed:[ \t]*//; s/[ \t]*$//')" echo " MDB percent passed: ${percent}" >> ${ULOG} folder="$(sed '/- UTILS -/,/- MDB -/d' ${LOG} | grep 'Log directory:' | sed 's/Log directory:[ \t]*//; s/[ \t]*$//')" print_time_diff ${START_TIME} ${ULOG} sed -n '/Results Summary/,/Log directory:/p' ${LOG} > a.tmp echo "---------------------------------------------------------" >> a.tmp echo "" >> a.tmp cat ${LOG} >> a.tmp mv -f a.tmp ${LOG} if [ "${percent}" == "100.0%" ]; then sudo rm -f ${LOG} sudo rm -r -f ${folder} else print_time_diff ${GLOB_START_TIME} echo " PASS ${i} IS FAILED! (See ${LOG})" >> ${ULOG} echo "Fault on ${i} pass! Just ${percent} are successfull. You can find logs in ${folder}." 2>&1 | /usr/bin/tee -a ${LOG} exit 1 fi echo "------------------ Pass ${i} ---------------------" 2>&1 | /usr/bin/tee -a ${NLOG} LOG="/var/tmp/net-test.$i.txt" uname -a > ${LOG} echo "IP Address : ${ipa}" >> ${LOG} echo "" >> ${LOG} echo ----------------------------- IP Address ---------------------- 2>&1 | /usr/bin/tee -a ${LOG} sudo ifconfig | grep -A 1 vmxnet3s0 2>&1 | /usr/bin/tee -a ${LOG} boot_zone cz int1 ${LOG} boot_zone sz int2 ${LOG} boot_zone rz int3 ${LOG} echo ------------------------------- Zones ------------------------- 2>&1 | /usr/bin/tee -a ${LOG} sudo zoneadm list -v 2>&1 | /usr/bin/tee -a ${LOG} echo ---------------------------- DHCP Server ---------------------- 2>&1 | /usr/bin/tee -a ${LOG} sudo svcs -z dhcp isc-dhcp-server 2>&1 | /usr/bin/tee -a ${LOG} echo ------------------------------- Tests ------------------------- 2>&1 | /usr/bin/tee -a ${LOG} sudo /opt/net-tests/bin/nettest /var/tmp 2>&1 | /usr/bin/tee -a /var/tmp/a.tmp percent="$(grep 'Percent passed:' /var/tmp/a.tmp | sed 's/Percent passed:[ \t]*//; s/[ \t]*$//')" folder="$(grep 'Log directory:' /var/tmp/a.tmp | sed 's/Log directory:[ \t]*//; s/[ \t]*$//')" rt="$(grep 'Running Time:' /var/tmp/a.tmp | sed 's/Running Time:[ \t]*//; s/[ \t]*$//')" echo " Percent passed: ${percent}" >> ${NLOG} echo " Running Time: ${rt}" >> ${NLOG} sed -n '/Results Summary/,/Log directory:/p' /var/tmp/a.tmp >> ${LOG} echo "" >> ${LOG} cat /var/tmp/a.tmp >> ${LOG} rm -f /var/tmp/a.tmp if [ "${percent}" == "100.0%" ]; then sudo rm -f ${LOG} sudo rm -r -f ${folder} else print_time_diff ${GLOB_START_TIME} echo " PASS ${i} IS FAILED! (See ${LOG})" >> ${NLOG} echo "Fault on ${i} pass! Just ${percent} are successfull. You can find logs in ${folder}." 2>&1 | /usr/bin/tee -a ${LOG} exit 1 fi done print_time_diff ${GLOB_START_TIME} |
Page Comparison
General
Content
Integrations