Skip to content

Commit 5957e90

Browse files
committed
[mlir-reduce] Create proper tmp test files (NFC)
This commit ensures that the sh script creates temporary files with mktmp to ensure they do not collide with existing files. The previous behaviour caused sporadic permission issues on a multi-user system. Reviewed By: gysit Differential Revision: https://reviews.llvm.org/D145054
1 parent 86b8abc commit 5957e90

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

mlir/test/mlir-reduce/failure-test.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
#!/bin/sh
2+
3+
# Create temporary files that are automatically deleted after the script's
4+
# execution.
5+
stdout_file=$(mktemp /tmp/stdout.XXXXXX)
6+
stderr_file=$(mktemp /tmp/stderr.XXXXXX)
7+
28
# Tests for the keyword "failure" in the stderr of the optimization pass
3-
mlir-opt $1 -test-mlir-reducer > /tmp/stdout.$$ 2>/tmp/stderr.$$
9+
mlir-opt $1 -test-mlir-reducer > $stdout_file 2> $stderr_file
410

5-
if [ $? -ne 0 ] && grep 'failure' /tmp/stderr.$$; then
11+
if [ $? -ne 0 ] && grep 'failure' $stderr_file; then
612
exit 1
713
#Interesting behavior
814
else

0 commit comments

Comments
 (0)