On Sat, Jan 8, 2011 at 9:35 PM, Paul Goyette <paul%whooppee.com@localhost>
wrote:
I've got a helper program that I want to invoke multiple times for a single
test case:
atf_test_case empty
empty_head()
{
atf_set "descr" "Testing empty name"
}
empty_body()
{
atf_check 'empty_tests' 0 ${files}empty.exp null
}
empty_tests()
{
$TEST ::1 ''
$TEST 127.0.0.1 ''
$TEST localhost ''
$TEST '' ''
}
So, the "command" that I want to pass to atf-check(1) is actually a shell
function.
As expected, this does not work. I thought of using atf-check directly, and
specifying -x, but that would start another shell to execute the command.
Is there a sane way to do this?
What I have done sometimes is to write the script out to a temporary
file and then run it. It is ugly, specially because with
here-documents it is not nice to type shell scripts, but does the job.
I have also just put such auxiliary scripts in their own files.
Could you maybe rework your auxiliary function to do the atf_check
calls by itself? (The sample code above does not really provide
enough detail on what you are trying to accomplish.) I've also
sometimes generated test cases on-the-fly by means of eval; see the
ipf tests.