Exemplo n.º 1
0
    def __init__(self, name=None, bench=None, log_folder=None, dry_run =False):
        self.name = name if name else 'case'
        self.log_dir = '../../log' if log_folder is None else log_folder

        if not os.path.exists(self.log_dir ):
            os.mkdir(self.log_dir )
        self.log_dir = createLogDir(self.name, self.log_dir)
        self.logger = createLogger(name, self.log_dir)
        self.load_bench(bench)
        self.error_message=''
        self.duts={}
        self.dut_names =[]
        self.share_data = {}
        self.set_dry_run(dry_run)
Exemplo n.º 2
0
    def test_PowerShell(self):
        from runner import case_runner, initDUT, createLogDir, createLogger
        logpath ='./log'
        if not os.path.exists(logpath):
            os.mkdir(logpath)
        logpath+='/PowerShell'
        logger = createLogger('PowerShell', logpath)
        casename = 'PowerShell_1'
        casefolder = createLogDir(casename,logpath)

        from common import bench2dict
        where= 'nohome'
        benchfile = './bench.csv'
        casefile = './powershell.csv'
        if where=='home':
            benchfile= './home.csv'
            casefile = './home_case.csv'

        bench =bench2dict(benchfile)


        from Parser import  caseParser
        mode = 'full'
        cs = caseParser(casename, mode, casefolder)

        sdut, lvar, lsetup, lrun, ltear =cs.load(casefile)
        ldut = list(sdut)
        errormessage =[]
        duts= initDUT(errormessage,bench,ldut,logger, casefolder)#['lnx1', 'lnx2']
        seq = [cs.seqSetup, cs.seqRun, cs.seqTeardown]
        case= case_runner(casename,duts,seq, mode)


        print(duts)
        for name in duts.keys():
            dut = duts[name]
            if dut :
                dut.SessionAlive=False
Exemplo n.º 3
0
    def test_PowerShell(self):
        from runner import case_runner, initDUT, createLogDir, createLogger
        logpath = './log'
        if not os.path.exists(logpath):
            os.mkdir(logpath)
        logpath += '/PowerShell'
        logger = createLogger('PowerShell', logpath)
        casename = 'PowerShell_1'
        casefolder = createLogDir(casename, logpath)

        from common import bench2dict
        where = 'nohome'
        benchfile = './bench.csv'
        casefile = './powershell.csv'
        if where == 'home':
            benchfile = './home.csv'
            casefile = './home_case.csv'

        bench = bench2dict(benchfile)

        from Parser import caseParser
        mode = 'full'
        cs = caseParser(casename, mode, casefolder)

        sdut, lvar, lsetup, lrun, ltear = cs.load(casefile)
        ldut = list(sdut)
        errormessage = []
        duts = initDUT(errormessage, bench, ldut, logger,
                       casefolder)  #['lnx1', 'lnx2']
        seq = [cs.seqSetup, cs.seqRun, cs.seqTeardown]
        case = case_runner(casename, duts, seq, mode)

        print(duts)
        for name in duts.keys():
            dut = duts[name]
            if dut:
                dut.SessionAlive = False
Exemplo n.º 4
0
    suitelogdir = '../../log'
    rangelist = sys.argv[2]
    arglist = sys.argv[3:]
    if not os.path.exists(suitelogdir):
        os.mkdir(suitelogdir)

    suitelogdir = createLogDir(name, suitelogdir, add_time=False)
    st = suiteParser(name, suitelogdir)
    lstRange = GetRange(rangelist)
    statsTotalCase, suite = st.load(suitefile, arglist, lstRange)

    benchfile = ''
    benchinfo = {}
    from runner import createLogger
    suite_logger = createLogger('suite.txt', suitelogdir)
    suite_logger.info('suite name\t%s' % (sys.argv[1]))
    suite_logger.info('suite range\t%s' % (sys.argv[2]))

    index = 1
    for i in sys.argv[3:]:
        suite_logger.info('arg%d\t%s' % (index, i))
        index += 1
    report = []
    dut_pool = {}
    #    3, break, run_case_in_suite, rc.py2 home_case.csv home.csv full
    #	9, concurrent, loop, 2 ,no_stop ,rc.py5 home_case.csv home.csv full
    #	9, concurren,FailAction,FuncName,cmd =case, run_case_in_suite, rc.py7 home_case.csv home.csv full
    index = 1
    from runner import run_case_in_suite, releaseDUTs, createLogDir, array2html, run1case
