more unified output for the term and log

This commit is contained in:
George Danchev 2011-07-10 06:48:56 +00:00
parent 17ce586ff1
commit 2f224bae4a

View File

@ -57,21 +57,18 @@ fi
> ${CLOG} > ${CLOG}
if [ -x "${RELENG_XORRISO}" ]; then if [ -x "${RELENG_XORRISO}" ]; then
echo -e "_OVERVIEW_______________________________________________________________" >> ${CLOG} echo -e "_OVERVIEW_______________________________________________________________" >> ${CLOG}
date --utc >> ${CLOG}
${RELENG_XORRISO} --version >> ${CLOG} ${RELENG_XORRISO} --version >> ${CLOG}
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> ${CLOG} echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> ${CLOG}
fi fi
DSTART=`date --utc` DSTART=`date --utc`
printf "\n${SELF}: Started at ${DSTART}" echo -ne "${SELF}: Started at ${DSTART}" | tee -a ${CLOG}
E1=`date '+%s'` E1=`date '+%s'`
# require ^releng_, avoid running (your)self explicitly # require ^releng_, avoid running (your)self explicitly
for s in `ls | grep ^releng_ | grep -v ${SELF} | sort -n`; do for s in `ls | grep ^releng_ | grep -v ${SELF} | sort -n`; do
if [ -x ${s} -a ! -d ${s} ]; then if [ -x ${s} -a ! -d ${s} ]; then
# tee(1) does trailing \n, which is unwanted in that case echo -ne "\n\n_STARTING_TEST_________________________________________________________" >> ${CLOG}
printf "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..." echo -ne "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..." | tee -a ${CLOG}
echo -e "\n" >> ${CLOG}
echo -e "_NEW_TEST_______________________________________________________________" >> ${CLOG}
echo -e "${SELF}: Running ./${s} ${PASSED_OPTIONS}..." >> ${CLOG}
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> ${CLOG}
T1=`date '+%s'` T1=`date '+%s'`
set +e set +e
./${s} ${PASSED_OPTIONS} &>> ${CLOG} ./${s} ${PASSED_OPTIONS} &>> ${CLOG}
@ -94,28 +91,28 @@ fi
done done
DEND=`date --utc` DEND=`date --utc`
printf "\n${SELF}: Stopped at ${DEND}." echo -ne "\n${SELF}: Stopped at ${DEND}." | tee -a ${CLOG}
if [ "${CLEANUP_LOG}" -eq 1 ]; then if [ "${CLEANUP_LOG}" -eq 1 ]; then
if [ -f "${CLOG}" ]; then if [ -f "${CLOG}" ]; then
printf "\n${SELF}: Removed my own log ${CLOG}."
rm -f "${CLOG}" rm -f "${CLOG}"
echo -e "\n${SELF}: Removed my own log ${CLOG}." | tee -a ${CLOG}
fi fi
if [ -f "${CLOG}".prev ]; then if [ -f "${CLOG}".prev ]; then
printf "\n${SELF}: Removed my own log ${CLOG}.prev." rm -f "${CLOG}".prev
rm -f "${CLOG}".prev echo -e "\n${SELF}: Removed my own log ${CLOG}.prev." | tee -a ${CLOG}
fi fi
else else
E2=`date '+%s'` E2=`date '+%s'`
if [ ${E2} -eq ${E1} ]; then if [ ${E2} -eq ${E1} ]; then
printf " Total elapsed 0 sec." echo -e " Total elapsed 0 sec." | tee -a ${CLOG}
else else
let ES="${E2} - ${E1}" let ES="${E2} - ${E1}"
printf " Total elapsed ${ES} sec." echo -e " Total elapsed ${ES} sec." | tee -a ${CLOG}
fi fi
##### #####
printf "\n${SELF}: Trivial log examination: ${CLOG}" echo -e "\n_SUMMARY________________________________________________________________" >> ${CLOG}
printf "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" echo -e "${SELF}: Trivial log examination: ${CLOG}" | tee -a ${CLOG}
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | tee -a ${CLOG}
# severity classes of libdax_msgs.h in libburn and libisofs # severity classes of libdax_msgs.h in libburn and libisofs
# List of boring keywords: # List of boring keywords:
# 'UPDATE' A pacifier message during long running operations. # 'UPDATE' A pacifier message during long running operations.
@ -128,35 +125,35 @@ fi
if [ -f "${CLOG}" ]; then if [ -f "${CLOG}" ]; then
set +e set +e
# lines, perl regex, leading tabs # lines, perl regex, leading tabs
grep -n -PT "${LIST_KWD}" "${CLOG}" grep -n -PT "${LIST_KWD}" "${CLOG}" | tee -a ${CLOG}
RET_GREP="$?" RET_GREP="$?"
case ${RET_GREP} in case ${RET_GREP} in
0) # found 0) # found
;; ;;
1) # not found 1) # not found
printf "\n${SELF}: Log file looks clear.\n" echo -e "\n${SELF}: Log file looks clear.\n" | tee -a ${CLOG}
;; ;;
*) # *) #
printf "\n${SELF}: grep returned EXIT CODE: ${RET_GREP}.\n" echo -e "\n${SELF}: grep returned EXIT CODE: ${RET_GREP}.\n" | tee -a ${CLOG}
;; ;;
esac esac
set -e set -e
fi fi
printf "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | tee -a ${CLOG}
##### TODO: work out a less noisy diff'ing technique! ##### TODO: work out a less noisy diff'ing technique!
if [ -f "${CLOG}".prev -a -f "${CLOG}" ]; then if [ -f "${CLOG}".prev -a -f "${CLOG}" ]; then
printf "${SELF}: See diff against previous log file (might be long):\n" echo -e "${SELF}: See diff against previous log file (might be long):" | tee -a ${CLOG}
printf "diff -Naur ${CLOG}.prev ${CLOG} | less" echo -e "diff -Naur ${CLOG}.prev ${CLOG} | less" | tee -a ${CLOG}
fi fi
fi fi
# #
which tput >/dev/null 2>&1 && tput smso which tput >/dev/null 2>&1 && tput smso
printf "\n${SELF}: Leaving the following cruft in ${GEN_DATA_DIR}:\n" echo -e "${SELF}: Leaving the following cruft in ${GEN_DATA_DIR}:" | tee -a ${CLOG}
which tput >/dev/null 2>&1 && tput rmso which tput >/dev/null 2>&1 && tput rmso
ls -lth "${GEN_DATA_DIR}" ls -lth "${GEN_DATA_DIR}" | tee -a ${CLOG}
# Fin # Fin
exit 0 exit 0