[Openmp-commits] [openmp] de776fb - [OpenMP] Fix libarcher tests on Ubuntu 22.04 (#170671)

via Openmp-commits openmp-commits at lists.llvm.org
Mon Dec 15 06:25:58 PST 2025


Author: Leandro Lupori
Date: 2025-12-15T11:25:54-03:00
New Revision: de776fb60a89f8686fa287ce9b2e8134bf37f436

URL: https://github.com/llvm/llvm-project/commit/de776fb60a89f8686fa287ce9b2e8134bf37f436
DIFF: https://github.com/llvm/llvm-project/commit/de776fb60a89f8686fa287ce9b2e8134bf37f436.diff

LOG: [OpenMP] Fix libarcher tests on Ubuntu 22.04 (#170671)

When llvm-symbolizer is not found on PATH TSan uses system's addr2line
instead. On Ubuntu 22.04 addr2line can't handle DWARF v5, which results
in failures in some libarcher tests.

This PR adds the directory of the just built LLVM binaries to PATH, to
make llvm-symbolizer available to TSan.

The changes were tested on an AArch64 machine, on which
task-taskgroup-unrelated.c was flaky. Moving the test code to a separate
function, executed 10 times, solved the issue.

Fixes #170138

Added: 
    

Modified: 
    openmp/tools/archer/tests/lit.cfg
    openmp/tools/archer/tests/races/task-taskgroup-unrelated.c

Removed: 
    


################################################################################
diff  --git a/openmp/tools/archer/tests/lit.cfg b/openmp/tools/archer/tests/lit.cfg
index 786b2d9991e9c..f1e0158277a08 100644
--- a/openmp/tools/archer/tests/lit.cfg
+++ b/openmp/tools/archer/tests/lit.cfg
@@ -11,21 +11,30 @@ if 'PYLINT_IMPORT' in os.environ:
     config = object()
     lit_config = object()
 
+def get_path_separator():
+    return ';' if config.operating_system == 'Windows' else ':'
+
 def append_dynamic_library_path(path):
     if config.operating_system == 'Windows':
         name = 'PATH'
-        sep = ';'
     elif config.operating_system == 'Darwin':
         name = 'DYLD_LIBRARY_PATH'
-        sep = ':'
     else:
         name = 'LD_LIBRARY_PATH'
-        sep = ':'
+    sep = get_path_separator()
     if name in config.environment:
         config.environment[name] = path + sep + config.environment[name]
     else:
         config.environment[name] = path
 
+def append_path(path):
+    name = 'PATH'
+    sep = get_path_separator()
+    if name in config.environment:
+        config.environment[name] = config.environment[name] + sep + path
+    else:
+        config.environment[name] = path
+
 # name: The name of this test suite.
 config.name = 'libarcher'
 
@@ -65,6 +74,11 @@ for feature in config.test_compiler_features:
 append_dynamic_library_path(config.omp_library_dir)
 append_dynamic_library_path(config.libarcher_obj_root+"/..")
 
+# Add LLVM bin dir to PATH.
+# llvm-symbolizer is needed to correctly resolve addresses, without relying on
+# system's addr2line.
+append_path(os.path.dirname(config.test_c_compiler))
+
 # Rpath modifications for Darwin
 if config.operating_system == 'Darwin':
     config.test_flags += " -Wl,-rpath," + config.omp_library_dir

diff  --git a/openmp/tools/archer/tests/races/task-taskgroup-unrelated.c b/openmp/tools/archer/tests/races/task-taskgroup-unrelated.c
index 04b2957b48637..4d747d4742e48 100644
--- a/openmp/tools/archer/tests/races/task-taskgroup-unrelated.c
+++ b/openmp/tools/archer/tests/races/task-taskgroup-unrelated.c
@@ -18,7 +18,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-int main(int argc, char *argv[]) {
+int test(void) {
   int var = 0, a = 0;
 
 #pragma omp parallel num_threads(8) shared(var, a)
@@ -48,6 +48,18 @@ int main(int argc, char *argv[]) {
   }
 
   int error = (var != 2);
+  return error;
+}
+
+int main(int argc, char *argv[]) {
+  int i, error;
+
+  for (i = 0; i < 10; ++i) {
+    error = test();
+    if (error)
+      return error;
+  }
+
   fprintf(stderr, "DONE\n");
   return error;
 }


        


More information about the Openmp-commits mailing list