Merge "Don't log datestamp by default in functional tests"
This commit is contained in:
commit
c983294f8c
1 changed files with 25 additions and 4 deletions
|
@ -27,16 +27,26 @@ DEFAULT_SKIP_TESTS=(
|
||||||
|
|
||||||
function log_with_prefix {
|
function log_with_prefix {
|
||||||
local pr=$1
|
local pr=$1
|
||||||
|
local log
|
||||||
|
|
||||||
while read a; do
|
while read a; do
|
||||||
echo $(date +"%Y%m%d-%H%M%S.%N") "[$pr] $a"
|
log="[$pr] $a"
|
||||||
|
if [[ ${LOG_DATESTAMP} -ne 0 ]]; then
|
||||||
|
log="$(date +"%Y%m%d-%H%M%S.%N") ${log}"
|
||||||
|
fi
|
||||||
|
echo "${log}"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Log job control messages
|
# Log job control messages
|
||||||
function log_jc {
|
function log_jc {
|
||||||
local msg="$1"
|
local msg="$1"
|
||||||
printf "[JOB-CONTROL] %s %s\n" "$(date)" "${msg}"
|
local log="[JOB-CONTROL] ${msg}"
|
||||||
|
|
||||||
|
if [[ ${LOG_DATESTAMP} -ne 0 ]]; then
|
||||||
|
log="$(date +"%Y%m%d-%H%M%S.%N") ${log}"
|
||||||
|
fi
|
||||||
|
echo "${log}"
|
||||||
}
|
}
|
||||||
|
|
||||||
function job_cnt {
|
function job_cnt {
|
||||||
|
@ -156,15 +166,23 @@ for e in $DIB_ELEMENTS/*/test-elements/*; do
|
||||||
TESTS+=("$element/$test_element")
|
TESTS+=("$element/$test_element")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Default values
|
||||||
|
#
|
||||||
JOB_MAX_CNT=1
|
JOB_MAX_CNT=1
|
||||||
|
LOG_DATESTAMP=0
|
||||||
|
|
||||||
while getopts ":hlpj:" opt; do
|
#
|
||||||
|
# Parse args
|
||||||
|
#
|
||||||
|
while getopts ":hlj:t" opt; do
|
||||||
case $opt in
|
case $opt in
|
||||||
h)
|
h)
|
||||||
echo "run_functests.sh [-h] [-l] <test> <test> ..."
|
echo "run_functests.sh [-h] [-l] <test> <test> ..."
|
||||||
echo " -h : show this help"
|
echo " -h : show this help"
|
||||||
echo " -l : list available tests"
|
echo " -l : list available tests"
|
||||||
echo " -p : run all tests in parallel"
|
echo " -j : parallel job count (default to 1)"
|
||||||
|
echo " -t : prefix log messages with timestamp"
|
||||||
echo " <test> : functional test to run"
|
echo " <test> : functional test to run"
|
||||||
echo " Special test 'all' will run all tests"
|
echo " Special test 'all' will run all tests"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -182,6 +200,9 @@ while getopts ":hlpj:" opt; do
|
||||||
JOB_MAX_CNT=${OPTARG}
|
JOB_MAX_CNT=${OPTARG}
|
||||||
echo "Running parallel - using [${JOB_MAX_CNT}] jobs"
|
echo "Running parallel - using [${JOB_MAX_CNT}] jobs"
|
||||||
;;
|
;;
|
||||||
|
t)
|
||||||
|
LOG_DATESTAMP=1
|
||||||
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid option: -$OPTARG"
|
echo "Invalid option: -$OPTARG"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in a new issue