This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by Lewuathe on Oct 6 2022, 12:10 AM.

Details

Summary

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

Diff Detail

Event Timeline

Lewuathe created this revision.Oct 6 2022, 12:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 6 2022, 12:10 AM
Lewuathe requested review of this revision.Oct 6 2022, 12:10 AM
Lewuathe edited the summary of this revision. (Show Details)Oct 6 2022, 12:12 AM
Lewuathe edited the summary of this revision. (Show Details)
Lewuathe edited the summary of this revision. (Show Details)Oct 6 2022, 12:14 AM
Lewuathe retitled this revision from [mlir] Fix test failure with older bash environment to [mlir] Fix test failure with invalid piping syntax on old bash.
Lewuathe edited the summary of this revision. (Show Details)
ftynse accepted this revision.Oct 6 2022, 1:32 AM
This revision is now accepted and ready to land.Oct 6 2022, 1:32 AM