Skip to content

Conversation

@ellishg
Copy link
Contributor

@ellishg ellishg commented May 30, 2025

This test is broken on android by #141820

https://lab.llvm.org/buildbot/#/builders/186/builds/9498

FileCheck error: '' is empty.

I suspect that on android printf only works if its emitted to stderr because this use to work

fprintf(stderr, "Expected bad report path: %s\n", buff_bad);
// CHECK: Expected bad report path: [[BADPATH:.*]]/report

Only emit to stderr and see if that fixes the test.

@llvmbot
Copy link
Member

llvmbot commented May 30, 2025

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Ellis Hoag (ellishg)

Changes

This test is broken on android by #141820

https://lab.llvm.org/buildbot/#/builders/186/builds/9498

> FileCheck error: '' is empty.

I suspect that on android printf only works if its emitted to stderr because this use to work

fprintf(stderr, "Expected bad report path: %s\n", buff_bad);
// CHECK: Expected bad report path: [[BADPATH:.*]]/report

Only emit to stderr and see if that fixes the test.


Full diff: https://github.com/llvm/llvm-project/pull/142207.diff

1 Files Affected:

  • (modified) compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp (+8-9)
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp
index 9d7ed80b44ccb..8abd476708b4c 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/sanitizer_set_report_path_test.cpp
@@ -1,7 +1,6 @@
 // Test __sanitizer_set_report_path and __sanitizer_get_report_path:
 // RUN: %clangxx -O2 %s -o %t
-// RUN: %env HOME=%t.homedir TMPDIR=%t.tmpdir %run %t 2>%t.err | FileCheck %s
-// RUN: FileCheck %s --input-file=%t.err --check-prefix=ERROR
+// RUN: %env HOME=%t.homedir TMPDIR=%t.tmpdir %run %t 2>&1 | FileCheck %s
 
 #include <sanitizer/common_interface_defs.h>
 #include <stdio.h>
@@ -12,31 +11,31 @@ int main(int argc, char **argv) {
   sprintf(buff, "%s.report_path/report", argv[0]);
   __sanitizer_set_report_path(buff);
   // CHECK: {{.*}}.report_path/report.[[PID:[0-9]+]]
-  printf("%s\n", __sanitizer_get_report_path());
+  fprintf(stderr, "%s\n", __sanitizer_get_report_path());
 
   strcpy(buff, "%H/foo");
   __sanitizer_set_report_path(buff);
   // CHECK: [[T:.*]].homedir/foo.[[PID]]
-  printf("%s\n", __sanitizer_get_report_path());
+  fprintf(stderr, "%s\n", __sanitizer_get_report_path());
 
   strcpy(buff, "%t/foo");
   __sanitizer_set_report_path(buff);
   // CHECK: [[T]].tmpdir/foo.[[PID]]
-  printf("%s\n", __sanitizer_get_report_path());
+  fprintf(stderr, "%s\n", __sanitizer_get_report_path());
 
   strcpy(buff, "%H/%p/%%foo");
   __sanitizer_set_report_path(buff);
   // CHECK: [[T]].homedir/[[PID]]/%foo.[[PID]]
-  printf("%s\n", __sanitizer_get_report_path());
+  fprintf(stderr, "%s\n", __sanitizer_get_report_path());
 
   strcpy(buff, "%%foo%%bar");
   __sanitizer_set_report_path(buff);
   // CHECK: %foo%bar.[[PID]]
-  printf("%s\n", __sanitizer_get_report_path());
+  fprintf(stderr, "%s\n", __sanitizer_get_report_path());
 
   strcpy(buff, "%%foo%ba%%r");
   __sanitizer_set_report_path(buff);
-  // ERROR: Unexpected pattern: %%foo%ba%%r
+  // CHECK: Unexpected pattern: %%foo%ba%%r
   // CHECK: %%foo%ba%%r.[[PID]]
-  printf("%s\n", __sanitizer_get_report_path());
+  fprintf(stderr, "%s\n", __sanitizer_get_report_path());
 }

@ellishg ellishg merged commit 986f519 into llvm:main May 30, 2025
11 of 12 checks passed
@ellishg ellishg deleted the better-fix-141820 branch May 30, 2025 20:16
ellishg added a commit that referenced this pull request May 31, 2025
I attempted to fix android tests in
#142207 (broken by
#141820). They are still
failing but now I have more info.


https://lab.llvm.org/buildbot/#/builders/186/builds/9504/steps/16/logs/stdio

ERROR: Can't open file: //foo.8862 (reason: 30)

I believe the reason is that on android the HOME and TMPDIR environment
variables are not being set correctly, or they are not read correctly.
(#142234 (comment))
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request May 31, 2025
I attempted to fix android tests in
llvm/llvm-project#142207 (broken by
llvm/llvm-project#141820). They are still
failing but now I have more info.

https://lab.llvm.org/buildbot/#/builders/186/builds/9504/steps/16/logs/stdio

ERROR: Can't open file: //foo.8862 (reason: 30)

I believe the reason is that on android the HOME and TMPDIR environment
variables are not being set correctly, or they are not read correctly.
(llvm/llvm-project#142234 (comment))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants