[compiler-rt] [compiler-rt] [test] Consume stderr from the subprocess for getting page size (PR #168857)

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 24 13:16:31 PST 2025


https://github.com/mstorsjo updated https://github.com/llvm/llvm-project/pull/168857

>From 52d9d821bc17e679d08ead2e6dc23c9e859b30ee Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Thu, 20 Nov 2025 11:09:20 +0000
Subject: [PATCH] [compiler-rt] [test] Avoid error printouts if os.sysconf is
 missing

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'
---
 compiler-rt/test/lit.common.cfg.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/compiler-rt/test/lit.common.cfg.py b/compiler-rt/test/lit.common.cfg.py
index ea22fb0babc46..62bee33b1fdb0 100644
--- a/compiler-rt/test/lit.common.cfg.py
+++ b/compiler-rt/test/lit.common.cfg.py
@@ -971,7 +971,7 @@ 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