[compiler-rt] 1e1974a - [compiler-rt] [test] Avoid error printouts if os.sysconf is missing (#168857)

via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 24 13:51:44 PST 2025


Author: Martin Storsjö
Date: 2025-11-24T23:51:40+02:00
New Revision: 1e1974a903c505de1f42257044b7a03a390d7a8b

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

LOG: [compiler-rt] [test] Avoid error printouts if os.sysconf is missing (#168857)

This avoids dozens of instances of benign error messages being printed
when running the tests on e.g. Windows:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: module 'os' has no attribute 'sysconf'

Co-authored-by: Florian Mayer <fmayer at google.com>

Added: 
    

Modified: 
    compiler-rt/test/lit.common.cfg.py

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index ea22fb0babc46..dce01cc9743b3 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -971,7 +971,9 @@ def target_page_size():
             stdin=subprocess.PIPE,
             stdout=subprocess.PIPE,
         )
-        out, err = proc.communicate(b'import os; print(os.sysconf("SC_PAGESIZE"))')
+        out, err = proc.communicate(
+            b'import os; print(os.sysconf("SC_PAGESIZE") if hasattr(os, "sysconf") else "")'
+        )
         return int(out)
     except:
         return 4096


        


More information about the llvm-commits mailing list