summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Other/close-stderr.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Other/close-stderr.ll b/test/Other/close-stderr.ll
new file mode 100644
index 0000000000..ced32a8be3
--- /dev/null
+++ b/test/Other/close-stderr.ll
@@ -0,0 +1,9 @@
+; RUN: sh -c "\
+; RUN: opt --reject-this-option 2>&-; echo $?; \
+; RUN: opt -o /dev/null /dev/null 2>&-; echo $?; \
+; RUN: " | FileCheck %s
+; CHECK: {{^1$}}
+; CHECK: {{^0$}}
+
+; Test that the error handling when writing to stderr fails exits the
+; program cleanly rather than aborting.