[dts] [PATCH V1]userspace_ethtool: update automation testing script

yufengmx yufengx.mo at intel.com
Wed Jan 4 04:42:10 CET 2017


fix relative path to absolute path for eeprom checking

Signed-off-by: yufengmx <yufengx.mo at intel.com>
---
 tests/TestSuite_userspace_ethtool.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tests/TestSuite_userspace_ethtool.py b/tests/TestSuite_userspace_ethtool.py
index ced7e96..a03d7e0 100644
--- a/tests/TestSuite_userspace_ethtool.py
+++ b/tests/TestSuite_userspace_ethtool.py
@@ -129,23 +129,26 @@ class TestUserspaceEthtool(TestCase, IxiaPacketGenerator):
             return 1518
 
     def resize_linux_eeprom_file(self, dpdk_eeprom_file, linux_eeprom_file):
-        basePath = os.sep + "root" + self.dut.base_dir[1:] + os.sep
+        if self.dut.base_dir.startswith('~'):
+            basePath = "/root" + self.dut.base_dir[1:]
+        else:
+            basePath = self.dut.base_dir
         with open( basePath + os.sep + dpdk_eeprom_file, 'rb') as fpDpdk:
             dpdk_bytes = fpDpdk.read()
             dpdk_length = len(dpdk_bytes)
 
-        with open( basePath + linux_eeprom_file, 'rb') as fplinux:
+        with open( basePath + os.sep + linux_eeprom_file, 'rb') as fplinux:
             linux_bytes = fplinux.read()
             linux_length = len(linux_bytes)
         
         self.verify(dpdk_length <= linux_length, 
                     "linux ethtool haven't dump out enough data as dpdk ethtool")
 
-        with open( basePath + linux_eeprom_file, 'wb') as fplinux:
+        with open( basePath + os.sep + linux_eeprom_file, 'wb') as fplinux:
             fplinux.write(linux_bytes[:dpdk_length])
 
     def strip_md5(self, filename):
-        md5_info = self.dut.send_expect("md5sum %s" % filename, "# ")
+        md5_info = self.dut.send_expect("md5sum %s" % ( self.dut.base_dir + os.sep + filename), "# ", 30)
         md5_pattern = r"(\w+)  (\w+)"
         m = re.match(md5_pattern, md5_info)
         if m:
-- 
1.9.3



More information about the dts mailing list