Skip to content

Conversation

@mstorsjo
Copy link
Member

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'

@mstorsjo mstorsjo requested review from fmayer and pcc November 20, 2025 11:15
@github-actions
Copy link

github-actions bot commented Nov 20, 2025

🐧 Linux x64 Test Results

  • 5820 tests passed
  • 1323 tests skipped

@fmayer
Copy link
Contributor

fmayer commented Nov 24, 2025

Wouldn't it be better to just fix the offending script to not use sysconf on Windows?

@mstorsjo
Copy link
Member Author

Wouldn't it be better to just fix the offending script to not use sysconf on Windows?

I guess that could work as well, although the script being inline in the proc.communicate(b'import os; print(os.sysconf("SC_PAGESIZE"))'), so adding conditionals in that makes it a bit more messy (do conditionals work in such indentation-free python?).

@fmayer
Copy link
Contributor

fmayer commented Nov 24, 2025

proc.communicate(b'import os; print(os.sysconf("SC_PAGESIZE"))

how about this?

% python -c 'import os; print(os.sysconf("SC_PAGESIZE") if hasattr(os, "sysconf") else "")'
4096

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'
@mstorsjo mstorsjo force-pushed the compiler-rt-test-sysconf branch from 18c7fc6 to 52d9d82 Compare November 24, 2025 21:16
@mstorsjo
Copy link
Member Author

proc.communicate(b'import os; print(os.sysconf("SC_PAGESIZE"))

how about this?

% python -c 'import os; print(os.sysconf("SC_PAGESIZE") if hasattr(os, "sysconf") else "")'
4096

Thanks, that seems to work! I've updated the PR with that.

@mstorsjo mstorsjo changed the title [compiler-rt] [test] Consume stderr from the subprocess for getting page size [compiler-rt] [test] Avoid error printouts if os.sysconf is missing Nov 24, 2025
@github-actions
Copy link

github-actions bot commented Nov 24, 2025

✅ With the latest revision this PR passed the Python code formatter.

Copy link
Contributor

@fmayer fmayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I like that much better

please fix formatting

@mstorsjo mstorsjo merged commit 1e1974a into llvm:main Nov 24, 2025
10 checks passed
@mstorsjo mstorsjo deleted the compiler-rt-test-sysconf branch November 24, 2025 21:51
aadeshps-mcw pushed a commit to aadeshps-mcw/llvm-project that referenced this pull request Nov 26, 2025
…lvm#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 <[email protected]>
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.

3 participants