mirror of
https://github.com/ceph/ceph
synced 2024-12-28 22:43:29 +00:00
eac83582f3
In xfstests-dev, "./check generic/abcd" doesn't end in error even when there is no test abcd in generic. It's better to check the stdout to verify success and print the returncode, stdout and stderr of the command in logs so that such error can be found out by reading logs. Signed-off-by: Rishabh Dave <ridave@redhat.com>
45 lines
1.8 KiB
Python
45 lines
1.8 KiB
Python
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):
|
|
from tasks.cephfs.fuse_mount import FuseMount
|
|
from tasks.cephfs.kernel_mount import KernelMount
|
|
|
|
# TODO: make xfstests-dev compatible with ceph-fuse. xfstests-dev
|
|
# remounts CephFS before running tests using kernel, so ceph-fuse
|
|
# mounts are never actually testsed.
|
|
if isinstance(self.mount_a, FuseMount):
|
|
log.info('client is fuse mounted')
|
|
self.skipTest('Requires kernel client; xfstests-dev not '\
|
|
'compatible with ceph-fuse ATM.')
|
|
elif isinstance(self.mount_a, KernelMount):
|
|
log.info('client is kernel mounted')
|
|
|
|
# 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=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}')
|
|
|
|
self.assertEqual(proc.returncode, 0)
|
|
success_line = 'Passed all 1 tests'
|
|
self.assertIn(success_line, stdout)
|