summaryrefslogtreecommitdiff
path: root/libbacktrace/btest.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbacktrace/btest.c')
-rw-r--r--libbacktrace/btest.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libbacktrace/btest.c b/libbacktrace/btest.c
index 22b08e05030..17fea3061f5 100644
--- a/libbacktrace/btest.c
+++ b/libbacktrace/btest.c
@@ -129,6 +129,13 @@ check (const char *name, int index, const struct info *all, int want_lineno,
{
if (*failed)
return;
+ if (all[index].filename == NULL || all[index].function == NULL)
+ {
+ fprintf (stderr, "%s: [%d]: missing file name or function name\n",
+ name, index);
+ *failed = 1;
+ return;
+ }
if (strcmp (base (all[index].filename), "btest.c") != 0)
{
fprintf (stderr, "%s: [%d]: got %s expected test.c\n", name, index,
@@ -310,6 +317,14 @@ f3 (int f1line, int f2line)
data.failed = 1;
}
+ if (data.index < 3)
+ {
+ fprintf (stderr,
+ "test1: not enough frames; got %zu, expected at least 3\n",
+ data.index);
+ data.failed = 1;
+ }
+
check ("test1", 0, all, f3line, "f3", &data.failed);
check ("test1", 1, all, f2line, "f2", &data.failed);
check ("test1", 2, all, f1line, "test1", &data.failed);