Message ID | 20180406123118.21309-1-pvorel@suse.cz |
---|---|
Headers | show |
Series | Rewriting network tests into new shell API | expand |
On 04/06/2018 03:31 PM, Petr Vorel wrote: > Hi, > > Hopefully last version. > > I migrated only 10 scripts out of many (at least 89) using tst_net.sh or libraries using > it (at least ipsec_lib.sh, tst_net_stress.sh), but the rest should be quite easy. >> I spent some time with fixing dependencies for interface stress tests. > I also fighted with getopts being passed to tst_net.sh and for other scripts > I needed keep -6 for tst_net.sh, the rest is for scripts using > tst_net.sh - tests themselves, "libraries" being called by scripts - > tcp_fastopen_run.sh, vxlan03.sh and testscripts/network.sh). > Sometimes tst_net.sh is loaded 3 times. Hi Petr, three times... does it happen after these patches? It's sourced by the helper to export the environment variables and export the variables that are not yet set, so once here. And each of the tests sources it once as well... > > For further development I'd like to move network setup from > testscripts/network.sh to tst_net.sh to function tst_net_run(). This > would allow to run tests with runltp (and keep our > testscripts/network.sh helper). That would reduce one user of > tst_net.sh. > Another benefit I see to have unique way to run script (one day there > might be runltp replaced by better implementation and I don't want > network scripts to be missing it). > This helper is really optional, I'm not quite follow you here, what is the purpose of moving it's setup to tst_net_run()? The tests run fine without the helper, and with runltp as well. For netns and runltp, each test-case flushes interfaces and waits for completion of DAD process, I think we could remove this latency by: * checking that interface already has the needed configuration, no need to flush and re-add anything, check that there is no xfrm policy, etc. * may be save temp configuration in a file on the first test-case run and source it for the next test-cases * pass nodad when setting IPv6 addresses Thanks, Alexey > You can test it with testscripts/network.sh, testing with netns doesn't require > any additional setup. Examples: > /opt/ltp/testscripts/network.sh -e > /opt/ltp/testscripts/network.sh -6 > > Help: > /opt/ltp/testscripts/network.sh -h > > Changelog v5->v6: > * Fix bashism in v5 when passing parameters to tst_net.sh. > https://lists.linux.it/pipermail/ltp/2018-April/007619.html > * Fixed missing $ipver in multicast tests. > * Fixed broken creating tmpdir on rhost in new API. > > Changelog v4->v5: > * Fix handling getopts parameters in scripts which are using legacy API > with getopts (ipsec_lib.sh, tcp_fastopen_run.sh, rpc_test.sh) by > shifting args after getopts and moving sourcing tst_net.sh after that. > Also -6 param for IPv6 must be passed to tst_net.sh (ipsec_lib.sh, > tcp_fastopen_run.sh). > * Fixed iver for legacy scripts (caused some bugs at least in interfaces > tests). > > Changes v3->v4: > * Fixed bugs with setting TST_IPV6 and ipver variables. Now added into > setup function (for new API they must not be used in test scripts > outside setup/run/cleanup functions as they're not set). > * New commit: 6/6 "network/interface: Split tests to test only one command per test" > A bit complicated than I thought (adding tst_test_cmds and using it > would be simpler), but I guess separation is better (as Cyril noted). > I needed to pass -c as getopts parameter. > * Renamed functions in tst_net.sh (Alexey). > * Fixed script name in Makefile, changed output of usage (Alexey). > * Export TST_ID, LTPROOT and TST_DATAROOT also for TST_NO_DEFAULT_RUN > (Cyril). > > Petr Vorel (7): > tst_net.sh: Support both new and legacy APIs + rename > tst_test.sh: Introduce TST_NO_DEFAULT_RUN > network.sh: Migrate to new shell API > network/interface: Cleanup if4-addr-change > network/if-updown: Restore IP in cleanup function > tst_net_stress.sh: Migrate with dependencies to new API + rename > network/interface: Split tests to test only one command per test > > runtest/net_stress.interface | 38 +++-- > testcases/lib/{test_net.sh => tst_net.sh} | 165 ++++++++++++++------- > testcases/lib/tst_test.sh | 91 ++++++------ > testcases/network/README.md | 4 +- > testcases/network/busy_poll/busy_poll01.sh | 3 +- > testcases/network/busy_poll/busy_poll02.sh | 3 +- > testcases/network/busy_poll/busy_poll03.sh | 3 +- > testcases/network/dccp/dccp01.sh | 3 +- > testcases/network/dctcp/dctcp01.sh | 3 +- > testcases/network/dhcp/dhcpd_tests.sh | 3 +- > testcases/network/dhcp/dnsmasq_tests.sh | 3 +- > testcases/network/iproute/ip_tests.sh | 3 +- > testcases/network/multicast/mc_cmds/mc_cmds | 3 +- > testcases/network/multicast/mc_commo/mc_commo | 3 +- > testcases/network/multicast/mc_member/mc_member | 3 +- > testcases/network/multicast/mc_opts/mc_opts | 3 +- > testcases/network/nfs/fsx-linux/fsx.sh | 3 +- > testcases/network/nfs/nfs_stress/nfs01 | 3 +- > testcases/network/nfs/nfs_stress/nfs02 | 3 +- > testcases/network/nfs/nfs_stress/nfs03 | 3 +- > testcases/network/nfs/nfs_stress/nfs04 | 3 +- > testcases/network/nfs/nfs_stress/nfs05 | 3 +- > testcases/network/nfs/nfs_stress/nfs06 | 3 +- > testcases/network/nfs/nfslock01/nfslock01 | 3 +- > testcases/network/nfs/nfsstat01/nfsstat01 | 3 +- > testcases/network/rpc/basic_tests/rpc01/rpc01 | 3 +- > .../network/rpc/basic_tests/rpcinfo/rpcinfo01 | 3 +- > testcases/network/rpc/basic_tests/rup/rup01 | 3 +- > testcases/network/rpc/basic_tests/rusers/rusers01 | 3 +- > testcases/network/rpc/rpc-tirpc/rpc_test.sh | 4 +- > testcases/network/sctp/sctp01.sh | 3 +- > testcases/network/sockets/bind_noport01.sh | 3 +- > .../network/stress/broken_ip/broken_ip4-checksum | 3 +- > .../network/stress/broken_ip/broken_ip4-dstaddr | 3 +- > .../network/stress/broken_ip/broken_ip4-fragment | 3 +- > testcases/network/stress/broken_ip/broken_ip4-ihl | 3 +- > .../network/stress/broken_ip/broken_ip4-protcol | 3 +- > .../network/stress/broken_ip/broken_ip4-totlen | 3 +- > .../network/stress/broken_ip/broken_ip4-version | 3 +- > .../network/stress/broken_ip/broken_ip6-dstaddr | 3 +- > .../network/stress/broken_ip/broken_ip6-nexthdr | 3 +- > testcases/network/stress/broken_ip/broken_ip6-plen | 3 +- > .../network/stress/broken_ip/broken_ip6-version | 3 +- > testcases/network/stress/dns/dns-stress | 3 +- > testcases/network/stress/ftp/ftp-download-stress | 3 +- > testcases/network/stress/ftp/ftp-upload-stress | 3 +- > testcases/network/stress/http/http-stress | 3 +- > testcases/network/stress/interface/if-addr-adddel | 52 +++---- > .../network/stress/interface/if-addr-addlarge | 57 +++---- > testcases/network/stress/interface/if-lib.sh | 58 ++++++++ > testcases/network/stress/interface/if-mtu-change | 52 +++---- > testcases/network/stress/interface/if-route-adddel | 55 +++---- > .../network/stress/interface/if-route-addlarge | 51 ++----- > testcases/network/stress/interface/if-updown | 49 +++--- > testcases/network/stress/interface/if4-addr-change | 71 ++++----- > testcases/network/stress/ipsec/ipsec_lib.sh | 9 +- > .../grp-operation/mcast-group-multiple-socket | 16 +- > .../multicast/grp-operation/mcast-group-same-group | 17 ++- > .../grp-operation/mcast-group-single-socket | 17 ++- > .../grp-operation/mcast-group-source-filter | 17 ++- > .../stress/multicast/grp-operation/mcast-lib.sh | 29 ++-- > testcases/network/stress/ns-tools/Makefile | 2 +- > .../{test_net_stress.sh => tst_net_stress.sh} | 32 ++-- > testcases/network/stress/ssh/ssh-stress | 3 +- > testcases/network/tcp_cmds/arping/arping01.sh | 3 +- > .../network/tcp_cmds/clockdiff/clockdiff01.sh | 3 +- > testcases/network/tcp_cmds/ipneigh/ipneigh01.sh | 3 +- > testcases/network/tcp_cmds/ping/ping01.sh | 3 +- > testcases/network/tcp_cmds/ping/ping02.sh | 3 +- > testcases/network/tcp_cmds/rlogin/rlogin01 | 3 +- > testcases/network/tcp_cmds/sendfile/sendfile01 | 3 +- > testcases/network/tcp_cmds/tcpdump/tcpdump01 | 3 +- > testcases/network/tcp_cmds/telnet/telnet01 | 3 +- > .../network/tcp_cmds/tracepath/tracepath01.sh | 3 +- > testcases/network/tcp_fastopen/tcp_fastopen_run.sh | 16 +- > testcases/network/traceroute/traceroute01.sh | 3 +- > testcases/network/virt/geneve01.sh | 3 +- > testcases/network/virt/gre01.sh | 3 +- > testcases/network/virt/ipvlan01.sh | 3 +- > testcases/network/virt/macvlan01.sh | 3 +- > testcases/network/virt/macvtap01.sh | 3 +- > testcases/network/virt/vlan01.sh | 3 +- > testcases/network/virt/vlan02.sh | 3 +- > testcases/network/virt/vlan03.sh | 3 +- > testcases/network/virt/vxlan01.sh | 3 +- > testcases/network/virt/vxlan02.sh | 3 +- > testcases/network/virt/vxlan03.sh | 3 +- > testcases/network/xinetd/xinetd_tests.sh | 3 +- > testscripts/network.sh | 7 +- > 89 files changed, 627 insertions(+), 480 deletions(-) > rename testcases/lib/{test_net.sh => tst_net.sh} (85%) > create mode 100644 testcases/network/stress/interface/if-lib.sh > rename testcases/network/stress/ns-tools/{test_net_stress.sh => tst_net_stress.sh} (88%) >
Hi, > I spent some time with fixing dependencies for interface stress tests. > I also fighted with getopts being passed to tst_net.sh and for other scripts > I needed keep -6 for tst_net.sh, the rest is for scripts using > tst_net.sh - tests themselves, "libraries" being called by scripts - > tcp_fastopen_run.sh, vxlan03.sh and testscripts/network.sh). > Sometimes tst_net.sh is loaded 3 times. > For further development I'd like to move network setup from > testscripts/network.sh to tst_net.sh to function tst_net_run(). This > would allow to run tests with runltp (and keep our > testscripts/network.sh helper). That would reduce one user of > tst_net.sh. > Another benefit I see to have unique way to run script (one day there > might be runltp replaced by better implementation and I don't want > network scripts to be missing it). I overlooked simple fact that test itself doesn't need testscripts/network.sh helper to setup network. They can be run by $LTPROOT/bin/ltp-pan itself or with one of the helpers for non-networking tests (e.g. /opt/ltp/runltp). The difference is that is the setup is being run again before each test, which is a bit slower, but we're sure the network setup after previous test is restored (in case of previous test has bug and fail to restore it). Here network setup done with TCID="network_settings", only once: # /opt/ltp/testscripts/network.sh -6 network_settings 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface network_settings 1 TINFO: set local addr 10.0.0.2/24 network_settings 1 TINFO: set local addr fd00:1:1:1::2/64 network_settings 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface network_settings 1 TINFO: set remote addr 10.0.0.1/24 network_settings 1 TINFO: set remote addr fd00:1:1:1::1/64 network_settings 1 TINFO: wait for IPv6 DAD completion 1/5 sec network_settings 1 TINFO: Network config (local -- remote): network_settings 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1 network_settings 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24 network_settings 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64 .. cmdline="ping01.sh -6" .. <<<test_output>>> ping01 1 TINFO: ping6 with 8 16 32 64 128 256 512 1024 2048 4064 ICMP packets ping01 1 TPASS: ping6 -c 3 -s 8 fd00:1:1:1::1 >/dev/null passed as expected ... <<<test_end>>> <<<test_start>>> ... cmdline="ping02.sh -6" ... <<<test_output>>> ping02 1 TINFO: flood ping6: ICMP packets filled with pattern '000102030405060708090a0b0c0d0e0f' ping02 1 TPASS: ping6 -c 3 -f -s 8 fd00:1:1:1::1 -p 000102030405060708090a0b0c0d0e0f >/dev/null passed as expected Here is network setup done each time, with TCID of particular test. # /opt/ltp/runltp -f net.ipv6 ... cmdline="ping01.sh -6" ... <<<test_output>>> ping01 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface ping01 1 TINFO: set local addr 10.0.0.2/24 ping01 1 TINFO: set local addr fd00:1:1:1::2/64 ping01 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface ping01 1 TINFO: set remote addr 10.0.0.1/24 ping01 1 TINFO: set remote addr fd00:1:1:1::1/64 ping01 1 TINFO: wait for IPv6 DAD completion 1/5 sec ping01 1 TINFO: Network config (local -- remote): ping01 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1 ping01 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24 ping01 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64 ping01 1 TINFO: ping6 with 8 16 32 64 128 256 512 1024 2048 4064 ICMP packets ping01 1 TPASS: ping6 -c 3 -s 8 fd00:1:1:1::1 >/dev/null passed as expected ... <<<execution_status>>> ... <<<test_end>>> <<<test_start>>> ... cmdline="ping02.sh -6" ... <<<test_output>>> ping02 1 TINFO: initialize 'lhost' 'ltp_ns_veth2' interface ping02 1 TINFO: set local addr 10.0.0.2/24 ping02 1 TINFO: set local addr fd00:1:1:1::2/64 ping02 1 TINFO: initialize 'rhost' 'ltp_ns_veth1' interface ping02 1 TINFO: set remote addr 10.0.0.1/24 ping02 1 TINFO: set remote addr fd00:1:1:1::1/64 ping02 1 TINFO: wait for IPv6 DAD completion 1/5 sec ping02 1 TINFO: Network config (local -- remote): ping02 1 TINFO: ltp_ns_veth2 -- ltp_ns_veth1 ping02 1 TINFO: 10.0.0.2/24 -- 10.0.0.1/24 ping02 1 TINFO: fd00:1:1:1::2/64 -- fd00:1:1:1::1/64 ping02 1 TINFO: flood ping6: ICMP packets filled with pattern '000102030405060708090a0b0c0d0e0f' ping02 1 TPASS: ping6 -c 3 -f -s 8 fd00:1:1:1::1 -p 000102030405060708090a0b0c0d0e0f >/dev/null passed as expected Maybe we should document it. Kind regards, Petr
Hi Alexey, > Hi Petr, > three times... does it happen after these patches? > It's sourced by the helper to export the environment variables and export > the variables that are not yet set, so once here. > And each of the tests sources it once as well... Sorry, ignore this. It's just me realized obvious thing, that helper is optional. I explained it more in https://lists.linux.it/pipermail/ltp/2018-April/007681.html > > For further development I'd like to move network setup from > > testscripts/network.sh to tst_net.sh to function tst_net_run(). This > > would allow to run tests with runltp (and keep our > > testscripts/network.sh helper). That would reduce one user of > > tst_net.sh. > > Another benefit I see to have unique way to run script (one day there > > might be runltp replaced by better implementation and I don't want > > network scripts to be missing it). > This helper is really optional, I'm not quite follow you here, what > is the purpose of moving it's setup to tst_net_run()? The tests run > fine without the helper, and with runltp as well. As I wrote above, please ignore it. > For netns and runltp, each test-case flushes interfaces and waits for > completion of DAD process, I think we could remove this latency by: Oh yes DAD, it takes some time. > * checking that interface already has the needed configuration, no need > to flush and re-add anything, check that there is no xfrm policy, etc. > * may be save temp configuration in a file on the first test-case run and > source it for the next test-cases > * pass nodad when setting IPv6 addresses If the this is safe, that could be easiest to implement. Kind regards, Petr > Thanks, > Alexey
Hi Alexey, > Changelog v5->v6: > * Fix bashism in v5 when passing parameters to tst_net.sh. > https://lists.linux.it/pipermail/ltp/2018-April/007619.html > * Fixed missing $ipver in multicast tests. > * Fixed broken creating tmpdir on rhost in new API. > Changelog v4->v5: > * Fix handling getopts parameters in scripts which are using legacy API > with getopts (ipsec_lib.sh, tcp_fastopen_run.sh, rpc_test.sh) by > shifting args after getopts and moving sourcing tst_net.sh after that. > Also -6 param for IPv6 must be passed to tst_net.sh (ipsec_lib.sh, > tcp_fastopen_run.sh). > * Fixed iver for legacy scripts (caused some bugs at least in interfaces > tests). > Changes v3->v4: > * Fixed bugs with setting TST_IPV6 and ipver variables. Now added into > setup function (for new API they must not be used in test scripts > outside setup/run/cleanup functions as they're not set). > * New commit: 6/6 "network/interface: Split tests to test only one command per test" > A bit complicated than I thought (adding tst_test_cmds and using it > would be simpler), but I guess separation is better (as Cyril noted). > I needed to pass -c as getopts parameter. > * Renamed functions in tst_net.sh (Alexey). > * Fixed script name in Makefile, changed output of usage (Alexey). > * Export TST_ID, LTPROOT and TST_DATAROOT also for TST_NO_DEFAULT_RUN > (Cyril). > Petr Vorel (7): > tst_net.sh: Support both new and legacy APIs + rename > tst_test.sh: Introduce TST_NO_DEFAULT_RUN > network.sh: Migrate to new shell API > network/interface: Cleanup if4-addr-change > network/if-updown: Restore IP in cleanup function > tst_net_stress.sh: Migrate with dependencies to new API + rename > network/interface: Split tests to test only one command per test I didn't want to flood ML again, so here is the diff v6->v7: diff --git testscripts/network.sh testscripts/network.sh index b18f202d5..c946e4d86 100755 --- testscripts/network.sh +++ testscripts/network.sh @@ -86,15 +86,12 @@ if [ "$OPTIND" -eq 1 ]; then fi shift $(($OPTIND - 1)) -TST_TOTAL=1 -TCID="network_settings" - TST_NO_DEFAULT_RUN=1 . tst_net.sh # Reset variables. # Don't break the tests which are using 'testcases/lib/cmdlib.sh' -unset TCID TST_LIB_LOADED TST_USE_LEGACY_API +unset TST_ID TST_LIB_LOADED TST_NO_DEFAULT_RUN rm -f $CMDFILE ---- Alternatively you can clone changes here: https://github.com/pevik/ltp/tree/tst_net.sh.v7 Anything to change? Kind regards, Petr