[Mlir-commits] [mlir] b03f439 - [mlir] Fix test failure with invalid piping syntax on old bash

Kai Sasaki llvmlistbot at llvm.org
Thu Oct 6 17:39:06 PDT 2022


Author: Kai Sasaki
Date: 2022-10-07T09:29:49+09:00
New Revision: b03f4396116e2450dc5237ea7050751e80cd7dd5

URL: https://github.com/llvm/llvm-project/commit/b03f4396116e2450dc5237ea7050751e80cd7dd5
DIFF: https://github.com/llvm/llvm-project/commit/b03f4396116e2450dc5237ea7050751e80cd7dd5.diff

LOG: [mlir] Fix test failure with invalid piping syntax on old bash

Using '|&' syntax for piping both stdout and stderr is not supported by older bash. macOS pre-installs 3.2.57 as of today, and it causes test failure due to unexpected token '&'. We can use '2>&1' instead to make it compatible as much as possible.

```
******************** TEST 'MLIR :: mlir-cpu-runner/invalid.mlir' FAILED ********************
Script:
--
: 'RUN: at line 1';   not mlir-cpu-runner --no-implicit-module llvm-project/mlir/test/mlir-cpu-runner/invalid.mlir |& llvm-project/build/bin/FileCheck llvm-project/mlir/test/mlir-cpu-runner/invalid.mlir
--
Exit Code: 2

Command Output (stderr):
--
mlir-cpu-runner/Output/invalid.mlir.script: line 1: syntax error near unexpected token `&'
/mlir-cpu-runner/Output/invalid.mlir.script: line 1: `set -o pipefail;{ : 'RUN: at line 1';   not mlir-cpu-runner --no-implicit-module llvm-project/mlir/test/mlir-cpu-runner/invalid.mlir |& llvm-project/build/bin/FileCheck llvm-project/mlir/test/mlir-cpu-runner/invalid.mlir; }'
```

Reference: https://stackoverflow.com/questions/35384999/what-does-mean-in-bash

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D135347

Added: 
    

Modified: 
    mlir/test/mlir-cpu-runner/invalid.mlir
    mlir/test/mlir-reduce/invalid.mlir

Removed: 
    


################################################################################
diff  --git a/mlir/test/mlir-cpu-runner/invalid.mlir b/mlir/test/mlir-cpu-runner/invalid.mlir
index 74bfbb7590b4d..de3ef076480ce 100644
--- a/mlir/test/mlir-cpu-runner/invalid.mlir
+++ b/mlir/test/mlir-cpu-runner/invalid.mlir
@@ -1,4 +1,4 @@
-// RUN: not mlir-cpu-runner --no-implicit-module %s |& FileCheck %s
+// RUN: not mlir-cpu-runner --no-implicit-module %s 2>&1 | FileCheck %s
 
 // CHECK: Error: top-level op must be a symbol table.
 llvm.func @main()

diff  --git a/mlir/test/mlir-reduce/invalid.mlir b/mlir/test/mlir-reduce/invalid.mlir
index 3045cb0375c04..88544bfa21519 100644
--- a/mlir/test/mlir-reduce/invalid.mlir
+++ b/mlir/test/mlir-reduce/invalid.mlir
@@ -1,6 +1,6 @@
 // UNSUPPORTED: system-windows
-// RUN: not mlir-reduce -opt-reduction-pass --no-implicit-module %s |& FileCheck %s --check-prefix=CHECK-PASS
-// RUN: not mlir-reduce -reduction-tree --no-implicit-module %s |& FileCheck %s --check-prefix=CHECK-TREE
+// RUN: not mlir-reduce -opt-reduction-pass --no-implicit-module %s 2>&1 | FileCheck %s --check-prefix=CHECK-PASS
+// RUN: not mlir-reduce -reduction-tree --no-implicit-module %s 2>&1 | FileCheck %s --check-prefix=CHECK-TREE
 
 // The reduction passes are currently restricted to 'builtin.module'.
 // CHECK-PASS: error: Can't add pass '{{.+}}' restricted to 'builtin.module' on a PassManager intended to run on 'func.func'


        


More information about the Mlir-commits mailing list