From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 42F9F58CF for ; Wed, 4 Jan 2017 04:41:06 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 03 Jan 2017 19:41:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,458,1477983600"; d="scan'208";a="25873194" Received: from unknown (HELO dpdk-fedora20.icx.intel.com) ([10.240.176.135]) by orsmga002.jf.intel.com with ESMTP; 03 Jan 2017 19:41:05 -0800 From: yufengmx To: dts@dpdk.org Cc: yufengmx Date: Wed, 4 Jan 2017 11:42:10 +0800 Message-Id: <1483501330-25411-2-git-send-email-yufengx.mo@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1483501330-25411-1-git-send-email-yufengx.mo@intel.com> References: <1483501330-25411-1-git-send-email-yufengx.mo@intel.com> Subject: [dts] [PATCH V1]userspace_ethtool: update automation testing script X-BeenThere: dts@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: test suite reviews and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Jan 2017 03:41:06 -0000 fix relative path to absolute path for eeprom checking Signed-off-by: yufengmx --- 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