Exemple #1
0
    def output(self):
        """
        Return test output
        """
        file_exists = os.path.isfile(self._output_file_name)
        is_readable = os.access(self._output_file_name, os.R_OK)
        if file_exists and is_readable:
            return read_file(self._output_file_name)

        return "Failed to read output file: %s" % self._output_file_name
Exemple #2
0
    def _read_test_results(self, file_name):
        """
        Read test results from yasa_results file
        """
        results = {}
        for name in self._test_cases:
            results[name] = {}
            results[name]['reasonMsg'] = ''
            results[name]['status'] = FAILED

        if not ostools.file_exists(file_name):
            return results

        test_results = ostools.read_file(file_name)

        (userSimCheckFunc, userSimCheckFile) = userSimCheck()
        if userSimCheckFile:
            sys.path.append(os.path.dirname(userSimCheckFile))
            from userSimCheck import userSimCheck as simCheck
            checker=simCheck()
        else:
            checker= self._simulator_if.simCheck
        #elif self._simulator_if.name =='vcs':
        #    from Simulator.vcsInterface import vcsSimCheck
        #    checker=vcsSimCheck()
        #elif self._simulator_if.name =='irun':
        #    from Simulator.incisiveInterface import irunSimCheck 
        #    checker=irunSimCheck()
        #elif self._simulator_if.name =='xrun':
        #    from Simulator.xceliumInterface import xrunSimCheck 
        #    checker=xrunSimCheck()

        checker.resetStatus()
        for line in test_results.splitlines():
            line = line.strip()
            checker.check(line)
        status, reasonMsg = checker.status

        for test_name in self._test_cases:
            if status == 'PASS':
                results[test_name]['status'] = PASSED
            else:
                results[test_name]['reasonMsg'] = reasonMsg
                if status == 'WARN':
                    results[test_name]['status'] = WARNED
                elif status == 'FAIL':
                    results[test_name]['status'] = FAILED

        for test_name in results:
            if test_name not in self._test_cases:
                raise RuntimeError("Got unknown test case %s" % test_name)

        return results