[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:01:36 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:

Let me try this. If we can reuse the output from the non-zero run, then yeah I think we can save one call here

https://github.com/llvm/llvm-project/pull/112731


More information about the llvm-commits mailing list