[V1] tests/ptpclient: optimize script

Message ID 20230331140806.204359-1-songx.jiale@intel.com (mailing list archive)
State Accepted
Headers
Series [V1] tests/ptpclient: optimize script |

Checks

Context Check Description
ci/Intel-dts-format-test success Testing OK
ci/Intel-dts-pylama-test success Testing OK
ci/Intel-dts-suite-test success Testing OK

Commit Message

Jiale, SongX March 31, 2023, 2:08 p.m. UTC
  increase regular expressions to capture time to eliminate interference
from other echoes.

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

Comments

Tu, Lijuan April 11, 2023, 7:56 a.m. UTC | #1
On Fri, 31 Mar 2023 14:08:06 +0000, Song Jiale <songx.jiale@intel.com> wrote:
> increase regular expressions to capture time to eliminate interference
> from other echoes.
> 
> Signed-off-by: Song Jiale <songx.jiale@intel.com>


Applied, thanks
  

Patch

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"]: