[dts] [PATCH V1] framework/crb: modify code logic

Jianwei Mei jianweix.mei at intel.com
Thu Aug 13 21:09:05 CEST 2020


Code 'os.path.isfile()' only be executed locally(tester side), lead to recovery ENV fail.
The code logic is to judge files on DUT, so change it as below. 

Signed-off-by: Jianwei Mei <jianweix.mei at intel.com>
---
 framework/crb.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/framework/crb.py b/framework/crb.py
index d456fab..cd29b8e 100644
--- a/framework/crb.py
+++ b/framework/crb.py
@@ -500,7 +500,8 @@ class Crb(object):
         pid_reg = r'p(\d+)'
         for config_file in file_directorys:
             # Covers case where the process is run as a unprivileged user and does not generate the file
-            if os.path.isfile(config_file):
+            isfile = self.send_expect('ls -l {}'.format(config_file), "# ", 20, alt_session)
+            if isfile:
                 cmd = 'lsof -Fp %s' % config_file
                 out = self.send_expect(cmd, "# ", 20, alt_session)
                 if len(out):
@@ -516,7 +517,8 @@ class Crb(object):
         hugepage_info = ['/var/run/dpdk/%s/hugepage_info' % file_prefix for file_prefix in prefix_list]
         for hugepage in hugepage_info:
             # Covers case where the process is run as a unprivileged user and does not generate the file
-            if os.path.isfile(hugepage):
+            isfile = self.send_expect('ls -l {}'.format(hugepage), "# ", 20, alt_session)
+            if isfile:
                 cmd = 'lsof -Fp %s' % hugepage
                 out = self.send_expect(cmd, "# ", 20, alt_session)
                 if len(out) and "No such file or directory" not in out:
-- 
2.17.1



More information about the dts mailing list