[compiler-rt] [sanitizer][test] Print result in getpwnam_r_invalid_user.cpp (PR #162217)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 09:26:14 PDT 2025


https://github.com/thurstond updated https://github.com/llvm/llvm-project/pull/162217

>From 8f4790f99039633d6da1daba9206f4254a49f64f Mon Sep 17 00:00:00 2001
From: Thurston Dang <thurston at google.com>
Date: Tue, 7 Oct 2025 02:45:48 +0000
Subject: [PATCH] [sanitizer][test] Print result in getpwnam_r_invalid_user.cpp

This test has been flaky failing on sanitizer-ppc64le-linux since at least 9 days ago (https://lab.llvm.org/buildbot/#/builders/72/builds/15257), but the exact cause is unclear because the only output is that `assert(res == 0 || res == ENOENT);` failed.

To aid debugging, this patch prints out the result of the `getpwnam_r` call.
---
 .../TestCases/Linux/getpwnam_r_invalid_user.cpp                 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cpp
index c0d6cfea1fbef..4c6cffee05e51 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/getpwnam_r_invalid_user.cpp
@@ -14,6 +14,8 @@ int main(void) {
   struct passwd *pwdres;
   char buf[10000];
   int res = getpwnam_r("no-such-user", &pwd, buf, sizeof(buf), &pwdres);
+  fprintf(stderr, "Result: %d\n", res);
+  fflush(stderr);
   assert(res == 0 || res == ENOENT);
   assert(pwdres == 0);
   return 0;



More information about the llvm-commits mailing list