* [dts] [PATCH V1 1/2] ptpclient: add test plan
@ 2017-06-26 6:44 Lijuan Tu
2017-06-26 6:44 ` [dts] [PATCH V1 2/2] ptpclient: add test script Lijuan Tu
2017-07-14 12:15 ` [dts] [PATCH V1 1/2] ptpclient: add test plan Liu, Yong
0 siblings, 2 replies; 3+ messages in thread
From: Lijuan Tu @ 2017-06-26 6:44 UTC (permalink / raw)
To: dts; +Cc: Lijuan Tu
Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
test_plans/ptpclient_test_plan.rst | 73 ++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 test_plans/ptpclient_test_plan.rst
diff --git a/test_plans/ptpclient_test_plan.rst b/test_plans/ptpclient_test_plan.rst
new file mode 100644
index 0000000..c41cefd
--- /dev/null
+++ b/test_plans/ptpclient_test_plan.rst
@@ -0,0 +1,73 @@
+.. Copyright (c) <2017>, Intel Corporation
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ - Neither the name of Intel Corporation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ OF THE POSSIBILITY OF SUCH DAMAGE.
+
+===============
+EEE1588 Sample
+===============
+
+The PTP (Precision Time Protocol) client sample application is a simple
+example of using the DPDK IEEE1588 API to communicate with a PTP master
+clock to synchronize the time on the NIC and, optionally, on the Linux
+system.
+
+Prerequisites
+=============
+Assume one port are connected to the tester and tester has been installed
+"linuxptp.x86_64".
+The sample should be validated on Forville, Niantic and i350 Nics.
+
+Test case: ptp client
+======================
+Start ptp server on tester with IEEE 802.3 network transport::
+ ptp4l -i p785p1 -2 -m
+Start ptp client on DUT and wait few seconds::
+ ./examples/ptpclient/build/ptpclient -c f -n 3 -- -T 0 -p 0x1
+Check that output message contained T1,T2,T3,T4 clock and time difference
+between master and slave time is about 10us in niantic, 20us in Fortville,
+8us in i350.
+
+Test case: update system
+========================
+Reset DUT clock to initial time and make sure system time has been changed::
+ date -s "1970-01-01 00:00:00"
+Strip DUT and tester board system time::
+ date +"%s.%N"
+Start ptp server on tester with IEEE 802.3 network transport::
+ ptp4l -i p785p1 -2 -m -S
+Start ptp client on DUT and wait few seconds::
+ ./examples/ptpclient/build/ptpclient -c f -n 3 -- -T 1 -p 0x1
+Make sure DUT system time has been changed to same as tester.
+Check that output message contained T1,T2,T3,T4 clock and time difference
+between master and slave time is about 10us in niantic, 20us in Fortville,
+8us in i350.
+
+
--
2.5.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dts] [PATCH V1 2/2] ptpclient: add test script
2017-06-26 6:44 [dts] [PATCH V1 1/2] ptpclient: add test plan Lijuan Tu
@ 2017-06-26 6:44 ` Lijuan Tu
2017-07-14 12:15 ` [dts] [PATCH V1 1/2] ptpclient: add test plan Liu, Yong
1 sibling, 0 replies; 3+ messages in thread
From: Lijuan Tu @ 2017-06-26 6:44 UTC (permalink / raw)
To: dts; +Cc: Lijuan Tu
Signed-off-by: Lijuan Tu <lijuanx.a.tu@intel.com>
---
tests/TestSuite_ptpclient.py | 171 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 171 insertions(+)
create mode 100644 tests/TestSuite_ptpclient.py
diff --git a/tests/TestSuite_ptpclient.py b/tests/TestSuite_ptpclient.py
new file mode 100644
index 0000000..f038bef
--- /dev/null
+++ b/tests/TestSuite_ptpclient.py
@@ -0,0 +1,171 @@
+# BSD LICENSE
+#
+# Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of Intel Corporation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+DPDK Test suite.
+Test support of IEEE1588 Precise Time Protocol.
+"""
+
+import utils
+import re
+import time
+from test_case import TestCase
+
+class TestPtpClient(TestCase):
+
+ def set_up_all(self):
+ """
+ Run at the start of each test suite.
+ IEEE1588 Prerequisites
+ """
+ out = self.tester.send_expect("ptp4l -v", "# ")
+ self.verify("command not found" not in out, "ptp4l not install")
+ dutPorts = self.dut.get_ports()
+ self.verify(len(dutPorts) > 0, "No ports found for " + self.nic)
+ global default
+ default = self.dut.send_expect("cat config/common_base |grep IEEE1588=", "# ")
+
+ # Change the config file to support IEEE1588 and recompile the package.
+ self.dut.send_expect("sed -i -e 's/%s$/CONFIG_RTE_LIBRTE_IEEE1588=y/' config/common_base" % default, "# ", 30)
+ self.dut.skip_setup = False
+ self.dut.build_install_dpdk(self.target)
+
+ # build sample app
+ out = self.dut.send_expect("make -C examples/ptpclient", "# ")
+ self.verify("Error" not in out, "compilation error 1")
+ self.verify("No such file" not in out, "compilation error 2")
+
+ port = self.tester.get_local_port(dutPorts[0])
+ self.itf0 = self.tester.get_interface(port)
+
+ def set_up(self):
+ """
+ Run before each test case.
+ """
+ pass
+
+ def average(self, seq):
+ total = 0
+ for num in range(0,len(seq)):
+ total+=seq[num]
+ return total / num
+
+ def creat_table(self,num):
+ self.header_row = ["NIC","%s" % self.nic]
+ self.result_table_create(self.header_row)
+ results_row = ['average value(us)']
+ results_row.append(num)
+ self.result_table_add(results_row)
+ self.result_table_print()
+
+ def kill_ptpclient(self):
+ out_ps = self.dut.send_expect("ps -C ptpclient -L -opid,args", "# ")
+ utils.regexp(out_ps, r'(\d+) ./examples/ptpclient')
+ pid = re.compile(r'(\d+) ./examples/ptpclient')
+ pid_num = list(set(pid.findall(out_ps)))
+ out_ps = self.dut.send_expect("kill %s" % pid_num[0], "# ")
+
+ def test_ptpclient(self):
+ """
+ ptp client test case.
+ """
+ # use the first port on that self.nic
+ self.tester.send_expect("ptp4l -i %s -2 -m -S &" % self.itf0, "ptp4l")
+
+ # run ptpclient on the background
+ self.dut.send_expect("./examples/ptpclient/build/ptpclient -c f -n 3 -- -T 0 -p 0x1 " + "&", "Delta between master and slave", 60)
+ time.sleep(3)
+ out = self.dut.get_session_output()
+ self.kill_ptpclient()
+
+ self.verify("T1" and "T2" and "T3" and "T4" in out, "T1,T2,T3,T4 clock error")
+ utils.regexp(out, r'Delta between master and slave clocks\:(\d+)ns')
+ pat = re.compile(r'Delta between master and slave clocks\:(\d+)ns')
+ Delta_list = pat.findall(out)
+ Delta = map(int, Delta_list)
+ Delta_ns = self.average(Delta)
+ Delta_us = Delta_ns / 1000.0
+
+ print "Delta:", Delta
+
+ self.creat_table(Delta_us)
+
+ def test_update_system(self):
+
+ #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'","# ")
+ self.verify(d_time == '2000-01-01 00:00', "set the time error")
+
+ self.tester.send_expect("ptp4l -i %s -2 -m -S &" % self.itf0, "ptp4l")
+
+ # run ptpclient on the background
+ self.dut.send_expect("./examples/ptpclient/build/ptpclient -c f -n 3 -- -T 1 -p 0x1" + "&", "Delta between master and slave", 60)
+ time.sleep(3)
+ out = self.dut.get_session_output()
+
+ self.kill_ptpclient()
+
+ self.verify("T1" and "T2" and "T3" and "T4" in out, "T1,T2,T3,T4 clock error")
+ utils.regexp(out, r'Delta between master and slave clocks\:(\d+)ns')
+ pat = re.compile(r'Delta between master and slave clocks\:(\d+)ns')
+ Delta_list = pat.findall(out)
+ Delta = map(int, Delta_list)
+ Delta_ns = self.average(Delta)
+ Delta_us = Delta_ns / 1000.0
+
+ print "Delta:", Delta
+
+ 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")
+
+ def tear_down(self):
+ """
+ Run after each test case.
+ """
+ self.tester.send_expect("killall ptp4l" , "# ")
+
+ def tear_down_all(self):
+ """
+ Run after each test suite.
+ """
+ # Restore the config file and recompile the package.
+ self.dut.send_expect("sed -i -e 's/CONFIG_RTE_LIBRTE_IEEE1588=y$/%s/' config/common_base" % default, "# ", 30)
+ self.dut.build_install_dpdk(self.target)
--
2.5.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dts] [PATCH V1 1/2] ptpclient: add test plan
2017-06-26 6:44 [dts] [PATCH V1 1/2] ptpclient: add test plan Lijuan Tu
2017-06-26 6:44 ` [dts] [PATCH V1 2/2] ptpclient: add test script Lijuan Tu
@ 2017-07-14 12:15 ` Liu, Yong
1 sibling, 0 replies; 3+ messages in thread
From: Liu, Yong @ 2017-07-14 12:15 UTC (permalink / raw)
To: Lijuan Tu, dts
Thanks, applied.
On 06/26/2017 02:44 PM, Lijuan Tu wrote:
> Signed-off-by: Lijuan Tu<lijuanx.a.tu@intel.com>
> ---
> test_plans/ptpclient_test_plan.rst | 73 ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 73 insertions(+)
> create mode 100644 test_plans/ptpclient_test_plan.rst
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-07-14 3:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-26 6:44 [dts] [PATCH V1 1/2] ptpclient: add test plan Lijuan Tu
2017-06-26 6:44 ` [dts] [PATCH V1 2/2] ptpclient: add test script Lijuan Tu
2017-07-14 12:15 ` [dts] [PATCH V1 1/2] ptpclient: add test plan Liu, Yong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).