Example #1
0
 def setup(self, **kwargs):
     tools = kwargs['tools']
     for dd in self.dax_devices:
         proc = tools.pmemdetect('-d', dd.path)
         if proc.returncode != 0:
             raise futils.Fail('checking {} with pmemdetect failed:{}{}'
                               .format(dd.path, os.linesep, proc.stdout))
Example #2
0
File: utils.py Project: krzycz/nvml
def get_size(path):
    """
    Returns size of the file or dax device.
    Value "2**64 - 1" is checked because pmemdetect in case of error prints it.
    """
    proc = tools.pmemdetect('-z', path)
    if int(proc.stdout) != 2**64 - 1:
        return int(proc.stdout)
    fail('Could not get size of the file, it is inaccessible or does not exist')
Example #3
0
 def get_size(self, path):
     """
     Returns size of the file or dax device.
     Value "2**64 - 1" is checked because pmemdetect in case of error prints it.
     """
     proc = tools.pmemdetect(self, '-z', path)
     if int(proc.stdout) != 2**64 - 1:
         return int(proc.stdout)
     futils.fail('Could not get size of the file, it is inaccessible or does not exist')
Example #4
0
def supports_map_sync(path):
    """Checks if MAP_SYNC is supported on a filesystem from given path"""
    proc = tools.pmemdetect('-s', path)
    if proc.returncode == tools.PMEMDETECT_ERROR:
        fail(proc.stdout)
    if proc.returncode == tools.PMEMDETECT_TRUE:
        return True
    if proc.returncode == tools.PMEMDETECT_FALSE:
        return False
    fail('Unknown value {} returned by pmemdetect'.format(proc.returncode))
Example #5
0
def is_devdax(path):
    """Checks if given path points to device dax"""
    proc = tools.pmemdetect('-d', path)
    if proc.returncode == tools.PMEMDETECT_ERROR:
        fail(proc.stdout)
    if proc.returncode == tools.PMEMDETECT_TRUE:
        return True
    if proc.returncode == tools.PMEMDETECT_FALSE:
        return False
    fail('Unknown value {} returned by pmemdetect'.format(proc.returncode))
Example #6
0
File: utils.py Project: krzycz/nvml
def supports_map_sync(path):
    """Checks if MAP_SYNC is supported on a filesystem from given path"""
    proc = tools.pmemdetect('-s', path)
    if proc.returncode == tools.PMEMDETECT_ERROR:
        fail(proc.stdout)
    if proc.returncode == tools.PMEMDETECT_TRUE:
        return True
    if proc.returncode == tools.PMEMDETECT_FALSE:
        return False
    fail('Unknown value {} returned by pmemdetect'.format(proc.returncode))
Example #7
0
File: utils.py Project: krzycz/nvml
def is_devdax(path):
    """Checks if given path points to device dax"""
    proc = tools.pmemdetect('-d', path)
    if proc.returncode == tools.PMEMDETECT_ERROR:
        fail(proc.stdout)
    if proc.returncode == tools.PMEMDETECT_TRUE:
        return True
    if proc.returncode == tools.PMEMDETECT_FALSE:
        return False
    fail('Unknown value {} returned by pmemdetect'.format(proc.returncode))
Example #8
0
    def setup(self, **kwargs):
        # DevDax tests always require ndctl
        req.Requirements().check_ndctl_enable()
        req.Requirements().check_ndctl()

        tools = kwargs['tools']
        for dd in self.dax_devices:
            proc = tools.pmemdetect('-d', dd.path)
            if proc.returncode != 0:
                raise futils.Fail(
                    'checking {} with pmemdetect failed:{}{}'.format(
                        dd.path, os.linesep, proc.stdout))
Example #9
0
    def setup(self, **kwargs):
        # DevDax tests always require ndctl
        req.Requirements().check_ndctl_enable()
        req.Requirements().check_ndctl()

        tools = kwargs['tools']
        for dd in self.dax_devices:
            proc = tools.pmemdetect('-d', dd.path)
            if proc.returncode != 0:
                raise futils.Fail('checking {} with pmemdetect failed:{}{}'
                                  .format(dd.path, os.linesep, proc.stdout))

            if self.check_fs_exec:
                exec_allowed = tools.mapexec(dd.path)
                if exec_allowed.returncode != 1:
                    raise futils.Skip('dax device {} has no exec rights for'
                                      ' mmap'.format(dd.path))