Ejemplo n.º 1
0
    def extract_results(self, arg_result, arg_log, arg_elog):

        # extract information from the generate log
        my_result, my_error = self.query_logs(arg_log, arg_elog)
        Msg.user("Process: %s" % (str(arg_result)), "RTL-SIM")
        Msg.user("Log[%s]: []" % (str(arg_log)), "RTL-SIM")

        process_ret_code = int(arg_result[RtlResult.process_retcode])
        test_passed = my_result[RtlResult.rtl_passed]

        if ((process_ret_code == 0) and not test_passed):
            Msg.warn(
                "[RTL-SIM] Test Passed=%s, but process return code is %d, changing return code to 1"
                % (str(test_passed), process_ret_code))
            process_ret_code = 1

        my_process_data = {
            RtlKeys.rtl_retcode: process_ret_code,
            RtlKeys.rtl_stdout: str(arg_result[RtlResult.process_stdout]),
            RtlKeys.rtl_stderr: str(arg_result[RtlResult.process_stderr]),
            RtlKeys.rtl_start: str(arg_result[RtlResult.process_start]),
            RtlKeys.rtl_end: str(arg_result[RtlResult.process_end]),
            RtlKeys.rtl_count: int(my_result[RtlResult.rtl_cycle_count]),
            RtlKeys.rtl_message: str(my_result[RtlResult.rtl_message])
            # {{{TODO}}} following line deprecated
            ,
            RtlKeys.rtl_log: arg_log
        }

        return my_process_data
Ejemplo n.º 2
0
    def option_def(self, aSwitch, aDefVal=None, aConversionFunc=None):
        # TODO deprecate this
        return_value = self._mAppsInfo.mCmdLineOpts.option_def(aSwitch, aDefVal)
        if aConversionFunc and return_value is not None:
            try:
                return_value = aConversionFunc(return_value)
            except (TypeError, ValueError) as ex:
                Msg.warn('Invalid value "{}" provided for "{}".  Using default.'.format(repr(return_value), aSwitch))
                return aDefVal

        return return_value
Ejemplo n.º 3
0
 def envar(cls, arg_key, arg_defval=None, arg_def_warn=True):
     try:
         return os.environ[arg_key]
     except KeyError as arg_ex:
         if arg_defval is None:
             Msg.warn(arg_key + " Not found in environmental variables, "
                      "NO DEFAULT VALUE SPECIFIED!")
         elif arg_def_warn:
             Msg.warn(arg_key + " Not found in environmental variables, "
                      'using default value "' + str(arg_defval) + '"')
     return arg_defval
Ejemplo n.º 4
0
    def rmdir(arg_class, arg_dir, arg_force=False):
        Msg.dbg("PathUtils.rmdir( %s, %s )" % (arg_dir, str(arg_force)))
        try:
            if arg_force:
                # remove a directory regardless of the contents
                shutil.rmtree(arg_dir)
            else:
                os.rmdir(arg_dir)
            Msg.dbg("Success: Directory Removed: %s" % (arg_dir))

        except OSError as arg_ex:
            if PathUtils.check_dir(arg_dir):
                Msg.err("Fail, Unable to Remove Directory: %s" % (arg_dir))
                return False
            Msg.warn("Directory does not exists, Remove Failed: %s " %
                     (arg_dir))
        return True