2
0

test.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. # All output will be collected here
  3. TESTSUNITPATH=$PWD
  4. # All relative paths are based on the tree's root
  5. FSBASEDIR=$(realpath "$PWD/../../")
  6. i=$1
  7. echo "----------------------------------" ;
  8. echo "Starting test: $i" ;
  9. echo "----------------------------------" ;
  10. # Change folder to where the test is
  11. currenttestpath="$FSBASEDIR/$i"
  12. cd $(dirname "$currenttestpath")
  13. # Tests are unique per module, so need to distinguish them by their directory
  14. relativedir=$(dirname "$i")
  15. echo "Relative dir is $relativedir"
  16. file=$(basename -- "$currenttestpath")
  17. log="$TESTSUNITPATH/log_run-tests_${relativedir//\//!}!$file.html";
  18. # Execute the test
  19. echo "Start executing $currenttestpath"
  20. $currenttestpath 2>&1 | tee >(ansi2html > $log) ;
  21. exitstatus=${PIPESTATUS[0]} ;
  22. echo "End executing $currenttestpath"
  23. echo "Exit status is $exitstatus"
  24. if [ "0" -eq $exitstatus ] ; then
  25. rm $log ;
  26. else
  27. echo "*** ./$i exit status is $exitstatus" ;
  28. corefilesearch=/cores/core.*.!drone!src!${relativedir//\//!}!.libs!$file.* ;
  29. echo $corefilesearch ;
  30. if ls $corefilesearch 1> /dev/null 2>&1; then
  31. echo "coredump found";
  32. coredump=$(ls $corefilesearch) ;
  33. echo $coredump;
  34. echo "set logging file $TESTSUNITPATH/backtrace_${i//\//!}.txt" ;
  35. 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 ;
  36. fi ;
  37. echo "*** $log was saved" ;
  38. fi ;
  39. echo "----------------" ;