From d3b95436247da375c4e10a3f64056dc3bb67cd98 Mon Sep 17 00:00:00 2001 From: Rishabh Dave Date: Mon, 18 Apr 2022 21:59:02 +0530 Subject: [PATCH] qa/cephfs: print cmd debug info when it fails Print return code, stdout and stderr for the command that launches xfstests-dev tests against CephFS when it fails. Signed-off-by: Rishabh Dave --- qa/tasks/cephfs/test_acls.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/qa/tasks/cephfs/test_acls.py b/qa/tasks/cephfs/test_acls.py index 87c95e1329f..03665d4dad5 100644 --- a/qa/tasks/cephfs/test_acls.py +++ b/qa/tasks/cephfs/test_acls.py @@ -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}')