[llvm] [llvm-lit] Resolve env subcommand required error (PR #98414)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 10 16:29:02 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-testing-tools
Author: None (Harini0924)
<details>
<summary>Changes</summary>
When executing not --crash env in lit's internal shell without any arguments, it fails with exit code 127 because env requires a subcommand. This patch addresses the issue by encoding the command to properly return environment variables even when no arguments are provided.
---
Full diff: https://github.com/llvm/llvm-project/pull/98414.diff
1 Files Affected:
- (modified) llvm/utils/lit/lit/TestRunner.py (+2-1)
``````````diff
diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py
index da7fa86fd3917..8f0cd801ae9ff 100644
--- a/llvm/utils/lit/lit/TestRunner.py
+++ b/llvm/utils/lit/lit/TestRunner.py
@@ -743,7 +743,8 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
cmd_shenv = ShellEnvironment(shenv.cwd, shenv.env)
args = updateEnv(cmd_shenv, args)
if not args:
- raise InternalShellError(j, "Error: 'env' requires a" " subcommand")
+ # Return the environment variables if no argument is provided
+ return {key: value for key, value in cmd_shenv.env.items()}
elif args[0] == "not":
not_args.append(args.pop(0))
not_count += 1
``````````
</details>
https://github.com/llvm/llvm-project/pull/98414
More information about the llvm-commits
mailing list