freebsd / kyua

Testing framework for infrastructure software
BSD 3-Clause "New" or "Revised" License
147 stars 42 forks source link

Testcase grok'ing with kyua list/kyua test breaks if something prints to stderr in atf_init_test_cases #149

Closed ngie-eign closed 8 years ago

ngie-eign commented 8 years ago

I am integrating lib/libarchive/tests into the FreeBSD test suite and discovered that the "Unrecognized option" message printed to the stderr was breaking atf_init_test_cases for kyua list and kyua test.

Once I redirected stderr to stdout, the test script became functional with kyua list/kyua test.

Something like this should repro the issue:

atf_test_case a
a_body() {
    true
}
atf_init_test_cases()
{
    echo "hello world" >&2
    atf_add_test_case a
}
jmmv commented 8 years ago

You cannot do anything in atf_init_test_cases other than register test programs. In particular, printing stuff to stdout/stderr is going to mess things up, because it's going to collide with the output of the test cases listing retrieved via -l. That's how the interface of ATF test programs is defined.