legacy/libisoburn/trunk/releng/run_all_releng
2011-06-28 17:55:09 +00:00

72 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
set -e
SELF=$(basename "$0")
GEN_DATA_DIR=releng_generated_data
CLOG1=${GEN_DATA_DIR}/log.${SELF}.1
CLOG2=${GEN_DATA_DIR}/log.${SELF}.2
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
${SELF} runs executables from CWD starting with releng_*.
stdout/stderr output stored in ${GEN_DATA_DIR}/log.*
${SELF} -rc [-keep]
${SELF} -cleanup
HLP
exit 101
fi
########################################################
> ${CLOG1}
> ${CLOG2}
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
printf "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..."
T1=`date '+%s'`
set +e
./${s} ${PASSED_OPTIONS} 1>>${CLOG1} 2>>${CLOG2}
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
DEND=`date --utc`
printf "\n${SELF}: Stopped at ${DEND}.\n"
if [ "${1}" == "-cleanup" ]; then
rm -f "${CLOG1}" "${CLOG2}"
else
E2=`date '+%s'`
let ES="${E2} - ${E1}"
printf "\n${SELF}: Total time elapsed ${ES} sec."
printf "\n${SELF}: stdout saved in ${CLOG1}."
printf "\n${SELF}: stderr saved in ${CLOG2}.\n"
fi
exit 0