2011-06-26 14:06:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2011-06-27 15:51:13 +00:00
|
|
|
SELF=$(basename "$0")
|
2011-06-28 15:17:28 +00:00
|
|
|
GEN_DATA_DIR=releng_generated_data
|
2011-07-02 17:55:04 +00:00
|
|
|
CLOG=${GEN_DATA_DIR}/log.${SELF}
|
|
|
|
|
2011-06-27 15:36:56 +00:00
|
|
|
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_*.
|
2011-07-02 17:55:04 +00:00
|
|
|
stdout/stderr output stored in ${CLOG}
|
2011-06-28 15:17:28 +00:00
|
|
|
|
2011-06-27 19:23:14 +00:00
|
|
|
${SELF} -rc [-keep]
|
|
|
|
${SELF} -cleanup
|
2011-06-28 15:17:28 +00:00
|
|
|
|
2011-06-27 15:36:56 +00:00
|
|
|
HLP
|
2011-06-27 19:23:14 +00:00
|
|
|
exit 101
|
2011-06-27 15:36:56 +00:00
|
|
|
fi
|
|
|
|
|
2011-06-28 17:55:09 +00:00
|
|
|
########################################################
|
2011-07-02 17:55:04 +00:00
|
|
|
> ${CLOG}
|
2011-06-27 19:23:14 +00:00
|
|
|
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
|
2011-07-02 17:55:04 +00:00
|
|
|
# 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}
|
2011-06-27 19:23:14 +00:00
|
|
|
T1=`date '+%s'`
|
|
|
|
set +e
|
2011-07-02 17:55:04 +00:00
|
|
|
./${s} ${PASSED_OPTIONS} &>> ${CLOG}
|
2011-06-27 19:23:14 +00:00
|
|
|
RET=$?
|
|
|
|
T2=`date '+%s'`
|
2011-06-28 17:55:09 +00:00
|
|
|
let TS="${T2} - ${T1}"
|
2011-06-27 19:23:14 +00:00
|
|
|
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
|
|
|
|
2011-06-27 19:23:14 +00:00
|
|
|
DEND=`date --utc`
|
|
|
|
printf "\n${SELF}: Stopped at ${DEND}.\n"
|
2011-06-28 17:55:09 +00:00
|
|
|
|
|
|
|
if [ "${1}" == "-cleanup" ]; then
|
2011-07-02 17:55:04 +00:00
|
|
|
rm -f "${CLOG}"
|
2011-06-28 17:55:09 +00:00
|
|
|
else
|
|
|
|
E2=`date '+%s'`
|
|
|
|
let ES="${E2} - ${E1}"
|
|
|
|
printf "\n${SELF}: Total time elapsed ${ES} sec."
|
2011-07-02 17:55:04 +00:00
|
|
|
printf "\n${SELF}: stdout&stderr saved in ${CLOG}.\n"
|
2011-06-28 17:55:09 +00:00
|
|
|
fi
|
2011-06-26 15:16:10 +00:00
|
|
|
|
2011-06-27 19:23:14 +00:00
|
|
|
exit 0
|