use self basename; sort numerically to get minimal determinism

This commit is contained in:
George Danchev 2011-06-27 19:23:14 +00:00
parent e0a754ff85
commit 7d4aac4a84
1 changed files with 36 additions and 38 deletions

View File

@ -5,10 +5,6 @@ set -e
SELF=$(basename "$0") SELF=$(basename "$0")
CLOG1=log.$SELF.1 CLOG1=log.$SELF.1
CLOG2=log.$SELF.2 CLOG2=log.$SELF.2
> ${CLOG1}
> ${CLOG2}
PASSED_OPTIONS="" PASSED_OPTIONS=""
if [ "${1}" == "-cleanup" ]; then if [ "${1}" == "-cleanup" ]; then
@ -19,48 +15,50 @@ elif [ "${1}" == "-rc" ]; then
PASSED_OPTIONS="-rc" PASSED_OPTIONS="-rc"
else else
cat << HLP cat << HLP
$0: $0 -rc [-keep] ${SELF} -rc [-keep]
$0: $0 -cleanup ${SELF} -cleanup
HLP HLP
exit 0 exit 101
fi fi
main() { main() {
# #
DSTART=`date --utc` > ${CLOG1}
printf "\n$0: Started at ${DSTART}" > ${CLOG2}
E1=`date '+%s'` DSTART=`date --utc`
# require ^releng_, avoid running (your)self explcitly printf "\n${SELF}: Started at ${DSTART}"
for s in `ls | grep ^releng_ | grep -v ${SELF} | sort`; do E1=`date '+%s'`
if [ -x ${s} -a ! -d ${s} ]; then # require ^releng_, avoid running (your)self explcitly
printf "\n$0: Running ./${s} ${PASSED_OPTIONS}..." for s in `ls | grep ^releng_ | grep -v ${SELF} | sort -n`; do
T1=`date '+%s'` if [ -x ${s} -a ! -d ${s} ]; then
set +e printf "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..."
./${s} ${PASSED_OPTIONS} 1>>${CLOG1} 2>>${CLOG2} T1=`date '+%s'`
RET=$? set +e
T2=`date '+%s'` ./${s} ${PASSED_OPTIONS} 1>>${CLOG1} 2>>${CLOG2}
let TS="${T2}-${T1}" RET=$?
case ${RET} in T2=`date '+%s'`
0) let TS="${T2}-${T1}"
printf "done in ${TS} sec. ok." case ${RET} in
;; 0)
*) printf "done in ${TS} sec. ok."
printf "done in ${TS} sec. FAIL. EXIT CODE: $RET;" ;;
;; *)
esac printf "done in ${TS} sec. FAIL. EXIT CODE: $RET;"
set -e ;;
fi esac
done set -e
fi
done
DEND=`date --utc` DEND=`date --utc`
printf "\n$0: Finished at ${DEND}.\n" printf "\n${SELF}: Stopped at ${DEND}.\n"
E2=`date '+%s'` E2=`date '+%s'`
let ES="${E2}-${E1}" let ES="${E2}-${E1}"
printf "\n$0: Total time elapsed ${ES} sec." printf "\n${SELF}: Total time elapsed ${ES} sec."
printf "\n$0: Results saved in ${CLOG1} and ${CLOG2}.\n\n" printf "\n${SELF}: Results saved in ${CLOG1} and ${CLOG2}.\n\n"
# #
exit 0 exit 0
} }
# #