Source-Changes-D archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: CVS commit: src/sbin/ifconfig
On Sun, Mar 18, 2012 at 11:57:08PM +0900, Julio Merino wrote:
> >But why is stderr being involved?
>
> If you really want to ignore stderr in the test, pass "-e ignore" to
> atf_check. The default is "-o empty -e empty".
>
> Now, the question is: do you really want to ignore the message, or do
> you want to validate that the appropriate error message is printed? If
> the later (which should be the preferred way), "-e inline:'foo bar\n'"
> or "-e match:'foo bar'" or "-e file:experr" (with experr being
> pre-populated with the expected message) will do the job.
Thanks; this was pointed out already.
But I have a related question. Supposedly ATF uses something like freopen(3)
to capture the output in the standard streams. Now consider this from one
test I just added:
$ find /etc -type f -exit
$ echo $?
0
All good; exited without nothing printed to stderr and the status is zero.
But this:
atf_check -o ignore \
-s exit:0 -x "find /etc -type f -exit"
yields
tc-so:Executing command [ /bin/sh -c find /etc -type f -exit ]
tc-se:Fail: incorrect exit status: 1, expected: 0
tc-se:stdout:
tc-se:
tc-se:stderr:
tc-se:find: fts_read: Inappropriate ioctl for device
tc-se:
tc-end: 1332083101.965143, exit, failed, atf-check failed;
see the output of the test for details
So what is going on here? Likewise
$ find / -exit 99
$ echo $?
99
contra
atf_check -o ignore -e ignore -s exit:99 -x "find / -exit 99"
and
tc-so:Executing command [ /bin/sh -c find / -exit 99 ]
tc-se:Fail: incorrect exit status: 1, expected: 99
tc-se:stdout:
tc-se:
tc-se:stderr:
tc-se:find: fts_read: Inappropriate ioctl for device
tc-se:
tc-end: 1332083172.374247, exit_status, failed, atf-check failed;
see the output of the test for details
- Jukka.
Home |
Main Index |
Thread Index |
Old Index