1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-03 01:32:38 +02:00

Make coredump test also test unw_get_proc_name

Signed-off-by: Martin Milata <mmilata@redhat.com>
This commit is contained in:
Martin Milata 2012-08-08 13:51:54 +02:00
parent e11a6a4fdf
commit 2dbc26dde8
2 changed files with 22 additions and 6 deletions

View file

@ -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

View file

@ -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;