Example #1
0
def main():
    owd = os.getcwd()
    cmdFile_dict = {}
    testfiles = []
    testfiles.append(os.path.join('.', 'testfiles', 'iocBoot', 'ioc495idc', 'st.cmd'))
    IOC_NAME = 'testing'
    env = {}
    for i, tf in enumerate(testfiles):
        try:
            os.chdir(os.path.dirname(os.path.abspath(tf)))
            ref = utils.FileRef(__file__, i, 0, 'testing')
            cmdFile_object = CommandFile(None, os.path.split(tf)[-1], ref, env)
        except Exception:
            traceback.print_exc()
            continue
        cmdFile_dict[tf] = cmdFile_object
        
        os.chdir(owd)
        reports.reportCmdFile(cmdFile_object, IOC_NAME)
Example #2
0
def describe(ioc_name, st_cmd, output_path=None, report_file_cache=True):
    filename = os.path.abspath(st_cmd)
    path = os.path.dirname(filename)

    owd = os.getcwd()
    os.chdir(path)
    ref = utils.FileRef(__file__, 0, 0, ioc_name)
    env = {}
    utils.logMessage('IOC startup file: ' + st_cmd, utils.LOGGING_DETAIL__CERTAIN)
    short_name = os.path.split(filename)[-1]
    obj = command_file.CommandFile(None, short_name, ref, **env)
    
    os.chdir(owd)
    if output_path is None:
        reports.reportCmdFile(obj, ioc_name)
    else:
        os.chdir(output_path)
        reports.writeReports(obj, ioc_name, report_file_cache)
        os.chdir(owd)
    
    return obj