1#!/bin/sh 2 3# Copyright (C) Internet Systems Consortium, Inc. ("ISC") 4# 5# SPDX-License-Identifier: MPL-2.0 6# 7# This Source Code Form is subject to the terms of the Mozilla Public 8# License, v. 2.0. If a copy of the MPL was not distributed with this 9# file, you can obtain one at https://mozilla.org/MPL/2.0/. 10# 11# See the COPYRIGHT file distributed with this work for additional 12# information regarding copyright ownership. 13 14dir=$(dirname "$0") 15. "$dir/conf.sh" 16 17systest=$1 18status=0 19 20export SYSTESTDIR="${TOP_BUILDDIR}/bin/tests/system/${systest}" 21 22get_core_dumps() { 23 find "$SYSTESTDIR/" \( -name 'core' -or -name 'core.*' -or -name '*.core' \) ! -name '*.gz' ! -name '*.txt' | sort 24} 25 26core_dumps=$(get_core_dumps | tr '\n' ' ') 27if [ -n "$core_dumps" ]; then 28 status=1 29 echoinfo "I:$systest:Core dump(s) found: $core_dumps" 30 get_core_dumps | while read -r coredump; do 31 echoinfo "D:$systest:backtrace from $coredump:" 32 echoinfo "D:$systest:--------------------------------------------------------------------------------" 33 binary=$(gdb --batch --core="$coredump" 2>/dev/null | sed -ne "s|Core was generated by \`\([^' ]*\)[' ].*|\1|p") 34 if [ ! -f "${binary}" ]; then 35 binary=$(find "${TOP_BUILDDIR}" -path "*/.libs/${binary}" -type f) 36 fi 37 "${TOP_BUILDDIR}/libtool" --mode=execute gdb \ 38 -batch \ 39 -ex bt \ 40 -core="$coredump" \ 41 -- \ 42 "$binary" 2>/dev/null | sed -n '/^Core was generated by/,$p' | cat_d 43 echoinfo "D:$systest:--------------------------------------------------------------------------------" 44 coredump_backtrace="${coredump}-backtrace.txt" 45 echoinfo "D:$systest:full backtrace from $coredump saved in $coredump_backtrace" 46 "${TOP_BUILDDIR}/libtool" --mode=execute gdb \ 47 -batch \ 48 -command="${TOP_SRCDIR}/bin/tests/system/run.gdb" \ 49 -core="$coredump" \ 50 -- \ 51 "$binary" >"$coredump_backtrace" 2>&1 52 echoinfo "D:$systest:core dump $coredump archived as $coredump.gz" 53 gzip -1 "${coredump}" 54 done 55fi 56 57assertion_failures=$(find "$SYSTESTDIR/" -name named.run -exec grep "assertion failure" {} + | wc -l) 58if [ "$assertion_failures" -ne 0 ]; then 59 status=1 60 echoinfo "I:$systest:$assertion_failures assertion failure(s) found" 61fi 62 63tsan_failures=$(find "$SYSTESTDIR/" -name 'tsan.*' | wc -l) 64if [ "$tsan_failures" -ne 0 ]; then 65 status=1 66 echoinfo "I:$systest:$tsan_failures TSAN sanitizer report(s) found" 67 find "$SYSTESTDIR/" -name 'tsan.*' -exec grep "SUMMARY: " {} + | sort -u | cat_d 68fi 69 70exit $status 71