+/*
+ * Test that we fail on an ELF file without DWARF.
+ */
+static
+void test_bt_no_dwarf(const char *data_dir)
+{
+ int fd;
+ char *path;
+ Dwarf *dwarf_info = NULL;
+
+ path = g_build_filename(data_dir, ELF_DIR_NAME, SO_NAME, NULL);
+ if (path == NULL) {
+ diag("Failed to allocate memory for path");
+ exit(EXIT_FAILURE);
+ }
+
+ fd = open(path, O_RDONLY);
+ ok(fd >= 0, "Open ELF file %s", path);
+ if (fd < 0) {
+ skip(1, "dwarf_begin failed as expected");
+ } else {
+ dwarf_info = dwarf_begin(fd, DWARF_C_READ);
+ ok(dwarf_info == NULL, "dwarf_begin failed as expected");
+ }
+
+ if (dwarf_info != NULL) {
+ dwarf_end(dwarf_info);
+ }
+ close(fd);
+ g_free(path);
+}
+
+/*
+ * Test with a proper ELF file with DWARF.
+ */