xtf-runner already contains logic to adjust CWD when run so remove the
unnecessary change of directory before running it.

Suggested-by: Andrew Cooper <[email protected]>

Also remove the hardcoding of the path to the XTF directory - resolve it
the same way that the recipe does.

Signed-off-by: Christopher Clark <[email protected]>
---

This patch applies on top of the related series of 4 XTF patches posted
earlier today.

 lib/oeqa/runtime/cases/xtf_minimal.py | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/lib/oeqa/runtime/cases/xtf_minimal.py 
b/lib/oeqa/runtime/cases/xtf_minimal.py
index 6094cd9..8e2c441 100644
--- a/lib/oeqa/runtime/cases/xtf_minimal.py
+++ b/lib/oeqa/runtime/cases/xtf_minimal.py
@@ -52,14 +52,11 @@ def xtf_runner_exit_status(state):
              6: "CRASH",
     }[state]
 
-xtf_rundir = '/usr/libexec/xtf'
-
 class XTFMinimalTest(OERuntimeTestCase):
 
-    def query_xtf_cases(self, query_item):
-        (status, output) = self.target.run(
-                            'cd %s; ./xtf-runner --list %s' % \
-                            (xtf_rundir, query_item))
+    def query_xtf_cases(self, xtf_runner, query_item):
+        (status, output) = self.target.run('%s --list %s' % \
+                                           (xtf_runner, query_item))
         self.assertTrue(status == 0, msg='XTF runner failed')
 
         populate_case_lines = output.split('\n')
@@ -68,7 +65,7 @@ class XTFMinimalTest(OERuntimeTestCase):
 
         return list(map(lambda x: x.lstrip().rstrip(), populate_case_lines))
 
-    def get_xtf_case_list(self):
+    def get_xtf_case_list(self, xtf_runner):
         xtf_cases = []
 
         populate = self.tc.td.get('XTF_TEST_CASES_POPULATE')
@@ -79,7 +76,7 @@ class XTFMinimalTest(OERuntimeTestCase):
             populate = DEFAULT_POPULATE
 
         for query_item in populate.split('|'):
-            xtf_cases.extend( self.query_xtf_cases(query_item) )
+            xtf_cases.extend( self.query_xtf_cases(xtf_runner, query_item) )
 
         if skip is not None:
             for skip_item in skip.split(' '):
@@ -96,9 +93,9 @@ class XTFMinimalTest(OERuntimeTestCase):
         self.logger.info('XTF cases: %s' % str(xtf_cases))
         return xtf_cases
 
-    def run_xtf_case(self, xtf_case_name):
-        (status, output) = self.target.run('cd %s; ./xtf-runner %s' % \
-                                           (xtf_rundir, xtf_case_name))
+    def run_xtf_case(self, xtf_runner, xtf_case_name):
+        (status, output) = self.target.run('%s %s' %
+                                           (xtf_runner, xtf_case_name))
         self.assertTrue(status == 0, msg='XTF test %s failed: %s' % \
                         (xtf_case_name, xtf_runner_exit_status(status)))
 
@@ -108,9 +105,12 @@ class XTFMinimalTest(OERuntimeTestCase):
     @OEHasPackage(['xen-tools'])
     def test_xtf_minimal(self):
 
-        xtf_cases = self.get_xtf_case_list()
+        xtf_runner = os.path.join(self.tc.td.get('libexecdir'), 'xtf',
+                                  'xtf-runner')
+
+        xtf_cases = self.get_xtf_case_list(xtf_runner)
 
         for xtf_case_name in xtf_cases:
             self.logger.debug('Running XTF case: %s' % xtf_case_name)
 
-            self.run_xtf_case(xtf_case_name)
+            self.run_xtf_case(xtf_runner, xtf_case_name)
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6735): 
https://lists.yoctoproject.org/g/meta-virtualization/message/6735
Mute This Topic: https://lists.yoctoproject.org/mt/85291971/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to