Re: Test code review request
One more thing; I think it would make sense to add tests for the usage of "-s $localhost" since this was introduced in 5.8 e.g T184.. #!/bin/sh . ../support/simple_eval_tools.sh HEADER Agent uses clientaddr for trapsink source SKIPIF NETSNMP_DISABLE_SNMPV2C . ./S180trapaddrinfra INITV4 CONFIGAGENT trap2sink -s $localhost ${SNMP_TRANSPORT_SPEC}:${SNMP_TEST_DEST}${SNMP_SNMPTRAPD_PORT} public RUNTEST /Anders mån 17 sep. 2018 kl 06:50 skrev Anders Wallin : > Hi Bill, > > On Ubuntu using dash as default shell you get > # ./RUNFULLTESTS -g default -r T180 > Agent uses clientaddr for trapsink source .. > /root/net-snmp/testing/fulltests/support/simple_run: 21: [: unexpected > operator > Agent uses clientaddr for trapsink source .. ok > All tests successful. > Files=1, Tests=2, 1 wallclock secs ( 0.01 usr 0.00 sys + 0.02 cusr > 0.01 csys = 0.04 CPU) > Result: PASS > > Don't use bash specific "==", use single "=" instead to avoid this > printout. > > Use "$localhost" in T180 and T181 instead of fixed IP's > > (Patch appended) > > Regards > > Anders > > mån 17 sep. 2018 kl 03:31 skrev Bill Fenner : > >> On Sun, Sep 16, 2018 at 12:11 AM Bart Van Assche >> wrote: >> >>> On 09/13/18 10:55, Bill Fenner wrote: >>> > I wrote some tests for traps and clientaddr, since there were a bunch >>> of >>> > changes between 5.7 and 5.8 in this area. I did a couple of unusual >>> things: >>> > >>> > 1. I factored a ton of the test code out into a support file, >>> > S180trapaddrinfra, since the bulk of the tests were the same. >>> > 2. I created a little helper, "myip", which uses IO::Socket::IP. When >>> I >>> > pushed this to travis, I found out that IO::Socket::IP isn't >>> "normally" >>> > installed. Is it reasonable to make this a requirement, or should I >>> > rewrite the code to use IO::Socket::INET and IO::Socket::INET6? (In >>> my >>> > "normal" work area, IO::Socket::INET6 isn't installed, so it's not >>> clear >>> > that this is any better). >>> > >>> > I checked in the code at >>> > >>> https://github.com/fenner/net-snmp/commit/8572a9d54873f380a2388a354ee85f5eb531c875 >>> > >>> > Do these tests look ok to commit as-is or is there some better way to >>> > structure a group of similar tests like this? >>> >>> Is it possible to implement the Perl script such that it detects which >>> packages are available and uses the one that is available? >>> IO::Socket::INET and IO::Socket::INET6 are available on the AIX system I >>> have access to but IO::Socket::IP is not available on that system. On >>> the FreeBSD system I have access to IO::Socket::IP is available but none >>> of the other socket packages. I do not have sufficient rights to install >>> additional packages on these systems. >>> >> >> I ended up rewriting it to use just "Socket". The code is now: >> >> https://github.com/fenner/net-snmp/blob/V5-7-travis/testing/fulltests/support/myip >> >> so the IO::Socket::IP issue is resolved. >> >> Bill >> >> ___ >> Net-snmp-coders mailing list >> Net-snmp-coders@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/net-snmp-coders >> > ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: Test code review request
Hi Bill, On Ubuntu using dash as default shell you get # ./RUNFULLTESTS -g default -r T180 Agent uses clientaddr for trapsink source .. /root/net-snmp/testing/fulltests/support/simple_run: 21: [: unexpected operator Agent uses clientaddr for trapsink source .. ok All tests successful. Files=1, Tests=2, 1 wallclock secs ( 0.01 usr 0.00 sys + 0.02 cusr 0.01 csys = 0.04 CPU) Result: PASS Don't use bash specific "==", use single "=" instead to avoid this printout. Use "$localhost" in T180 and T181 instead of fixed IP's (Patch appended) Regards Anders mån 17 sep. 2018 kl 03:31 skrev Bill Fenner : > On Sun, Sep 16, 2018 at 12:11 AM Bart Van Assche > wrote: > >> On 09/13/18 10:55, Bill Fenner wrote: >> > I wrote some tests for traps and clientaddr, since there were a bunch >> of >> > changes between 5.7 and 5.8 in this area. I did a couple of unusual >> things: >> > >> > 1. I factored a ton of the test code out into a support file, >> > S180trapaddrinfra, since the bulk of the tests were the same. >> > 2. I created a little helper, "myip", which uses IO::Socket::IP. When >> I >> > pushed this to travis, I found out that IO::Socket::IP isn't "normally" >> > installed. Is it reasonable to make this a requirement, or should I >> > rewrite the code to use IO::Socket::INET and IO::Socket::INET6? (In my >> > "normal" work area, IO::Socket::INET6 isn't installed, so it's not >> clear >> > that this is any better). >> > >> > I checked in the code at >> > >> https://github.com/fenner/net-snmp/commit/8572a9d54873f380a2388a354ee85f5eb531c875 >> > >> > Do these tests look ok to commit as-is or is there some better way to >> > structure a group of similar tests like this? >> >> Is it possible to implement the Perl script such that it detects which >> packages are available and uses the one that is available? >> IO::Socket::INET and IO::Socket::INET6 are available on the AIX system I >> have access to but IO::Socket::IP is not available on that system. On >> the FreeBSD system I have access to IO::Socket::IP is available but none >> of the other socket packages. I do not have sufficient rights to install >> additional packages on these systems. >> > > I ended up rewriting it to use just "Socket". The code is now: > > https://github.com/fenner/net-snmp/blob/V5-7-travis/testing/fulltests/support/myip > > so the IO::Socket::IP issue is resolved. > > Bill > > ___ > Net-snmp-coders mailing list > Net-snmp-coders@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/net-snmp-coders > diff --git a/testing/fulltests/default/S180trapaddrinfra b/testing/fulltests/default/S180trapaddrinfra index 7632e33..4bc92ea 100644 --- a/testing/fulltests/default/S180trapaddrinfra +++ b/testing/fulltests/default/S180trapaddrinfra @@ -18,7 +18,7 @@ INIT() { SKIP "can not determine my IP" fi -if [ "$1" == "ipv6" ] +if [ "$1" = "ipv6" ] then SNMP_TEST_DEST="[${MYIP}]": else diff --git a/testing/fulltests/default/T180trap2sinkclientaddr_simple b/testing/fulltests/default/T180trap2sinkclientaddr_simple index 1d38da2..3ca942e 100644 --- a/testing/fulltests/default/T180trap2sinkclientaddr_simple +++ b/testing/fulltests/default/T180trap2sinkclientaddr_simple @@ -10,7 +10,7 @@ SKIPIF NETSNMP_DISABLE_SNMPV2C INITV4 -CONFIGAGENT "[snmp] clientaddr 127.0.0.1" +CONFIGAGENT "[snmp] clientaddr $localhost" CONFIGAGENT trap2sink ${SNMP_TRANSPORT_SPEC}:${SNMP_TEST_DEST}${SNMP_SNMPTRAPD_PORT} public RUNTEST diff --git a/testing/fulltests/default/T181trap2sinkclientaddr6_simple b/testing/fulltests/default/T181trap2sinkclientaddr6_simple index 94ccb16..8b27884 100644 --- a/testing/fulltests/default/T181trap2sinkclientaddr6_simple +++ b/testing/fulltests/default/T181trap2sinkclientaddr6_simple @@ -15,7 +15,7 @@ INITV6 # AGENT_FLAGS="$AGENT_FLAGS -DALL" -CONFIGAGENT "[snmp] clientaddr ::1" +CONFIGAGENT "[snmp] clientaddr $localhost" CONFIGAGENT trap2sink ${SNMP_TRANSPORT_SPEC}:${SNMP_TEST_DEST}${SNMP_SNMPTRAPD_PORT} public RUNTEST ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
Re: Test code review request
On Sun, Sep 16, 2018 at 12:11 AM Bart Van Assche wrote: > On 09/13/18 10:55, Bill Fenner wrote: > > I wrote some tests for traps and clientaddr, since there were a bunch of > > changes between 5.7 and 5.8 in this area. I did a couple of unusual > things: > > > > 1. I factored a ton of the test code out into a support file, > > S180trapaddrinfra, since the bulk of the tests were the same. > > 2. I created a little helper, "myip", which uses IO::Socket::IP. When I > > pushed this to travis, I found out that IO::Socket::IP isn't "normally" > > installed. Is it reasonable to make this a requirement, or should I > > rewrite the code to use IO::Socket::INET and IO::Socket::INET6? (In my > > "normal" work area, IO::Socket::INET6 isn't installed, so it's not clear > > that this is any better). > > > > I checked in the code at > > > https://github.com/fenner/net-snmp/commit/8572a9d54873f380a2388a354ee85f5eb531c875 > > > > Do these tests look ok to commit as-is or is there some better way to > > structure a group of similar tests like this? > > Is it possible to implement the Perl script such that it detects which > packages are available and uses the one that is available? > IO::Socket::INET and IO::Socket::INET6 are available on the AIX system I > have access to but IO::Socket::IP is not available on that system. On > the FreeBSD system I have access to IO::Socket::IP is available but none > of the other socket packages. I do not have sufficient rights to install > additional packages on these systems. > I ended up rewriting it to use just "Socket". The code is now: https://github.com/fenner/net-snmp/blob/V5-7-travis/testing/fulltests/support/myip so the IO::Socket::IP issue is resolved. Bill ___ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders