[llvm] [AIX] Re-apply: Remove unsupported AIX native echo option -n by using printf (PR #199395)
via llvm-commits
llvm-commits at lists.llvm.org
Sat May 23 22:00:09 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: Himadhith
<details>
<summary>Changes</summary>
AIX native echo doesn't support the `-n` flag.
Use `printf` instead to ensure the test works across all systems and making it portable.
The current test fails as follows:
```
FAIL: lit :: unit/Util.py (1 of 1)
******************** TEST 'lit :: unit/Util.py' FAILED ********************
Exit Code: 1
Command Output (stdout):
--
# RUN: at line 1
"/opt/freeware/bin/python3.12" /home/himadhit/llvm/community/build/utils/lit/tests/unit/Util.py
# executed command: /opt/freeware/bin/python3.12 /home/himadhit/llvm/community/build/utils/lit/tests/unit/Util.py
# .---command stderr------------
# | F..
# | ======================================================================
# | FAIL: test_basic (__main__.TestCommandCache.test_basic)
# | ----------------------------------------------------------------------
# | Traceback (most recent call last):
# | File "/home/himadhit/llvm/community/build/utils/lit/tests/unit/Util.py", line 32, in test_basic
# | self.assertEqual(lit_config.run_command_cached(["echo", "-n", "hi"]), b"hi")
# | AssertionError: b'-n hi\n' != b'hi'
# |
# | ----------------------------------------------------------------------
# | Ran 3 tests in 2.092s
# |
# | FAILED (failures=1)
# `-----------------------------
# error: command failed with exit status: 1
```
---
Full diff: https://github.com/llvm/llvm-project/pull/199395.diff
1 Files Affected:
- (modified) llvm/utils/lit/tests/unit/Util.py (+2-2)
``````````diff
diff --git a/llvm/utils/lit/tests/unit/Util.py b/llvm/utils/lit/tests/unit/Util.py
index 794950f44ef19..112ea59b869f5 100644
--- a/llvm/utils/lit/tests/unit/Util.py
+++ b/llvm/utils/lit/tests/unit/Util.py
@@ -29,12 +29,12 @@ def _lit_config():
def test_basic(self):
lit_config = self._lit_config()
- self.assertEqual(lit_config.run_command_cached(["echo", "-n", "hi"]), b"hi")
+ self.assertEqual(lit_config.run_command_cached(["printf", "hi"]), b"hi")
self.assertNotEqual(lit_config.run_command_cached("ls"), None)
# Test that arguments (e.g. text=True) get forwarded to subprocess.run
self.assertEqual(
- lit_config.run_command_cached(["echo", "-n", "hi"], text=True), "hi"
+ lit_config.run_command_cached(["printf", "hi"], text=True), "hi"
)
# shell=True is not implied
``````````
</details>
https://github.com/llvm/llvm-project/pull/199395
More information about the llvm-commits
mailing list