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 <ridave@redhat.com>
This commit is contained in:
Rishabh Dave 2022-04-18 21:59:02 +05:30
parent 09d5e07d16
commit d3b9543624

View 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}')