[dts] [PATCH V1] fix ptpclient case failed because of tester and dut time zone different

Liu, Yong yong.liu at intel.com
Thu Aug 17 11:03:56 CEST 2017


Huilong,
You can use UTC time like below command, there's no need to set special time zone.

date -u '+%Y-%m-%d %H:%M %Z'

Thanks,
Marvin

> -----Original Message-----
> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of xu,huilong
> Sent: Thursday, August 17, 2017 3:01 PM
> To: dts at dpdk.org
> Cc: Xu, HuilongX <huilongx.xu at intel.com>
> Subject: [dts] [PATCH V1] fix ptpclient case failed because of tester and
> dut time zone different
> 
> ptpclint test case will sync time with tester and dut. But when tester and
> dut time zone not different.
> test time and dut time not different, so use TZ='Asia/Shanghai' time zone
> for get tester and dut time
> 
> Signed-off-by: xu,huilong <huilongx.xu at intel.com>
> ---
>  tests/TestSuite_ptpclient.py | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/TestSuite_ptpclient.py b/tests/TestSuite_ptpclient.py
> index f038bef..c469114 100644
> --- a/tests/TestSuite_ptpclient.py
> +++ b/tests/TestSuite_ptpclient.py
> @@ -146,15 +146,10 @@ class TestPtpClient(TestCase):
> 
>          self.creat_table(Delta_us)
> 
> -        tester_out = self.tester.send_expect("date '+%Y-%m-%d %H:%M'", "#
> ")
> -        dut_out = self.dut.send_expect("date '+%Y-%m-%d %H:%M'", "# ")
> -
> -        if tester_out == dut_out:
> -            self.verify(tester_out == dut_out, "the DUT time synchronous
> error")
> -        else:
> -            tester_out = self.tester.send_expect("date '+%Y-%m-%d %H:%M'",
> "# ")
> -            dut_out = self.dut.send_expect("date '+%Y-%m-%d %H:%M'", "# ")
> -            self.verify(tester_out == dut_out, "the DUT time synchronous
> error")
> +        tester_out =
> self.tester.send_expect("TZ='Asia/Shanghai'TZ='Asia/Shanghai' date '+%Y-
> %m-%d %H:%M'", "# ")
> +        dut_out = self.dut.send_expect("TZ='Asia/Shanghai' date '+%Y-%m-
> %d %H:%M'", "# ")
> +
> +        self.verify(tester_out == dut_out, "the DUT time synchronous
> error")
> 
>      def tear_down(self):
>          """
> --
> 1.9.3



More information about the dts mailing list