Exemplo n.º 1
0
    def checkRunnable(self, option):
        missing, too_old = _missing_modules, _too_old_modules
        if len(missing) > 0:
            return (False,
                    'skipped (Missing python modules: ' + " ".join(missing) +
                    " PYTHONPATH=" + os.environ.get("PYTHONPATH", "") + ')')
        if len(too_old) > 0 and RavenUtils.checkVersions():
            return (False, 'skipped (Old version python modules: ' +
                    " ".join(too_old) + " PYTHONPATH=" +
                    os.environ.get("PYTHONPATH", "") + ')')
        if len(self.specs['skip_if_env']) > 0:
            env_var = self.specs['skip_if_env']
            if env_var in os.environ:
                return (False, 'skipped (found environmental variable "' +
                        env_var + '")')
        for lib in self.required_libraries:
            found, message, version = RavenUtils.moduleReport(lib, '')
            if not found:
                return (False,
                        'skipped (Unable to import library: "' + lib + '")')

        i = 0
        if len(self.minimum_libraries) % 2:
            return (
                False,
                'skipped (libraries are not matched to versions numbers: ' +
                str(self.minimum_libraries) + ')')
        while i < len(self.minimum_libraries):
            libraryName = self.minimum_libraries[i]
            libraryVersion = self.minimum_libraries[i + 1]
            found, message, actualVersion = RavenUtils.moduleReport(
                libraryName, libraryName + '.__version__')
            if not found:
                return (False, 'skipped (Unable to import library: "' +
                        libraryName + '")')
            if distutils.version.LooseVersion(
                    actualVersion) < distutils.version.LooseVersion(
                        libraryVersion):
                return (False,
                        'skipped (Outdated library: "' + libraryName + '")')
            i += 2

        if len(self.required_executable) > 0 and \
           not os.path.exists(self.required_executable):
            return (False, 'skipped (Missing executable: "' +
                    self.required_executable + '")')
        try:
            if len(self.required_executable) > 0 and \
               subprocess.call([self.required_executable],stdout=subprocess.PIPE) != 0:
                return (False, 'skipped (Failing executable: "' +
                        self.required_executable + '")')
        except:
            return (False, 'skipped (Error when trying executable: "' +
                    self.required_executable + '")')
        return (True, '')
Exemplo n.º 2
0
    def checkRunnable(self, option):
        i = 0
        if len(self.minimum_libraries) % 2:
            return (
                False,
                'skipped (libraries are not matched to versions numbers: ' +
                str(self.minimum_libraries) + ')')
        while i < len(self.minimum_libraries):
            libraryName = self.minimum_libraries[i]
            libraryVersion = self.minimum_libraries[i + 1]
            found, message, actualVersion = RavenUtils.moduleReport(
                libraryName, libraryName + '.__version__')
            if not found:
                return (False, 'skipped (Unable to import library: "' +
                        libraryName + '")')
            if distutils.version.LooseVersion(
                    actualVersion) < distutils.version.LooseVersion(
                        libraryVersion):
                return (False,
                        'skipped (Outdated library: "' + libraryName + '")')
            i += 2

        if len(self.required_executable) > 0:
            try:
                argsList = [self.required_executable]
                argsList.extend(self.required_executable_check_flags)
                retValue = subprocess.call(argsList, stdout=subprocess.PIPE)
                if retValue != 0:
                    return (False, 'skipped (Failing executable: "' +
                            self.required_executable + '")')
            except:
                return (False, 'skipped (Error when trying executable: "' +
                        self.required_executable + '")')

        if self.specs['requires_swig2'] and not RavenPython.has_swig2:
            return (False, 'skipped (No swig 2.0 found)')
        missing, too_old, notQA = RavenUtils.checkForMissingModules()
        if len(missing) > 0:
            return (False,
                    'skipped (Missing python modules: ' + " ".join(missing) +
                    " PYTHONPATH=" + os.environ.get("PYTHONPATH", "") + ')')
        if len(too_old) > 0 and RavenUtils.checkVersions():
            return (False, 'skipped (Old version python modules: ' +
                    " ".join(too_old) + " PYTHONPATH=" +
                    os.environ.get("PYTHONPATH", "") + ')')
        for lib in self.required_libraries:
            found, message, version = RavenUtils.moduleReport(lib, '')
            if not found:
                return (False,
                        'skipped (Unable to import library: "' + lib + '")')

        return (True, '')
