####################################################################################################################### if __name__ == '__main__': # Configure logging from cfg_multilogging import cfg_multilogging loglevel = 'DEBUG' logname = logname = os.path.splitext(os.path.basename(__file__))[0] logfile = logname + '.LOG' cfg_multilogging(loglevel, logfile) logger = logging.getLogger(logname) logger.debug('START') Vmax_V = 3.8 Imax_A = 5 psu_channel = 'P6V' psuname = 'E3631A_0' #import pl1_testbench_framework.jenkins_interface.common.test_config as tg
def runTest(testconfig_s): """ It allows to start the testbench as a function. For instance: res=runme(log='DEBUG', cmwip='0.0.0.0', rat='LTE', ctrlif='AT', test2execute='[0]', pwrmeas=0, usimemu=0) """ # Configure logging from cfg_multilogging import cfg_multilogging loglevel = testconfig_s.log numeric_level = getattr(logging, loglevel.upper(), None) logging.root.level = numeric_level logfilename = os.sep.join( os.environ['PL1TESTBENCH_ROOT_FOLDER'].split(os.sep)[:] + ['runTest.LOG']) # Create LOG file absolute name cfg_multilogging(loglevel, logfilename) logger = logging.getLogger('runTest') # Further checks on arguments if testconfig_s.testerip is None: logger.error("ERROR: runme() : specify a valid CMW500 IP address") return CfgError.ERRCODE_TEST_FAILURE_PARAMCONFIG if testconfig_s.ctrlif is None: logger.error("ERROR: runme() : specify a valid control interface") return CfgError.ERRCODE_TEST_FAILURE_PARAMCONFIG if testconfig_s.rat.upper() == 'GSM' or testconfig_s.rat.upper( ) == 'WCDMA': logger.error("ERROR: RAT not supported yet") return CfgError.ERRCODE_TEST_FAILURE_PARAMCONFIG if (testconfig_s.psu or testconfig_s.pwrmeas) and testconfig_s.psugwip is None: logger.error("ERROR: runme() : specify a valid PSU Gateway IP address") return CfgError.ERRCODE_TEST_FAILURE_PARAMCONFIG # Build and check the absoulte path of the XML testplan file testconfig_s.testplan = testconfig_s.testplan.replace('/', os.sep) testconfig_s.testplan = os.path.join( os.environ['PL1TESTBENCH_ROOT_FOLDER'], testconfig_s.testplan) if not os.path.isfile(testconfig_s.testplan): logger.error("XML testplan file not found: %s" % testconfig_s.testplan) sys.exit(CfgError.ERRCODE_SYS_FILE_IO) # Show info logger.info( "*****************************************************************************************" ) logger.info("Starting test with the following configuration:") testconfig_s.struct_log(excl_l=['remoteDBpwd', 'scdu_pwd']) logger.info( "*****************************************************************************************" ) # Select and start the test (function) if testconfig_s.rat in ['LTE_FDD', 'LTE_TDD', 'LTE_CA']: func_table = { 'LTE_FDD': TestbenchLTE, 'LTE_TDD': TestbenchLTE, 'LTE_CA': TestbenchLTE } # 'WCDMA':TestbenchWCDMA, 'GSM':TestbenchGSM func = func_table[testconfig_s.rat] logger.debug("Calling %s..." % func) res = func(testconfig_s) else: logger.error( "Invalid RAT : %s, valid range {LTE_FDD, LTE_TDD, LTE_CA}" % testconfig_s.rat) res = CfgError.ERRCODE_TEST_PARAM_INVALID logger.info("EXIT STATUS : (%s, %s)" % (res, CfgError.MSG[res])) return res
self.cursor.execute("INSERT INTO testruns(timestamp, branch, clnum, mod_files, p4webrev, cmwinfo, modeminfo) VALUES (?,?,?,?,?,?,?)",(timestamp, branch, clnum, mod_files, p4webrev, cmwinfo, modeminfo)) return self.get_testrun_id(timestamp, branch, clnum, mod_files, p4webrev) def __str__(self): print "---------------------------------------" print " file_database : %s" % self.name print " conn : %s" % self.conn print " cursor : %s" % self.cursor return "" if __name__ == '__main__': from Struct import Struct from cfg_multilogging import cfg_multilogging cfg_multilogging('DEBUG', 'DatabasePl1Testbench.LOG') logger=logging.getLogger('DatabasePl1Testbench') t0=time.localtime() # Define folders hierarchy dir_root =os.sep.join(os.environ['PL1TESTBENCH_ROOT_FOLDER'].split(os.sep)[:]) dir_database =os.sep.join(dir_root.split(os.sep)[:]+['lte', 'common','report','sqllite', 'database']) dir_export =os.sep.join(dir_root.split(os.sep)[:]+['lte', 'common','report','sqllite', 'database', 'export']) dir_import =os.sep.join(dir_root.split(os.sep)[:]+['lte', 'common','report','sqllite', 'database', 'import']) #file_database =os.sep.join(dir_database.split(os.sep)[:]+['perf_bestscore_20140909_Win8.db']) file_database =os.sep.join(dir_database.split(os.sep)[:]+['pl1testbench_lte_20140909_Linux.db']) #logger=cfg_logger_root('DEBUG', log_file) logger.info("FOLDER HIERARCHY :")
"Creating result record for testrun_id %d, platform_id %d, param_id %d", testrun_id, platform_id, param_id) self.cursor.execute( "INSERT INTO lte_results(testrun_id, platform_id, param_id, valid, dlrely, dlthr, dlbler, cqi, ack, nack, dtx, sf_total, sf_scheduled, ulrely, ulthr, ulbler, crc_pass, crc_fail, best_dlthr, best_ulthr, tolerance, verdict_dl, verdict_ul, current_mA, pwr3p8V_mW) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", (testrun_id, platform_id, param_id, valid, dlrely, dlthr, dlbler, cqi, ack, nack, dtx, sf_total, sf_scheduled, ulrely, ulthr, ulbler, crc_pass, crc_fail, best_dlthr, best_ulthr, tolerance, verdict_dl, verdict_ul, current_mA, pwr3p8V_mW)) return self.get_result_id_lte(testrun_id, platform_id, param_id) if __name__ == '__main__': from Struct import Struct from cfg_multilogging import cfg_multilogging cfg_multilogging('INFO', 'DatabasePl1TestbenchLte.LOG') logger = logging.getLogger('DatabasePl1Testbench') t0 = time.localtime() # Define folders hierarchy dir_root = os.sep.join(os.environ['PL1TESTBENCH_ROOT_FOLDER'].split( os.sep)[:]) dir_database = os.sep.join( dir_root.split(os.sep)[:] + ['lte', 'common', 'report', 'sqllite', 'database', '20140925']) dir_export = os.sep.join( dir_root.split(os.sep)[:] + [ 'lte', 'common', 'report', 'sqllite', 'database', 'export', '20140925' ])
while remaining_time > 0: time.sleep(poll_time_sec) remaining_time -= poll_time_sec logger.debug("remaining time %s" % remaining_time) try: found_port = auto_detect_port(portName=portName, suppressPrint=1) if not found_port is None: break except: continue return found_port if __name__ == '__main__': from cfg_multilogging import cfg_multilogging cfg_multilogging('DEBUG', 'Serial_ComPortDet.LOG') logger = logging.getLogger('Serial_ComPortDet') if 0: modemPortNum = auto_detect_port("Modem_port") if modemPortNum is None: logger.error("MODEM port not found") logger.info("Selected MODEM port : %s " % modemPortNum) atPortNum = auto_detect_port("at_port") if atPortNum is None: logger.error("AT port not found") logger.info("Selected AT port : %s " % atPortNum) if 1: if poll_for_port(portName="Modem_port") is None:
remaining_time -= step logger.info("remaining time : %s [sec]" % remaining_time) if __name__ == '__main__': import sys, os sys.path.append(os.sep.join(os.path.abspath('..').split(os.sep)[:]+['config'])) from cfg_multilogging import cfg_multilogging cfg_multilogging('DEBUG', 'adbtest.LOG') logger=logging.getLogger('Android_Modem') devicetag=adb_device_tag() adb_modem_reboot() modeminfo=adb_modem_info() adb_modem_config(rat='LTE', rfband=1, usimemu=0) adb_modem_on() adb_airplanemode_on() raw_input("Press [ENTER]") adb_airplanemode_off() adb_modem_off()