def main(self): """Main.""" # Workaround for logging error: "UnicodeEncodeError: 'charmap' codec can't # encode character '\xe6' in position 138: character maps to <undefined>", # which occurs under Windows with default encoding other than cp1252 # each time log() is called. _locale._getdefaultlocale = (lambda *args: ['en_US', 'utf8']) args = self.parse_args() # root privileges only needed for native mode. if args.hci is not None: if not have_admin_rights(): sys.exit("Please run this program as root.") elif have_admin_rights(): sys.exit("Please do not run this program as root.") if args.store: tc_db_table_name = self.store_tag + str(args.board) else: tc_db_table_name = None ptses = init_pts(args, tc_db_table_name) btp.init(self.get_iut) self.init_iutctl(args) stack.init_stack() stack_inst = stack.get_stack() stack_inst.synch_init([pts.callback_thread for pts in ptses]) self.setup_project_pixits(ptses) self.setup_test_cases(ptses) run_test_cases(ptses, self.test_cases, args) self.cleanup() print("\nBye!") sys.stdout.flush() for pts in ptses: pts.unregister_xmlrpc_ptscallback() # not the cleanest but the easiest way to exit the server thread os._exit(0)
def main(): """Main.""" # Workaround for logging error: "UnicodeEncodeError: 'charmap' codec can't # encode character '\xe6' in position 138: character maps to <undefined>", # which occurs under Windows with default encoding other than cp1252 # each time log() is called. _locale._getdefaultlocale = (lambda *args: ['en_US', 'utf8']) if have_admin_rights(): # root privileges are not needed sys.exit("Please do not run this program as root.") args = parse_args() if args.store: tc_db_table_name = "zephyr_" + str(args.board) else: tc_db_table_name = None ptses = autoptsclient.init_pts(args, tc_db_table_name) btp.init(get_iut) autoprojects.iutctl.init(args.kernel_image, args.tty_file, args.board, args.rtt2pty) stack.init_stack() stack_inst = stack.get_stack() stack_inst.synch_init([pts.callback_thread for pts in ptses]) # Setup project PIXITS autoprojects.gap.set_pixits(ptses[0]) autoprojects.dis.set_pixits(ptses[0]) autoprojects.sm.set_pixits(ptses[0]) autoprojects.l2cap.set_pixits(ptses[0]) autoprojects.gatt.set_pixits(ptses) autoprojects.mesh.set_pixits(ptses) test_cases = autoprojects.gap.test_cases(ptses[0]) test_cases += autoprojects.dis.test_cases(ptses) test_cases += autoprojects.gatt.test_cases(ptses) test_cases += autoprojects.sm.test_cases(ptses[0]) test_cases += autoprojects.l2cap.test_cases(ptses[0]) test_cases += autoprojects.mesh.test_cases(ptses) autoptsclient.run_test_cases(ptses, test_cases, args) autoprojects.iutctl.cleanup() print("\nBye!") sys.stdout.flush() for pts in ptses: pts.unregister_xmlrpc_ptscallback() # not the cleanest but the easiest way to exit the server thread os._exit(0)
if __name__ == '__main__': def sigint_handler(sig, frame): set_end() if sys.platform != 'win32': signal.signal(signal.SIGINT, prev_sigint_handler) threading.Thread(target=signal.raise_signal(signal.SIGINT)).start() else: kill_processes('python.exe') kill_processes('PTS.exe') kill_processes('Fts.exe') print('Cron started') if have_admin_rights(): # root privileges are not needed print('Please do not run this program as root.') sys.exit(1) for cron in cron_config.github_crons: for tag in cron.tags: cfg = cron.tags[tag].cfg if not os.path.exists(os.path.join(AUTOPTS_REPO, 'bot/{}.py'.format(cfg))): raise Exception('{} config does not exists!'.format(cfg)) for job in cron_config.cyclical_jobs: cfg = job.cfg if not os.path.exists(os.path.join(AUTOPTS_REPO, 'bot/{}.py'.format(cfg))): raise Exception('{} config does not exists!'.format(cfg)) prev_sigint_handler = signal.getsignal(signal.SIGINT)