[Nagiosplug-devel] Preparation for release 1.4.11

Ton Voon ton.voon at altinity.com
Wed Dec 12 00:40:30 CET 2007


On 11 Dec 2007, at 21:12, Andreas Ericsson wrote:

> In short though, it works like this:
>
> --%<---%<---%<---
> . test-lib.sh
> test_description 'A simple test for sed'
>
> test_expect_success 'Test single char substitution' \
> '
> 	var=$(echo foo | sed s/f//)
> 	test "$var" = "oo"
> '
>
> test_done
> ---%<---%<---%<---
>
> Which would produce the following output
>
> *   ok 1: Test single char substitution
> * passed all 1 test(s)
>
> with the last line printed in green when all tests pass, and in red
> when any of them fail.


You just described something exceedingly similar to perl's Test  
Anything Protocol (http://en.wikipedia.org/wiki/Test_Anything_Protocol  
and http://search.cpan.org/dist/TAP-1.00/TAP.pm).

However, annoyingly, it looks like git's test system doesn't exactly  
use TAP format, which means it now cannot hook into Test::Harness (http://search.cpan.org/dist/Test-Harness-3.05/lib/Test/Harness.pm 
).

I can see a place for running shell commands instead of via perl  
(which is only just invoking executables anyway), but which shell do  
you program against? Assuming sh is going to be too restrictive. In  
fact, perl was designed to be a cross platform shell! So it makes  
sense to stick with that.

If you think a tutorial is required for understanding the plugins'  
test system, then say that - I can see there is probably a hole in  
this regard: http://nagiosplugins.org/node/12.

Ton

http://www.altinity.com
UK: +44 (0)870 787 9243
US: +1 866 879 9184
Fax: +44 (0)845 280 1725
Skype: tonvoon





More information about the Devel mailing list