[llvm] [AMDGPU][test] fix the error case in update_mc_test_check script (PR #112731)
Brox Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 18 09:29:23 PDT 2024
================
@@ -32,7 +31,20 @@ def invoke_tool(exe, cmd_args, testline, verbose=False):
cmd = 'echo "' + testline + '" | ' + exe + " " + args
if verbose:
print("Command: ", cmd)
- out = subprocess.check_output(cmd, shell=True)
+
+ # if not is used in runline, the command might or might not
+ # return non-zero code on a single line run
+ try:
+ out = subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL)
+ except:
+ if prefix_not:
+ cmd = 'echo "' + testline + '" | ' + "not " + exe + " " + args
+ if verbose:
+ print("Command: ", cmd)
+ out = subprocess.check_output(cmd, shell=True, stderr=subprocess.DEVNULL)
----------------
broxigarchen wrote:
Looks like we can not reuse the `out` from a try...except context. However, we might make it easier with another call `run`
https://github.com/llvm/llvm-project/pull/112731
More information about the llvm-commits
mailing list