[llvm-commits] [llvm] r111440 - /llvm/trunk/test/Other/close-stderr.ll

Daniel Dunbar daniel at zuster.org
Thu Aug 19 18:37:50 PDT 2010


On Thu, Aug 19, 2010 at 6:25 PM, Dan Gohman <gohman at apple.com> wrote:
> What kind of unit test would you suggest? This kind of test
> doesn't seem to fit easily into the main harnesses.

I may not understand what the problem was, but I thought something like:
---
void f0() {
  close(2);
  llvm::errs() << "ok";
}
--
would be enough to reproduce the problem?

 - Daniel

>
> Dan
>
> On Aug 19, 2010, at 10:14 AM, Daniel Dunbar wrote:
>
>> Hi Dan,
>>
>> Can you rewrite this as a unit test instead?
>>
>> - Daniel
>>
>> On Wed, Aug 18, 2010 at 3:35 PM, Dan Gohman <gohman at apple.com> wrote:
>>> Author: djg
>>> Date: Wed Aug 18 17:35:56 2010
>>> New Revision: 111440
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=111440&view=rev
>>> Log:
>>> Add a testcase to verify that commands don't crash when they hit
>>> errors on stderr.
>>>
>>> Added:
>>>    llvm/trunk/test/Other/close-stderr.ll
>>>
>>> Added: llvm/trunk/test/Other/close-stderr.ll
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Other/close-stderr.ll?rev=111440&view=auto
>>> ==============================================================================
>>> --- llvm/trunk/test/Other/close-stderr.ll (added)
>>> +++ llvm/trunk/test/Other/close-stderr.ll Wed Aug 18 17:35:56 2010
>>> @@ -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.
>
>




More information about the llvm-commits mailing list