mirror of https://github.com/getdnsapi/getdns.git
Flag for live logging
This commit is contained in:
parent
48209a038c
commit
d2c258158f
|
@ -18,4 +18,5 @@ addons:
|
||||||
script:
|
script:
|
||||||
- mkdir tests
|
- mkdir tests
|
||||||
- cd tests
|
- cd tests
|
||||||
- ../src/test/tpkg/run-one.sh 400-static-analysis
|
# - ../src/test/tpkg/run-all.sh
|
||||||
|
- ../src/test/tpkg/run-one.sh 400-static-analysis -V
|
||||||
|
|
|
@ -13,6 +13,7 @@ TPKG_BASE="."
|
||||||
TPKG_ARGS=""
|
TPKG_ARGS=""
|
||||||
TPKG_CURRENT=`pwd`
|
TPKG_CURRENT=`pwd`
|
||||||
TPKG_QUIET=0 # only output err() msgs
|
TPKG_QUIET=0 # only output err() msgs
|
||||||
|
TPKG_VERBOSE=0 # Show live output of test execution
|
||||||
TPKG_KEEP=0 # tpkg create doesn't remove dir/
|
TPKG_KEEP=0 # tpkg create doesn't remove dir/
|
||||||
TPKG_PASS=0 # how much must succeed
|
TPKG_PASS=0 # how much must succeed
|
||||||
TPKG_LOG=0 # don't log
|
TPKG_LOG=0 # don't log
|
||||||
|
@ -73,6 +74,14 @@ function out() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function write_result() {
|
||||||
|
if [[ $TPKG_VERBOSE -gt 0 ]]; then
|
||||||
|
tee -a $1
|
||||||
|
else
|
||||||
|
cat >> $1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function epoch() {
|
function epoch() {
|
||||||
# make this sorta portable allthough not needed now
|
# make this sorta portable allthough not needed now
|
||||||
epoch=0
|
epoch=0
|
||||||
|
@ -89,9 +98,9 @@ function epoch() {
|
||||||
function post() {
|
function post() {
|
||||||
if [ -f "${dsc_post}" ]; then
|
if [ -f "${dsc_post}" ]; then
|
||||||
err "[log] Executing post script: ${dsc_post} ${TPKG_ARGS}"
|
err "[log] Executing post script: ${dsc_post} ${TPKG_ARGS}"
|
||||||
echo "--------- Start Post Output ------------------ " | tee -a result.$dsc_basename
|
echo "--------- Start Post Output ------------------ " | write_result result.$dsc_basename
|
||||||
${SHELL} ${dsc_post} ${TPKG_ARGS} | tee -a result.$dsc_basename
|
${SHELL} ${dsc_post} ${TPKG_ARGS} | write_result result.$dsc_basename
|
||||||
echo "----------- End Post Output ------------------ " | tee -a result.$dsc_basename
|
echo "----------- End Post Output ------------------ " | write_result result.$dsc_basename
|
||||||
result=$?
|
result=$?
|
||||||
if [ $result -ne 0 ]; then
|
if [ $result -ne 0 ]; then
|
||||||
err "[warning] Post-script executed with errors: $result."
|
err "[warning] Post-script executed with errors: $result."
|
||||||
|
@ -102,9 +111,9 @@ function post() {
|
||||||
function pre() {
|
function pre() {
|
||||||
if [ -f "${dsc_pre}" ]; then
|
if [ -f "${dsc_pre}" ]; then
|
||||||
err "[log] Executing pre script: ${dsc_pre} ${TPKG_ARGS}"
|
err "[log] Executing pre script: ${dsc_pre} ${TPKG_ARGS}"
|
||||||
echo "--------- Start Pre Output ------------------- " | tee -a result.$dsc_basename
|
echo "--------- Start Pre Output ------------------- " | write_result result.$dsc_basename
|
||||||
${SHELL} ${dsc_pre} ${TPKG_ARGS} | tee -a result.$dsc_basename
|
${SHELL} ${dsc_pre} ${TPKG_ARGS} | write_result result.$dsc_basename
|
||||||
echo "----------- End Pre Output ------------------- " | tee -a result.$dsc_basename
|
echo "----------- End Pre Output ------------------- " | write_result result.$dsc_basename
|
||||||
result=$?
|
result=$?
|
||||||
if [ $result -ne 0 ]; then
|
if [ $result -ne 0 ]; then
|
||||||
err "[warning] Pre-script executed with errors: $result."
|
err "[warning] Pre-script executed with errors: $result."
|
||||||
|
@ -179,6 +188,7 @@ function usage() {
|
||||||
out " -h\t\tshow this help"
|
out " -h\t\tshow this help"
|
||||||
out " -v\t\tshow version"
|
out " -v\t\tshow version"
|
||||||
out " -q\t\tonly print errors"
|
out " -q\t\tonly print errors"
|
||||||
|
out " -V\t\tshow live output when executing tests"
|
||||||
out " -l\t\tlog test name to syslog when starting the test (using logger)"
|
out " -l\t\tlog test name to syslog when starting the test (using logger)"
|
||||||
out " -p PRI\tlog using PRI as priority"
|
out " -p PRI\tlog using PRI as priority"
|
||||||
out " -k\t\tdon't remove test directory when creating/executing a tpkg package"
|
out " -k\t\tdon't remove test directory when creating/executing a tpkg package"
|
||||||
|
@ -407,7 +417,7 @@ function extract_tpkg_to { # <dir>
|
||||||
|
|
||||||
### MAIN
|
### MAIN
|
||||||
# check the arguments
|
# check the arguments
|
||||||
while getopts ":vhkqb:a:n:lp:df" o
|
while getopts ":vhkqVb:a:n:lp:df" o
|
||||||
do case "$o" in
|
do case "$o" in
|
||||||
b) TPKG_BASE="$OPTARG";;
|
b) TPKG_BASE="$OPTARG";;
|
||||||
h) usage; exit 0;;
|
h) usage; exit 0;;
|
||||||
|
@ -422,6 +432,7 @@ do case "$o" in
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
q) TPKG_QUIET=1;;
|
q) TPKG_QUIET=1;;
|
||||||
|
V) TPKG_VERBOSE=`expr $TPKG_VERBOSE + 1`;;
|
||||||
k) TPKG_KEEP=1;;
|
k) TPKG_KEEP=1;;
|
||||||
n) TPKG_PASS=$OPTARG
|
n) TPKG_PASS=$OPTARG
|
||||||
if [ $TPKG_PASS -eq 0 ]; then
|
if [ $TPKG_PASS -eq 0 ]; then
|
||||||
|
@ -838,16 +849,17 @@ fi
|
||||||
tpkg_log "Starting test: '$dsc_basename'"
|
tpkg_log "Starting test: '$dsc_basename'"
|
||||||
|
|
||||||
epoch # run before pre()
|
epoch # run before pre()
|
||||||
echo "BaseName: $dsc_basename" | tee result.$dsc_basename
|
: > result.$dsc_basename
|
||||||
echo "Description: $dsc_description" | tee -a result.$dsc_basename
|
echo "BaseName: $dsc_basename" | write_result result.$dsc_basename
|
||||||
echo "DateRunStart: $epoch " | tee -a result.$dsc_basename
|
echo "Description: $dsc_description" | write_result result.$dsc_basename
|
||||||
echo "--------------- Test Output ------------------" | tee -a result.$dsc_basename
|
echo "DateRunStart: $epoch " | write_result result.$dsc_basename
|
||||||
|
echo "--------------- Test Output ------------------" | write_result result.$dsc_basename
|
||||||
|
|
||||||
pre
|
pre
|
||||||
|
|
||||||
out "[log] Executing test"
|
out "[log] Executing test"
|
||||||
|
|
||||||
( ${SHELL} $dsc_test ${TPKG_ARGS} 2>&1 ) | tee -a result.$dsc_basename
|
( ${SHELL} $dsc_test ${TPKG_ARGS} 2>&1 ) | write_result result.$dsc_basename
|
||||||
test_result=$?
|
test_result=$?
|
||||||
epoch # would like to run after post, but that is not possible :-(
|
epoch # would like to run after post, but that is not possible :-(
|
||||||
if [ $test_result -ne 0 ]; then
|
if [ $test_result -ne 0 ]; then
|
||||||
|
|
Loading…
Reference in New Issue