Example #1
0
 def tes1t_InitDUTs(self):
     from runner import initDUT
     logpath ='./log'
     from common import bench2dict
     bench =bench2dict('./bench.csv')
     duts= initDUT(bench,['lnx1', 'lnx2'])
     print(duts)
Example #2
0
 def tes1t_InitDUTs(self):
     from runner import initDUT
     logpath = './log'
     from common import bench2dict
     bench = bench2dict('./bench.csv')
     duts = initDUT(bench, ['lnx1', 'lnx2'])
     print(duts)
Example #3
0
 def init_duts(self, *dut_names):
     tmp =[]
     for dut_name in dut_names:
         if dut_name not in self.bench.keys():
             self.error(dut_name, 'is not defined in bench file ', self.bench_file)
             raise Exception('%s is not defined in bench file %s'%(dut_name, self.bench_file))
         elif dut_name in self.dut_names:
             self.info(dut_name, ' already existed!')
             #raise Exception('%s already existed! '%(dut_name, self.bench_file))
         else:
             tmp.append(dut_name)
     self.dut_names +=tmp
     self.duts.update(initDUT(self.error_message,self.bench,self.dut_names,self.logger,self.log_dir, self.share_data,self.dry_run))
     return  self.duts
Example #4
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
Example #5
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
Example #6
0
        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']
        duts= initDUT(errormessage,bench, ldut,logger, casefolder, sharedata)
        seq = [cs.seqSetup, cs.seqRun, cs.seqTeardown]

        caseFail, CaseErrorMessage= case_runner(case_file_name,duts,seq, mode, logger,sharedata)

        from runner import releaseDUTs
        releaseDUTs(duts, logger)
        if caseFail:
            with open('%s/case_error.txt'%casefolder, 'a+') as ef:
                ef.write(CaseErrorMessage)
            print(CaseErrorMessage)
            raise Exception(CaseErrorMessage)
        else:
            print('log: "@%s"'%os.path.abspath(casefolder))
            print ("\r\n---------------------------------- CASE PASS ----------------------------------")
            os._exit(0)
Example #7
0
        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']
        duts = initDUT(errormessage, bench, ldut, logger, casefolder,
                       sharedata)
        seq = [cs.seqSetup, cs.seqRun, cs.seqTeardown]

        caseFail, CaseErrorMessage = case_runner(case_file_name, duts, seq,
                                                 mode, logger, sharedata)

        from runner import releaseDUTs
        releaseDUTs(duts, logger)
        if caseFail:
            with open('%s/case_error.txt' % casefolder, 'a+') as ef:
                ef.write(CaseErrorMessage)
            print(CaseErrorMessage)
            raise Exception(CaseErrorMessage)
        else:
            print('log: "@%s"' % os.path.abspath(casefolder))
            print(