On Sep 28, 2014, at 11:19, Craig Rodrigues <
rod...@freebsd.org> wrote:
> On Sun, Sep 28, 2014 at 8:30 AM, Julio Merino <
jm...@meroh.net> wrote:
>
> I think my current work on improving the test case execution code will
> fix this in a better way, but I'm not completely sure yet. Need to
> think a bit more.
>
>
> I think we need this. I tried putting this inside ATF:
>
> atf_init_test_cases()
> {
> echo "${Prog_Name}: ERROR: ${@}" 1>&2
> echo "${Prog_Name}: atf_init_test_cases() not defined in test case." 1>&2
> echo "${Prog_Name}: See atf-sh-api(3) for more details." 1>&2
> exit 1
> }
I think that you’re right — it should have a meaningful message.
Maybe something like…?
atf_init_test_cases()
{
echo "${Prog_Name}: ERROR: ${@}" 1>&2
echo "${Prog_Name}: atf_init_test_cases() not defined in test script (no testcases)." 1>&2
echo "${Prog_Name}: See atf-sh-api(3) for more details." 1>&2
exit 1
}
> If I ran the testcase directly, that error message displayed. But
> if I ran "kyua list", it did not.
>
> Here are some things you might want to test as you implement better error
> reporting:
> -> atf_init_test_cases() is not there
> -> test_head() or test_body() are not there for a certain test case
test_body() is important; test_head should be omitted (but having a debug message in the logs reporting it “missing” would be a good idea), if need be to have functional parity with the C/C++ APIs.
> -> atf_init_test_cases(), test_head(), test_body() are there, but
> they have an 'exit' or 'return' statement where they shouldn’t
Overriding exit/return might be
> I tripped over some of these things when writing an initial ATF testcase,
> and it was hard to figure out what was wrong.
Thanks for the input!
-Garrett