[dts] [PATCH V1] tests/ptpclient: optimize script

Song Jiale songx.jiale at intel.com
Fri Mar 31 16:08:06 CEST 2023


increase regular expressions to capture time to eliminate interference
from other echoes.

Signed-off-by: Song Jiale <songx.jiale at intel.com>
---
 tests/TestSuite_ptpclient.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/TestSuite_ptpclient.py b/tests/TestSuite_ptpclient.py
index 55ef98ff..1175e98a 100644
--- a/tests/TestSuite_ptpclient.py
+++ b/tests/TestSuite_ptpclient.py
@@ -104,7 +104,8 @@ class TestPtpClient(TestCase):
 
         # set the dut system time
         self.dut.send_expect("date -s '2000-01-01 00:00:00'", "# ")
-        d_time = self.dut.send_expect("date '+%Y-%m-%d %H:%M'", "# ")
+        out = self.dut.send_expect("date '+%Y-%m-%d %H:%M'", "# ")
+        d_time = re.findall(r"(\d{4}-\d{2}-\d{2}\s\d{2}:\d{2})", out)[0]
         self.verify(d_time == "2000-01-01 00:00", "set the time error")
 
         if self.nic in ["cavium_a063", "cavium_a064"]:
-- 
2.25.1



More information about the dts mailing list