legacy/libisoburn/trunk/releng/run_all_releng

110 lines
2.9 KiB
Plaintext
Raw Normal View History

2011-06-26 14:06:38 +00:00
#!/bin/bash
set -e
SELF=$(basename "$0")
2011-06-28 15:17:28 +00:00
GEN_DATA_DIR=releng_generated_data
CLOG=${GEN_DATA_DIR}/log.${SELF}
PASSED_OPTIONS=""
if [ "${1}" == "-cleanup" ]; then
PASSED_OPTIONS="-cleanup"
elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
PASSED_OPTIONS="-rc -keep"
elif [ "${1}" == "-rc" ]; then
PASSED_OPTIONS="-rc"
else
cat << HLP
2011-06-28 15:17:28 +00:00
2011-06-28 17:34:53 +00:00
${SELF} runs executables from CWD starting with releng_*.
stdout/stderr output stored in ${CLOG}
2011-06-28 15:17:28 +00:00
${SELF} -rc [-keep]
${SELF} -cleanup
2011-06-28 15:17:28 +00:00
HLP
exit 101
fi
########################################################
2011-07-04 14:58:53 +00:00
if [ -f "${CLOG}" ]; then
mv "${CLOG}" "${CLOG}".prev
fi
> ${CLOG}
DSTART=`date --utc`
printf "\n${SELF}: Started at ${DSTART}"
E1=`date '+%s'`
# require ^releng_, avoid running (your)self explcitly
for s in `ls | grep ^releng_ | grep -v ${SELF} | sort -n`; do
if [ -x ${s} -a ! -d ${s} ]; then
# tee(1) does trailing \n, which is unwanted in that case
printf "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..."
echo -e "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..." >> ${CLOG}
T1=`date '+%s'`
set +e
./${s} ${PASSED_OPTIONS} &>> ${CLOG}
RET=$?
T2=`date '+%s'`
let TS="${T2} - ${T1}"
case ${RET} in
0)
printf "done in ${TS} sec. ok."
;;
*)
printf "done in ${TS} sec. FAIL. EXIT CODE: $RET;"
;;
esac
set -e
fi
done
2011-06-26 15:16:10 +00:00
DEND=`date --utc`
printf "\n${SELF}: Stopped at ${DEND}.\n"
if [ "${1}" == "-cleanup" ]; then
2011-07-04 16:07:04 +00:00
if [ -f "${CLOG}" ]; then rm -f "${CLOG}"; fi
if [ -f "${CLOG}".prev ]; then rm -f "${CLOG}".prev; fi
else
2011-07-04 16:05:24 +00:00
E2=`date '+%s'`
let ES="${E2} - ${E1}"
printf "\n${SELF}: Total time elapsed ${ES} sec."
2011-07-04 14:58:53 +00:00
2011-07-04 16:05:24 +00:00
##### TODO: work out a less noisy diff'ing technique!
#if [ -f "${CLOG}".prev -a -f "${CLOG}" ]; then
# printf "\n${SELF}: Log diff follows:\n"
# diff -Naur "${CLOG}".prev "${CLOG}"
#fi
#####
printf "\n${SELF}: Std(out|err) logged in ${CLOG}."
2011-07-04 16:33:10 +00:00
printf "\n${SELF}: Current log file examination begins:"
printf "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
2011-07-04 16:05:24 +00:00
# severity classes of libdax_msgs.h in libburn and libisofs
# List of boring keywords:
# 'UPDATE' A pacifier message during long running operations.
# List of interesting keywords:
LIST_KWD="(NEVER|ABORT|FATAL|FAILURE|MISHAP|SORRY|WARNING|HINT|NOTE|DEBUG|ALL)"
if [ -f "${CLOG}" ]; then
set +e
# lines, perl regex, leading tabs
2011-07-04 16:05:24 +00:00
grep -n -PT "${LIST_KWD}" "${CLOG}"
RET_GREP="$?"
case ${RET_GREP} in
0) # found
;;
1) # not found
printf "\n${SELF}: Log file looks clear.\n"
;;
*) #
printf "\n${SELF}: grep returned EXIT CODE: ${RET_GREP}.\n"
;;
esac
set -e
2011-07-04 16:05:24 +00:00
fi
printf "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
fi
2011-06-26 15:16:10 +00:00
exit 0