From: Lou Berger Date: Tue, 26 Oct 2021 14:56:50 +0000 (-0400) Subject: tests: topotests/lib/lutil.py: optimize wait to not repeat command after expected... X-Git-Tag: frr-8.2.2~334^2 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=6804af739dab2eb0caf29b8dcc36f175f96b3400;p=mirror_frr.git tests: topotests/lib/lutil.py: optimize wait to not repeat command after expected result found Signed-off-by: Lou Berger --- diff --git a/tests/topotests/lib/lutil.py b/tests/topotests/lib/lutil.py index c17c7f14e..5c1fa24a7 100644 --- a/tests/topotests/lib/lutil.py +++ b/tests/topotests/lib/lutil.py @@ -189,11 +189,8 @@ Total %-4d %-4d %d\n\ self.log("unable to read: " + tstFile) sys.exit(1) - def command(self, target, command, regexp, op, result, returnJson): + def command(self, target, command, regexp, op, result, returnJson, startt=None): global net - if op != "wait": - self.l_line += 1 - if op == "jsoncmp_pass" or op == "jsoncmp_fail": returnJson = True @@ -294,7 +291,11 @@ Total %-4d %-4d %d\n\ % (group_nl_converted, ret), 9, ) - if op == "pass" or op == "fail": + if startt != None: + if js != None or ret is not False: + delta = time.time() - startt + self.result(target, success, "%s +%4.2f secs" % (result, delta)) + elif op == "pass" or op == "fail": self.result(target, success, result) if js != None: return js @@ -326,7 +327,7 @@ Total %-4d %-4d %d\n\ while wait_count > 0: n += 1 - found = self.command(target, command, regexp, op, result, returnJson) + found = self.command(target, command, regexp, op, result, returnJson, startt) if found is not False: break @@ -336,14 +337,6 @@ Total %-4d %-4d %d\n\ delta = time.time() - startt self.log("Done after %d loops, time=%s, Found=%s" % (n, delta, found)) - found = self.command( - target, - command, - regexp, - "pass", - "%s +%4.2f secs" % (result, delta), - returnJson, - ) return found