diff mbox series

[V1] framework/crb: modify code logic

Message ID 20200813190905.16768-1-jianweix.mei@intel.com (mailing list archive)
State Accepted
Headers show
Series [V1] framework/crb: modify code logic | expand

Commit Message

Mei, JianweiX Aug. 13, 2020, 7:09 p.m. UTC
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@intel.com>
---
 framework/crb.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Tu, Lijuan Aug. 21, 2020, 2:59 a.m. UTC | #1
> 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@intel.com>

Applied
diff mbox series

Patch

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: