2019-11-21 22:43:28 +04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-01-19 00:05:25 +04:00
|
|
|
# All output will be collected here
|
|
|
|
TESTSUNITPATH=$PWD
|
|
|
|
|
|
|
|
# "print_tests" returns relative paths to all the tests
|
|
|
|
TESTS=$(make -s -C ../.. print_tests)
|
|
|
|
|
|
|
|
# All relative paths are based on the tree's root
|
|
|
|
FSBASEDIR=$(realpath "$PWD/../../")
|
2019-11-21 22:43:28 +04:00
|
|
|
|
|
|
|
echo "-----------------------------------------------------------------";
|
|
|
|
echo "Starting tests";
|
|
|
|
echo "Tests found: ${TESTS}";
|
|
|
|
echo "-----------------------------------------------------------------";
|
|
|
|
for i in $TESTS
|
|
|
|
do
|
|
|
|
echo "Testing $i" ;
|
2020-01-19 00:05:25 +04:00
|
|
|
|
|
|
|
# Change folder to where the test is
|
|
|
|
currenttestpath="$FSBASEDIR/$i"
|
|
|
|
cd $(dirname "$currenttestpath")
|
|
|
|
|
|
|
|
# Tests are unique per module, so need to distinguish them by their directory
|
|
|
|
relativedir=$(dirname "$i")
|
|
|
|
echo "Relative dir is $relativedir"
|
|
|
|
|
|
|
|
file=$(basename -- "$currenttestpath")
|
|
|
|
log="$TESTSUNITPATH/log_run-tests_${relativedir//\//!}!$file.html";
|
|
|
|
|
|
|
|
# Execute the test
|
|
|
|
$currenttestpath | tee >(ansi2html > $log) ;
|
2019-11-21 22:43:28 +04:00
|
|
|
exitstatus=${PIPESTATUS[0]} ;
|
2020-01-19 00:05:25 +04:00
|
|
|
|
2019-11-21 22:43:28 +04:00
|
|
|
if [ "0" -eq $exitstatus ] ; then
|
2020-01-19 00:05:25 +04:00
|
|
|
rm $log ;
|
2019-11-21 22:43:28 +04:00
|
|
|
else
|
|
|
|
echo "*** ./$i exit status is $exitstatus" ;
|
2020-01-19 00:05:25 +04:00
|
|
|
corefilesearch=/cores/core.*.!drone!src!${relativedir//\//!}!.libs!$file.* ;
|
|
|
|
echo $corefilesearch ;
|
|
|
|
if ls $corefilesearch 1> /dev/null 2>&1; then
|
|
|
|
echo "coredump found";
|
|
|
|
coredump=$(ls $corefilesearch) ;
|
|
|
|
echo $coredump;
|
|
|
|
echo "set logging file $TESTSUNITPATH/backtrace_${i//\//!}.txt" ;
|
|
|
|
gdb -ex "set logging file $TESTSUNITPATH/backtrace_${i//\//!}.txt" -ex "set logging on" -ex "set pagination off" -ex "bt full" -ex "bt" -ex "info threads" -ex "thread apply all bt" -ex "thread apply all bt full" -ex "quit" /drone/src/$relativedir/.libs/$file $coredump ;
|
2019-12-27 19:25:38 +04:00
|
|
|
fi ;
|
2020-01-19 00:05:25 +04:00
|
|
|
echo "*** $log was saved" ;
|
2019-11-21 22:43:28 +04:00
|
|
|
fi ;
|
|
|
|
echo "----------------" ;
|
|
|
|
done
|