diff --git a/tests/run-coredump-unwind b/tests/run-coredump-unwind index 18060c51..d6dd7e03 100755 --- a/tests/run-coredump-unwind +++ b/tests/run-coredump-unwind @@ -1,7 +1,8 @@ #!/bin/sh TESTDIR=`pwd` -TEMPDIR=`mktemp -d` +TEMPDIR=`mktemp --tmpdir -d libunwind-test-XXXXXXXXXX` +trap "rm -r -- $TEMPDIR" EXIT # create core dump ( @@ -11,10 +12,5 @@ TEMPDIR=`mktemp -d` ) 2>/dev/null COREFILE=$TEMPDIR/core* -# fail if any command fails -set -e - # magic option -testcase enables checking for the specific contents of the stack ./test-coredump-unwind $COREFILE -testcase `cat $TEMPDIR/backing_files` - -rm -r -- $TEMPDIR diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c index ab1ff03f..2b2d4b92 100644 --- a/tests/test-coredump-unwind.c +++ b/tests/test-coredump-unwind.c @@ -269,9 +269,11 @@ main(int argc, char **argv) int ret; #define TEST_FRAMES 4 +#define TEST_NAME_LEN 16 int testcase = 0; int test_cur = 0; long test_start_ips[TEST_FRAMES]; + char test_names[TEST_FRAMES][TEST_NAME_LEN]; install_sigsegv_handler(); @@ -338,7 +340,13 @@ main(int argc, char **argv) if (testcase && test_cur < TEST_FRAMES) { + unw_word_t off; + test_start_ips[test_cur] = (long) pi.start_ip; + if (unw_get_proc_name(&c, test_names[test_cur], sizeof(test_names[0]), &off) != 0) + { + test_names[test_cur][0] = '\0'; + } test_cur++; } @@ -366,6 +374,18 @@ main(int argc, char **argv) return -1; } + if (testcase && + ( strcmp(test_names[0], "a") + || strcmp(test_names[1], "b") + || strcmp(test_names[2], "b") + || strcmp(test_names[3], "main") + ) + ) + { + fprintf(stderr, "FAILURE: procedure names are missing/incorrect\n"); + return -1; + } + _UCD_destroy(ui); return 0;