From 9a0d6a86aadb5dfcc9fb55af2a8efc4881540579 Mon Sep 17 00:00:00 2001 From: Yulong Pei Date: Mon, 6 Feb 2023 08:09:02 +0000 Subject: Fix issue in csit hoststack test 1. ABTool.py, fix error in parsing the return result of ab 2. DUTSetup.py, add sleep to wait for the program to start Signed-off-by: Peng Lu Signed-off-by: Xinfeng Zhao Signed-off-by: Yulong Pei Change-Id: I1cffa28d8492bcc27ae188f1e084b80afad60502 --- resources/tools/ab/ABTools.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'resources/tools/ab') diff --git a/resources/tools/ab/ABTools.py b/resources/tools/ab/ABTools.py index bb21ea351f..b929b49fdd 100644 --- a/resources/tools/ab/ABTools.py +++ b/resources/tools/ab/ABTools.py @@ -13,6 +13,7 @@ """ab implementation into CSIT framework.""" +from re import search from resources.libraries.python.Constants import Constants from resources.libraries.python.model.ExportResult import ( export_hoststack_results @@ -167,15 +168,16 @@ class ABTools: failed_requests = None for line in stdout.splitlines(): if f"Connection {rps_cps} rate:" in line: - rate = float(line.split(" ")[3]) + rate = float(search(r":\s*(\d+\.?\d+)", line).group(1)) elif "Transfer Rate:" in line: - bandwidth = float(line.split(" ")[2]) * 8000 + bandwidth = \ + float(search(r":\s*(\d+\.?\d+)", line).group(1)) * 8000 elif "Latency:" in line: - latency = float(line.split(" ")[1]) + latency = float(search(r":\s*(\d+\.?\d+)", line).group(1)) elif "Completed requests:" in line: - completed_requests = int(line.split(" ")[2]) + completed_requests = int(search(r":\s*(\d+)", line).group(1)) elif "Failed requests" in line: - failed_requests = int(line.split(" ")[2]) + failed_requests = int(search(r":\s*(\d+)", line).group(1)) export_hoststack_results( bandwidth, rate, rate_unit, latency, failed_requests, -- cgit 1.2.3-korg