Exemplo n.º 3
0
    def checkRunnable(self, option):
        missing = _missing_modules
        too_old = _too_old_modules
        # remove tests based on skipping criteria
        ## required module is missing
        if len(missing) > 0:
            self.setStatus(
                'skipped (Missing python modules: ' + " ".join(missing) +
                " PYTHONPATH=" + os.environ.get("PYTHONPATH", "") + ')',
                self.bucket_skip)
            return False
        ## required module is present, but too old
        if len(too_old) > 0 and RavenUtils.checkVersions():
            self.setStatus(
                'skipped (Old version python modules: ' + " ".join(too_old) +
                " PYTHONPATH=" + os.environ.get("PYTHONPATH", "") + ')',
                self.bucket_skip)
            return False
        ## an environment varible value causes a skip
        if len(self.specs['skip_if_env']) > 0:
            env_var = self.specs['skip_if_env']
            if env_var in os.environ:
                self.setStatus(
                    'skipped (found environmental variable "' + env_var + '")',
                    self.bucket_skip)
                return False
        ## OS
        if len(self.specs['skip_if_OS']) > 0:
            skip_os = [
                x.strip().lower() for x in self.specs['skip_if_OS'].split(',')
            ]
            # get simple-name platform (options are Linux, Windows, Darwin, or SunOS that I've seen)
            currentOS = platform.system().lower()
            # replace Darwin with more expected "mac"
            if currentOS == 'darwin':
                currentOS = 'mac'
            if currentOS in skip_os:
                self.setStatus('skipped (OS is "{}")'.format(currentOS),
                               self.bucket_skip)
                return False
        for lib in self.required_libraries:
            found, message, version = RavenUtils.moduleReport(lib, '')
            if not found:
                self.setStatus(
                    'skipped (Unable to import library: "' + lib + '")',
                    self.bucket_skip)
                return False

        i = 0
        if len(self.minimum_libraries) % 2:
            self.setStatus(
                'skipped (libraries are not matched to versions numbers: ' +
                str(self.minimum_libraries) + ')', self.bucket_skip)
            return False
        while i < len(self.minimum_libraries):
            libraryName = self.minimum_libraries[i]
            libraryVersion = self.minimum_libraries[i + 1]
            found, message, actualVersion = RavenUtils.moduleReport(
                libraryName, libraryName + '.__version__')
            if not found:
                self.setStatus(
                    'skipped (Unable to import library: "' + libraryName +
                    '")', self.bucket_skip)
                return False
            if distutils.version.LooseVersion(
                    actualVersion) < distutils.version.LooseVersion(
                        libraryVersion):
                self.setStatus(
                    'skipped (Outdated library: "' + libraryName + '")',
                    self.bucket_skip)
                return False
            i += 2

        if len(self.required_executable) > 0 and \
           not os.path.exists(self.required_executable):
            self.setStatus(
                'skipped (Missing executable: "' + self.required_executable +
                '")', self.bucket_skip)
            return False
        try:
            if len(self.required_executable) > 0 and \
               subprocess.call([self.required_executable],stdout=subprocess.PIPE) != 0:
                self.setStatus(
                    'skipped (Failing executable: "' +
                    self.required_executable + '")', self.bucket_skip)
                return False
        except:
            self.setStatus(
                'skipped (Error when trying executable: "' +
                self.required_executable + '")', self.bucket_skip)
            return False
        filenameSet = set()
        duplicateFiles = []
        for filename in self.__getCreatedFiles():
            if filename not in filenameSet:
                filenameSet.add(filename)
            else:
                duplicateFiles.append(filename)
        if len(duplicateFiles) > 0:
            self.setStatus(
                '[incorrect test] duplicated files specified: ' +
                " ".join(duplicateFiles), self.bucket_skip)
            return False
        return True
Exemplo n.º 4
0
    def checkRunnable(self, option):
        missing, too_old = _missing_modules, _too_old_modules
        if len(missing) > 0:
            self.setStatus(
                'skipped (Missing python modules: ' + " ".join(missing) +
                " PYTHONPATH=" + os.environ.get("PYTHONPATH", "") + ')',
                self.bucket_skip)
            return False
        if len(too_old) > 0 and RavenUtils.checkVersions():
            self.setStatus(
                'skipped (Old version python modules: ' + " ".join(too_old) +
                " PYTHONPATH=" + os.environ.get("PYTHONPATH", "") + ')',
                self.bucket_skip)
            return False
        if len(self.specs['skip_if_env']) > 0:
            env_var = self.specs['skip_if_env']
            if env_var in os.environ:
                self.setStatus(
                    'skipped (found environmental variable "' + env_var + '")',
                    self.bucket_skip)
                return False
        for lib in self.required_libraries:
            found, message, version = RavenUtils.moduleReport(lib, '')
            if not found:
                self.setStatus(
                    'skipped (Unable to import library: "' + lib + '")',
                    self.bucket_skip)
                return False

        i = 0
        if len(self.minimum_libraries) % 2:
            self.setStatus(
                'skipped (libraries are not matched to versions numbers: ' +
                str(self.minimum_libraries) + ')', self.bucket_skip)
            return False
        while i < len(self.minimum_libraries):
            libraryName = self.minimum_libraries[i]
            libraryVersion = self.minimum_libraries[i + 1]
            found, message, actualVersion = RavenUtils.moduleReport(
                libraryName, libraryName + '.__version__')
            if not found:
                self.setStatus(
                    'skipped (Unable to import library: "' + libraryName +
                    '")', self.bucket_skip)
                return False
            if distutils.version.LooseVersion(
                    actualVersion) < distutils.version.LooseVersion(
                        libraryVersion):
                self.setStatus(
                    'skipped (Outdated library: "' + libraryName + '")',
                    self.bucket_skip)
                return False
            i += 2

        if len(self.required_executable) > 0 and \
           not os.path.exists(self.required_executable):
            self.setStatus(
                'skipped (Missing executable: "' + self.required_executable +
                '")', self.bucket_skip)
            return False
        try:
            if len(self.required_executable) > 0 and \
               subprocess.call([self.required_executable],stdout=subprocess.PIPE) != 0:
                self.setStatus(
                    'skipped (Failing executable: "' +
                    self.required_executable + '")', self.bucket_skip)
                return False
        except:
            self.setStatus(
                'skipped (Error when trying executable: "' +
                self.required_executable + '")', self.bucket_skip)
            return False
        filenameSet = set()
        duplicateFiles = []
        for filename in self.__getCreatedFiles():
            if filename not in filenameSet:
                filenameSet.add(filename)
            else:
                duplicateFiles.append(filename)
        if len(duplicateFiles) > 0:
            self.setStatus(
                '[incorrect test] duplicated files specified: ' +
                " ".join(duplicateFiles), self.bucket_skip)
            return False
        return True