xref: /llvm-project/mlir/test/mlir-reduce/failure-test.sh (revision 5957e90c4ed332046d7461366fd579c268553939)
1#!/bin/sh
2
3# Create temporary files that are automatically deleted after the script's
4# execution.
5stdout_file=$(mktemp /tmp/stdout.XXXXXX)
6stderr_file=$(mktemp /tmp/stderr.XXXXXX)
7
8# Tests for the keyword "failure" in the stderr of the optimization pass
9mlir-opt $1 -test-mlir-reducer > $stdout_file 2> $stderr_file
10
11if [ $? -ne 0 ] && grep 'failure' $stderr_file; then
12  exit 1
13  #Interesting behavior
14else
15  exit 0
16fi
17