diff --git a/.drone.yml b/.drone.yml index 95fe81a95a..e902094586 100644 --- a/.drone.yml +++ b/.drone.yml @@ -10,7 +10,11 @@ steps: - cat /proc/sys/kernel/core_pattern - ./bootstrap.sh -j - echo "applications/mod_test" >> modules.conf - - export ASAN_OPTIONS=log_path=stdout; + - sed -i '/applications\/mod_http_cache/s/^#//g' modules.conf + - sed -i '/event_handlers\/mod_rayo/s/^#//g' modules.conf + - sed -i '/formats\/mod_opusfile/s/^#//g' modules.conf + - sed -i '/languages\/mod_lua/s/^#//g' modules.conf + - export ASAN_OPTIONS=log_path=stdout:disable_coredump=0:unmap_shadow_on_exit=1; - ./configure --enable-address-sanitizer - echo "#!/bin/bash\nmake -j`nproc --all` |& tee ./unit-tests-build-result.txt\nexitstatus=\${PIPESTATUS[0]}\necho \$exitstatus > ./build-status.txt\nmake install\n" > build.sh - chmod +x build.sh @@ -45,6 +49,6 @@ trigger: - push --- kind: signature -hmac: 5ebcc916118f95811470ed7e622a2acb71e84790e33f9b172c04fe3e119d78fe +hmac: d43f842f682df8328dc4cfbf16051bf8a8e481a051b63349b444447962709435 ... diff --git a/tests/unit/collect-test-logs.sh b/tests/unit/collect-test-logs.sh index 7c76c74dd5..fd2a5f9d9a 100755 --- a/tests/unit/collect-test-logs.sh +++ b/tests/unit/collect-test-logs.sh @@ -3,17 +3,24 @@ echo "Collecting test logs" LOG_DIR=./logs html="

There are failed unit-tests:

" -html+="" -logs=$(find $LOG_DIR -type f -iname "*.html" -print) +logs=$(find $LOG_DIR -type f -iname "*.html" -print | sort) logs_found=0 +olddirname="" for name in $logs do logname=$(basename $name) testname=$(echo $logname | awk -F 'log_run-tests_' '{print $2}' | awk -F '.html' '{print $1}') - html+="" ; + olddirname=$dirname ; + fi + html+="" logs_found=1 diff --git a/tests/unit/run-tests.sh b/tests/unit/run-tests.sh index 5f63ff1398..deda30ffff 100755 --- a/tests/unit/run-tests.sh +++ b/tests/unit/run-tests.sh @@ -1,11 +1,13 @@ #!/bin/bash -TESTS=$(make -f - 2>/dev/null <(ansi2html > $logfilename) ; + + # 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) ; exitstatus=${PIPESTATUS[0]} ; + if [ "0" -eq $exitstatus ] ; then - rm $logfilename ; + rm $log ; else echo "*** ./$i exit status is $exitstatus" ; - if ls /cores/core.*.!drone!src!tests!unit!.libs!$i.* 1> /dev/null 2>&1; then - echo "Coredump found"; - COREDUMP=$(ls /cores/core.*.!drone!src!tests!unit!.libs!$i.*) ; - echo $COREDUMP; - gdb -ex "set logging file backtrace_$i.txt" -ex "set logging on" -ex "set pagination off" -ex "bt" -ex "bt full" -ex "info threads" -ex "thread apply all bt" -ex "thread apply all bt full" -ex "quit" /drone/src/tests/unit/.libs/$i $COREDUMP ; + 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 ; fi ; - echo "*** $logfilename was saved" ; + echo "*** $log was saved" ; fi ; echo "----------------" ; done

Unit tests
$testname" + testpath="${testname//!/\/}" + dirname=$(dirname $testpath) + test=$(basename $testpath) + if [ "$olddirname" != "$dirname" ]; then + html+="

$dirname
$test" backtrace="backtrace_$testname.txt" if test -f "${LOG_DIR}/$backtrace"; then - html+=". Core dumped, backtrace is available here" + html+=". Core dumped, backtrace is available here" fi html+="