diff options
| author | joerg <joerg@NetBSD.org> | 2014-03-11 13:43:23 +0000 |
|---|---|---|
| committer | joerg <joerg@NetBSD.org> | 2014-03-11 13:43:23 +0000 |
| commit | 5ff9dbdf155f6ff562b3fd83a115b3f064e9caed (patch) | |
| tree | 320e39190968aa62ca4801cdf009113eb4039dfd /tests/lib/libexecinfo | |
| parent | d85df568cc46a74062a75bcf1d2834db7097fe67 (diff) | |
Use a struct for pair of frame name and whether it is optional. Add some
additional entries found in a -O0 build of ATF on PowerPC.
Diffstat (limited to 'tests/lib/libexecinfo')
| -rw-r--r-- | tests/lib/libexecinfo/t_backtrace.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/tests/lib/libexecinfo/t_backtrace.c b/tests/lib/libexecinfo/t_backtrace.c index 71fa8227730..4f644f46b92 100644 --- a/tests/lib/libexecinfo/t_backtrace.c +++ b/tests/lib/libexecinfo/t_backtrace.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_backtrace.c,v 1.12 2014/01/11 19:48:22 martin Exp $ */ +/* $NetBSD: t_backtrace.c,v 1.13 2014/03/11 13:43:23 joerg Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__RCSID("$NetBSD: t_backtrace.c,v 1.12 2014/01/11 19:48:22 martin Exp $"); +__RCSID("$NetBSD: t_backtrace.c,v 1.13 2014/03/11 13:43:23 joerg Exp $"); #include <atf-c.h> #include <atf-c/config.h> @@ -53,19 +53,28 @@ volatile int prevent_inline; void myfunc3(size_t ncalls) { - static const char *top[] = { "myfunc", "atfu_backtrace_fmt_basic_body", - "atf_tc_run", "atf_tp_run", "atf_tp_main", "main", "___start" }; - static bool optional_frame[] = { false, false, false, true, false, - true, true }; + static const struct { + const char *name; + bool is_optional; + } frames[] = { + { "myfunc", false }, + { "atfu_backtrace_fmt_basic_body", false }, + { "atf_tc_run", false }, + { "atf_tp_run", true }, + { "run_tc", true }, + { "controlled_main", true }, + { "atf_tp_main", false }, + { "main", true }, + { "___start", true }, + }; size_t j, nptrs, min_frames, max_frames; void *buffer[ncalls + 10]; char **strings; - __CTASSERT(__arraycount(top) == __arraycount(optional_frame)); min_frames = 0; max_frames = 0; - for (j = 0; j < __arraycount(optional_frame); ++j) { - if (!optional_frame[j]) + for (j = 0; j < __arraycount(frames); ++j) { + if (!frames[j].is_optional) ++min_frames; ++max_frames; } @@ -90,11 +99,12 @@ myfunc3(size_t ncalls) ATF_CHECK_STREQ(strings[j], "myfunc1"); for (size_t i = 0; j < nptrs; i++, j++) { - if (optional_frame[i] && strcmp(strings[j], top[i])) { + if (frames[i].is_optional && + strcmp(strings[j], frames[i].name)) { --i; continue; } - ATF_CHECK_STREQ(strings[j], top[i]); + ATF_CHECK_STREQ(strings[j], frames[i].name); } free(strings); |
