From 10c706e4ecac850c4b665511a9f7ad9927f4bfc9 Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Fri, 24 Apr 2020 12:36:22 -0700 Subject: [PATCH] lf_testmod: Make sure settings are flushed. Utils: Add option to doCmd to allow waiting for arbitrary text, that way we can ignore intervening 'RSLT' lines when doing batched cmds. --- LANforge/Utils.pm | 7 ++++++- lf_testmod.pl | 12 +++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/LANforge/Utils.pm b/LANforge/Utils.pm index f1ff28a2..c5c56a92 100644 --- a/LANforge/Utils.pm +++ b/LANforge/Utils.pm @@ -87,6 +87,11 @@ sub doCmd { my $self = shift; my $cmd = shift; my $nowait = shift; + my $waitfor = shift; + + if (!defined($waitfor)) { + $waitfor = '/ >>RSLT:(.*)/'; + } #print "CMD[[$cmd]]\n"; my $t = ${$self->{telnet}}; @@ -99,7 +104,7 @@ sub doCmd { return ""; } - my @rslt = $t->waitfor('/ >>RSLT:(.*)/'); + my @rslt = $t->waitfor($waitfor); if ( !$self->cli_rcv_silent() ) { print "**************\n@rslt\n................\n\n"; } diff --git a/lf_testmod.pl b/lf_testmod.pl index cdb6c7ac..e0ac51bc 100755 --- a/lf_testmod.pl +++ b/lf_testmod.pl @@ -183,8 +183,18 @@ elsif ($::action eq "set") { } $cmd = "add_text_blob '$test_type' '$test_name' $ln"; - $::utils->doCmd($cmd, 1); # send and do not wait for result + print("$cmd\n"); + if ($i % 25 == 0) { + $::utils->doCmd($cmd, 1); # send and do not wait for result + } + else { + $::utils->doCmd($cmd); # send and wait for result + } } + + # Wait until we complete processing of all cmds. + $cmd = "gossip __gossip_test__"; + $::utils->doCmd($cmd, 0, "/__gossip_test__/"); } else { die("Unknown action: $::action\n$::usage\n");