Date: Sat, 26 Jul 2014 13:30:19 +0200 From: Fabian Keil <freebsd-listen@fabiankeil.de> To: <freebsd-testing@freebsd.org> Subject: atf_check() equivalent to test individual shell functions? Message-ID: <41d8a2fb.75b47028@fabiankeil.de>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Here's another zogftw-related problem. Putting something like this in a test case works as expected: | atf_check -s exit:0 -o empty -e empty $ZOGFTW cmd zogftw_string_ends_with "abc" "c" It would be preferably to source zogftw once at the beginning and call the shell function zogftw_string_ends_with() directly afterwards to reduce the overhead, though. The following sort of does this, but the stdout and stderr output isn't verified, it's tedious to write and if nothing fails, the "kyua debug" output isn't particular useful: | . $ZOGFTW source || atf_fail "Failed to source zogftw" | | if ! zogftw_string_ends_with "abc" "c"; then | atf_fail "Failed to find 'c' at the end of 'abc'" | fi The following also sort of works, but in case of errors the output isn't helpful (because atf_check_equal() doesn't see the actual function) and the stderr output isn't verified either: | . $ZOGFTW source || atf_fail "Failed to source zogftw" | | atf_check_equal $(zogftw_string_ends_with "abc" "c"; echo $?) "0" What I'm looking for is something like this: | atf_check_shell_function -s return:0 -o empty -e empty zogftw_string_ends_with "abc" "c" atf-sh-api(3) doesn't seem to mention anything like it, so I'm wondering how other people are testing individual shell functions? Fabian [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAlPTkUsACgkQBYqIVf93VJ0OgwCfbyxvQkkb85gHu4P/JexXBh2f kpUAoJN0FD32/2QTWPGNUoTw8gYtvprB =qBaI -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41d8a2fb.75b47028>