Exemplo n.º 5
0
            segment:    segment of case, not case sensitive, it's one of [full, setup, run, teardown, nosetup, noteardown, f, s, r , t, ns, nr, nt]
            argX   :    argment(s) for substituting in case file
            logpath:    full path name for log, default is ./log/
            '''
            print(errormessage)
        from runner import case_runner, initDUT, createLogDir      ,createLogger
        if os.path.exists(sys.argv[-1]):
            pass
        else:
            sys.argv.append(defaultlogdir)
        if not os.path.exists(defaultlogdir):
            os.mkdir(defaultlogdir)
        defaultlogdir=sys.argv[-1]
        basename_casename = os.path.basename(sys.argv[1])
        casefolder = createLogDir(basename_casename,defaultlogdir)
        logger = createLogger(basename_casename, casefolder)


        from common import bench2dict
        benchfile = sys.argv[2]
        bench =bench2dict(benchfile)


        from Parser import  caseParser
        mode = sys.argv[3]
        case_file_name =os.path.abspath(sys.argv[1])
        cs = caseParser(case_file_name, mode, casefolder)
        casefile = case_file_name
        sdut, lvar, lsetup, lrun, ltear =cs.load(casefile, sys.argv)
        ldut = list(sdut)
        errormessage =[]
Exemplo n.º 6
0
    suitelogdir = '../../log'
    rangelist = sys.argv[2]
    arglist = sys.argv[3:]
    if not os.path.exists(suitelogdir):
        os.mkdir(suitelogdir)

    suitelogdir = createLogDir(name, suitelogdir, add_time=False)
    st = suiteParser(name, suitelogdir)
    lstRange = GetRange(rangelist )
    statsTotalCase, suite= st.load(suitefile, arglist, lstRange)

    benchfile =''
    benchinfo ={}
    from runner import createLogger
    suite_logger = createLogger('suite.txt', suitelogdir)
    suite_logger.info('suite name\t%s' % (sys.argv[1]))
    suite_logger.info('suite range\t%s' % (sys.argv[2]))

    index = 1
    for i in sys.argv[3:]:
        suite_logger.info('arg%d\t%s' % (index, i))
        index+=1
    report = []
    dut_pool={}
#    3, break, run_case_in_suite, rc.py2 home_case.csv home.csv full
#	9, concurrent, loop, 2 ,no_stop ,rc.py5 home_case.csv home.csv full
#	9, concurren,FailAction,FuncName,cmd =case, run_case_in_suite, rc.py7 home_case.csv home.csv full
    index = 1
    from runner import run_case_in_suite , releaseDUTs , createLogDir, array2html, run1case
Exemplo n.º 7
0
            segment:    segment of case, not case sensitive, it's one of [full, setup, run, teardown, nosetup, noteardown, f, s, r , t, ns, nr, nt]
            argX   :    argment(s) for substituting in case file
            logpath:    full path name for log, default is ./log/
            '''
            print(errormessage)
        from runner import case_runner, initDUT, createLogDir, createLogger
        if os.path.exists(sys.argv[-1]):
            pass
        else:
            sys.argv.append(defaultlogdir)
        if not os.path.exists(defaultlogdir):
            os.mkdir(defaultlogdir)
        defaultlogdir = sys.argv[-1]
        basename_casename = os.path.basename(sys.argv[1])
        casefolder = createLogDir(basename_casename, defaultlogdir)
        logger = createLogger(basename_casename, casefolder)

        from common import bench2dict
        benchfile = sys.argv[2]
        bench = bench2dict(benchfile)

        from Parser import caseParser
        mode = sys.argv[3]
        case_file_name = os.path.abspath(sys.argv[1])
        cs = caseParser(case_file_name, mode, casefolder)
        casefile = case_file_name
        sdut, lvar, lsetup, lrun, ltear = cs.load(casefile, sys.argv)
        ldut = list(sdut)
        errormessage = []
        sharedata = {}
        #duts= initDUT(errormessage,bench,ldut,logger, casefolder)#['lnx1', 'lnx2']