Module Name: src Committed By: riastradh Date: Fri Nov 24 17:40:09 UTC 2023
Modified Files: src/tests/libexec/ld.elf_so: t_dlinfo.c t_rtld_r_debug.c Log Message: rtld tests: Don't use RZ for dlinfo. Use ATF_REQUIRE_EQ_MSG(dlinfo(...), 0, "dlinfo: %s", dlerror()) instead, in order to accurately report the error on failure. RZ is only for functions like pthread_create(3) that return zero on success and errno(3) code on failure, but dlinfo returns -1 on failure and sets dlerror() to report the nature of the error. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/libexec/ld.elf_so/t_dlinfo.c cvs rdiff -u -r1.3 -r1.4 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/libexec/ld.elf_so/t_dlinfo.c diff -u src/tests/libexec/ld.elf_so/t_dlinfo.c:1.6 src/tests/libexec/ld.elf_so/t_dlinfo.c:1.7 --- src/tests/libexec/ld.elf_so/t_dlinfo.c:1.6 Tue Jul 9 16:24:01 2019 +++ src/tests/libexec/ld.elf_so/t_dlinfo.c Fri Nov 24 17:40:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_dlinfo.c,v 1.6 2019/07/09 16:24:01 maya Exp $ */ +/* $NetBSD: t_dlinfo.c,v 1.7 2023/11/24 17:40:09 riastradh Exp $ */ /* * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,8 @@ ATF_TC_BODY(rtld_dlinfo_linkmap_dlopen_i handle = dlopen("libutil.so", RTLD_LAZY); ATF_CHECK(handle); - RZ(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map)); + ATF_REQUIRE_EQ_MSG(dlinfo(RTLD_SELF, RTLD_DI_LINKMAP, &map), 0, + "dlinfo: %s", dlerror()); for (; map->l_next; map = map->l_next) continue; Index: src/tests/libexec/ld.elf_so/t_rtld_r_debug.c diff -u src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.3 src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.4 --- src/tests/libexec/ld.elf_so/t_rtld_r_debug.c:1.3 Tue Sep 29 16:35:42 2020 +++ src/tests/libexec/ld.elf_so/t_rtld_r_debug.c Fri Nov 24 17:40:09 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: t_rtld_r_debug.c,v 1.3 2020/09/29 16:35:42 roy Exp $ */ +/* $NetBSD: t_rtld_r_debug.c,v 1.4 2023/11/24 17:40:09 riastradh Exp $ */ /* * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -150,7 +150,8 @@ ATF_TC_BODY(dlopen, tc) check_r_debug_return_link_map("libutil.so", &r_map); - RZ(dlinfo(handle, RTLD_DI_LINKMAP, &map)); + ATF_REQUIRE_EQ_MSG(dlinfo(handle, RTLD_DI_LINKMAP, &map), 0, + "dlinfo: %s", dlerror()); ATF_CHECK(map == r_map); dlclose(handle);