+static
+void test_pic(const char *test_dir)
+{
+ char exec_path[PATH_MAX];
+ char pie_path[PATH_MAX];
+ char pic_path[PATH_MAX];
+ struct lttng_ust_elf *elf = NULL;
+ uint8_t is_pic;
+
+ snprintf(exec_path, PATH_MAX, "%s/data/pic/hello.exec", test_dir);
+ snprintf(pie_path, PATH_MAX, "%s/data/pic/hello.pie", test_dir);
+ snprintf(pic_path, PATH_MAX, "%s/data/pic/hello.pic", test_dir);
+
+ elf = lttng_ust_elf_create(exec_path);
+ is_pic = lttng_ust_elf_is_pic(elf);
+ ok(is_pic == 0, "hello.exec is not PIC");
+ lttng_ust_elf_destroy(elf);
+
+ elf = lttng_ust_elf_create(pie_path);
+ is_pic = lttng_ust_elf_is_pic(elf);
+ ok(is_pic == 1, "hello.pie is PIC");
+ lttng_ust_elf_destroy(elf);
+
+ elf = lttng_ust_elf_create(pic_path);
+ is_pic = lttng_ust_elf_is_pic(elf);
+ ok(is_pic == 1, "hello.pic is PIC");
+ lttng_ust_elf_destroy(elf);
+}
+