home | codereading | contact | math | misc | patches | tech


ATF (NetBSD's Automated Testing Framework) notes

Troubleshooting

Unexpected token \`tp-end'; expected start of test case

When running your test, you can receive the error above. The complete error is:

atf-report: ERROR: 313: Unexpected token `tp-end'; expected start of test case
atf-report:
atf-report: 314: Unexpected token `info'; expected start of test case

Not very informative, uhm? (Running ATF of NetBSD 5.1 at this times). Let's run only atf-run and see if we find more:

tc-se:Illegal option -T
tc-se:usage: findx [-0ifdx] [-m maxdepth] [glob]__atf_tc_separator__
tc-se:[: file: bad number
tc-se:[: -a: bad number
tc-se:[: -a: bad number
tc-se:[: file: bad number
tc-end: paramtest, failed, Bogus test program
tp-end: t_findx.sh, There were errors parsing the output of the test program: Line 0: Missing terminators in stdout or stderr.

This is the test program of my findx script. It was working before! After some thinking, I realized a strange error in findx usage of the last output message. There is the __atf_tc_separator__ thing there.

So I realized I was echo'ing stuff out to the screen using printf(1) not echo(1) because of echo limitations (see shx_echo function and commentary in the shx_string.sh code). printf by default doesn't print newlines and, for some reason, ATF seems to use newlines as control characters. That is why it was failing and messing up everything later.

I them created the shx_echoln to replace system echo where necessary.

Failed: Test case did not report any status; bogus test

This error is cryptic and can have different causes. In my case it was a syntax problem in the shell script being tested (not in the test file) that came out because of a string wrongly quoted being eval'ed. Check syntax of files being tested.