"Fossies" - the Fresh Open Source Software Archive

Member "bind-9.17.5/lib/unit-test-driver.sh.in" (4 Sep 2020, 1126 Bytes) of package /linux/misc/dns/bind9/9.17.5/bind-9.17.5.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/bin/sh
    2 
    3 TOP_BUILDDIR=@abs_top_builddir@
    4 TOP_SRCDIR=@abs_top_srcdir@
    5 
    6 if [ -z "${1}" ]; then
    7     echo "Usage: ${0} test_program" >&2
    8     exit 1
    9 fi
   10 
   11 TEST_PROGRAM="${1}"
   12 
   13 "${TEST_PROGRAM}"
   14 STATUS=${?}
   15 
   16 TEST_PROGRAM_NAME=$(basename "${TEST_PROGRAM}")
   17 TEST_PROGRAM_WORK_DIR=$(dirname "${TEST_PROGRAM}")
   18 find "${TEST_PROGRAM_WORK_DIR}" -name 'core*' -or -name '*.core' | while read -r CORE_DUMP; do
   19     BINARY=$(gdb --batch --core="${CORE_DUMP}" 2>/dev/null | sed -n "s/^Core was generated by \`\(.*\)'\.\$/\1/p")
   20     if ! echo "${BINARY}" | grep -q "${TEST_PROGRAM_NAME}\$"; then
   21         continue
   22     fi
   23     echo "I:${TEST_PROGRAM_NAME}:Core dump found: ${CORE_DUMP}"
   24     echo "D:${TEST_PROGRAM_NAME}:backtrace from ${CORE_DUMP} start"
   25     "${TOP_BUILDDIR}/libtool" --mode=execute gdb \
   26                               --batch \
   27                               --command="${TOP_SRCDIR}/bin/tests/system/run.gdb" \
   28                               --core="${CORE_DUMP}" \
   29                               -- \
   30                               "${BINARY}"
   31     echo "D:${TEST_PROGRAM_NAME}:backtrace from ${CORE_DUMP} end"
   32 done
   33 
   34 exit ${STATUS}