2011-06-26 14:06:38 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2011-07-08 14:18:54 +00:00
|
|
|
# It is not a good idea to include inc/releng_getopts.inc with the
|
|
|
|
# master script as it calls the subordinate scripts and they include
|
|
|
|
# this file too, and we want to avoid sharing variable with subshells
|
|
|
|
|
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-07-08 14:18:54 +00:00
|
|
|
PASSED_OPTIONS="$@"
|
|
|
|
CLEANUP_LOG=0
|
2011-07-02 17:55:04 +00:00
|
|
|
|
2011-07-08 14:18:54 +00:00
|
|
|
#############################################
|
|
|
|
while getopts “x:k:c:f:h” OPT
|
|
|
|
do
|
|
|
|
case $OPT in
|
|
|
|
c)
|
|
|
|
CLEANUP_LOG=1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2011-06-27 15:36:56 +00:00
|
|
|
|
2011-07-08 14:18:54 +00:00
|
|
|
if [ ! "${1}" ]; then
|
2011-06-27 15:36:56 +00:00
|
|
|
cat << HLP
|
2011-07-09 07:33:33 +00:00
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
${SELF} runs executables from CWD starting
|
|
|
|
with releng_*, passing them its own options.
|
|
|
|
stdout/stderr output stored in:
|
|
|
|
${CLOG}
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
self generated data are stored in ${GEN_DATA_DIR}.
|
|
|
|
required space for these data is about 300 megabytes.
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
examples:
|
|
|
|
# run xorriso and keep the self generated data
|
|
|
|
$ ./${SELF} -x path/to/xorriso [-k1]
|
2011-06-28 15:17:28 +00:00
|
|
|
|
2011-07-09 07:33:33 +00:00
|
|
|
# clean up self generated data from previous run
|
|
|
|
$ ./${SELF} -c1
|
|
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
2011-06-27 15:36:56 +00:00
|
|
|
HLP
|
2011-07-08 14:18:54 +00:00
|
|
|
exit 31
|
2011-06-27 15:36:56 +00:00
|
|
|
fi
|
|
|
|
|
2011-06-28 17:55:09 +00:00
|
|
|
########################################################
|
2011-07-04 14:58:53 +00:00
|
|
|
if [ -f "${CLOG}" ]; then
|
|
|
|
mv "${CLOG}" "${CLOG}".prev
|
|
|
|
fi
|
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'`
|
2011-07-06 07:02:55 +00:00
|
|
|
# require ^releng_, avoid running (your)self explicitly
|
2011-06-27 19:23:14 +00:00
|
|
|
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
|
2011-07-06 07:02:55 +00:00
|
|
|
printf "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..."
|
2011-07-09 09:13:06 +00:00
|
|
|
echo -e "\n" >> ${CLOG}
|
2011-07-09 09:18:01 +00:00
|
|
|
echo -e "_NEW_TEST_______________________________________________________________" >> ${CLOG}
|
2011-07-09 09:13:06 +00:00
|
|
|
echo -e "${SELF}: Running ./${s} ${PASSED_OPTIONS}..." >> ${CLOG}
|
2011-07-09 09:18:01 +00:00
|
|
|
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> ${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`
|
2011-07-05 05:45:48 +00:00
|
|
|
printf "\n${SELF}: Stopped at ${DEND}."
|
2011-06-28 17:55:09 +00:00
|
|
|
|
2011-07-08 14:18:54 +00:00
|
|
|
if [ "${CLEANUP_LOG}" -eq 1 ]; then
|
|
|
|
if [ -f "${CLOG}" ]; then
|
|
|
|
printf "\n${SELF}: Removed my own log ${CLOG}."
|
|
|
|
rm -f "${CLOG}"
|
|
|
|
fi
|
|
|
|
if [ -f "${CLOG}".prev ]; then
|
|
|
|
printf "\n${SELF}: Removed my own log ${CLOG}.prev."
|
|
|
|
rm -f "${CLOG}".prev
|
|
|
|
fi
|
2011-06-28 17:55:09 +00:00
|
|
|
else
|
2011-07-04 16:05:24 +00:00
|
|
|
E2=`date '+%s'`
|
2011-07-09 07:33:33 +00:00
|
|
|
if [ ${E2} -eq ${E1} ]; then
|
|
|
|
printf " Total elapsed 0 sec."
|
|
|
|
else
|
|
|
|
let ES="${E2} - ${E1}"
|
|
|
|
printf " Total elapsed ${ES} sec."
|
|
|
|
fi
|
2011-07-04 16:05:24 +00:00
|
|
|
#####
|
|
|
|
printf "\n${SELF}: Std(out|err) logged in ${CLOG}."
|
2011-07-05 05:45:48 +00:00
|
|
|
printf "\n${SELF}: Trivial log file examination:"
|
2011-07-04 16:33:10 +00:00
|
|
|
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:
|
2011-07-05 12:07:32 +00:00
|
|
|
# thrown by xorriso and underlying libraries
|
|
|
|
LIST_KWD="(NEVER|ABORT|FATAL|FAILURE|MISHAP|SORRY|WARNING|HINT|NOTE|DEBUG|ALL"
|
|
|
|
# thrown by others
|
2011-07-07 14:28:32 +00:00
|
|
|
LIST_KWD+="|FAIL|ERROR|WRONG)"
|
2011-07-04 16:05:24 +00:00
|
|
|
|
|
|
|
if [ -f "${CLOG}" ]; then
|
2011-07-04 17:16:47 +00:00
|
|
|
set +e
|
|
|
|
# lines, perl regex, leading tabs
|
2011-07-04 16:05:24 +00:00
|
|
|
grep -n -PT "${LIST_KWD}" "${CLOG}"
|
2011-07-04 17:16:47 +00:00
|
|
|
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
|
2011-07-05 05:45:48 +00:00
|
|
|
printf "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
|
|
|
|
|
|
|
|
##### TODO: work out a less noisy diff'ing technique!
|
|
|
|
if [ -f "${CLOG}".prev -a -f "${CLOG}" ]; then
|
|
|
|
printf "${SELF}: See diff against previous log file (might be long):\n"
|
|
|
|
printf "diff -Naur ${CLOG}.prev ${CLOG} | less"
|
|
|
|
fi
|
2011-06-28 17:55:09 +00:00
|
|
|
fi
|
2011-07-09 07:33:33 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
printf "\n${SELF}: Leaving the following cruft in ${GEN_DATA_DIR}:\n"
|
|
|
|
ls -lth "${GEN_DATA_DIR}"
|
2011-06-26 15:16:10 +00:00
|
|
|
|
2011-07-08 14:18:54 +00:00
|
|
|
# Fin
|
2011-06-27 19:23:14 +00:00
|
|
|
exit 0
|