]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/cephfs: print cmd debug info when it fails
authorRishabh Dave <ridave@redhat.com>
Mon, 18 Apr 2022 16:29:02 +0000 (21:59 +0530)
committerRishabh Dave <ridave@redhat.com>
Wed, 27 Apr 2022 09:14:37 +0000 (14:44 +0530)
Print return code, stdout and stderr for the command that launches
xfstests-dev tests against CephFS when it fails.

Signed-off-by: Rishabh Dave <ridave@redhat.com>
qa/tasks/cephfs/test_acls.py

index 87c95e1329fe8754a838a2985d70a42277397e84..03665d4dad595930a3ee32053a84bef266afbbd8 100644 (file)
@@ -3,8 +3,10 @@ from logging import getLogger
 from io import StringIO
 from tasks.cephfs.xfstests_dev import XFSTestsDev
 
+
 log = getLogger(__name__)
 
+
 class TestACLs(XFSTestsDev):
 
     def test_acls(self):
@@ -21,7 +23,18 @@ class TestACLs(XFSTestsDev):
         elif isinstance(self.mount_a, KernelMount):
             log.info('client is kernel mounted')
 
-        self.mount_a.client_remote.run(args=['sudo', './check',
+        # XXX: check_status is set to False so that we can check for command's
+        # failure on our own (since this command doesn't set right error code
+        # and error message in some cases) and print custom log messages
+        # accordingly.
+        proc = self.mount_a.client_remote.run(args=['sudo', './check',
             'generic/099'], cwd=self.repo_path, stdout=StringIO(),
-            stderr=StringIO(), timeout=30, check_status=True, omit_sudo=False,
+            stderr=StringIO(), timeout=30, check_status=False,omit_sudo=False,
             label='running tests for ACLs from xfstests-dev')
+
+        if proc.returncode != 0:
+            log.info('Command failed.')
+        log.info(f'Command return value: {proc.returncode}')
+        stdout, stderr = proc.stdout.getvalue(), proc.stderr.getvalue()
+        log.info(f'Command stdout -\n{stdout}')
+        log.info(f'Command stderr -\n{stderr}')