def cmd_run(context, iterations, all_clusters_app, lock_app, ota_provider_app, ota_requestor_app, tv_app, pics_file, test_timeout_seconds): runner = chiptest.runner.Runner() if all_clusters_app is None: all_clusters_app = FindBinaryPath('chip-all-clusters-app') if lock_app is None: lock_app = FindBinaryPath('chip-lock-app') if ota_provider_app is None: ota_provider_app = FindBinaryPath('chip-ota-provider-app') if ota_requestor_app is None: ota_requestor_app = FindBinaryPath('chip-ota-requestor-app') if tv_app is None: tv_app = FindBinaryPath('chip-tv-app') # Command execution requires an array paths = chiptest.ApplicationPaths(chip_tool=[context.obj.chip_tool], all_clusters_app=[all_clusters_app], lock_app=[lock_app], ota_provider_app=[ota_provider_app], ota_requestor_app=[ota_requestor_app], tv_app=[tv_app]) if sys.platform == 'linux': chiptest.linux.PrepareNamespacesForTestExecution( context.obj.in_unshare) paths = chiptest.linux.PathsWithNetworkNamespaces(paths) logging.info("Each test will be executed %d times" % iterations) apps_register = AppsRegister() apps_register.init() for i in range(iterations): logging.info("Starting iteration %d" % (i + 1)) for test in context.obj.tests: test_start = time.monotonic() try: if context.obj.dry_run: logging.info("Would run test %s:" % test.name) test.Run(runner, apps_register, paths, pics_file, test_timeout_seconds, context.obj.dry_run) test_end = time.monotonic() logging.info('%-20s - Completed in %0.2f seconds' % (test.name, (test_end - test_start))) except Exception: test_end = time.monotonic() logging.exception('%s - FAILED in %0.2f seconds' % (test.name, (test_end - test_start))) apps_register.uninit() sys.exit(2) apps_register.uninit()
def cmd_run(context, iterations, all_clusters_app, lock_app, tv_app, pics_file): runner = chiptest.runner.Runner() if all_clusters_app is None: all_clusters_app = FindBinaryPath('chip-all-clusters-app') if lock_app is None: lock_app = FindBinaryPath('chip-lock-app') if tv_app is None: tv_app = FindBinaryPath('chip-tv-app') # Command execution requires an array paths = chiptest.ApplicationPaths(chip_tool=[context.obj.chip_tool], all_clusters_app=[all_clusters_app], lock_app=[lock_app], tv_app=[tv_app]) if sys.platform == 'linux': chiptest.linux.PrepareNamespacesForTestExecution( context.obj.in_unshare) paths = chiptest.linux.PathsWithNetworkNamespaces(paths) # Testing prerequisites: tv app requires a config. Copy it just in case shutil.copyfile( os.path.join(context.obj.root, ('examples/tv-app/linux/include/' 'endpoint-configuration/chip_tv_config.ini')), '/tmp/chip_tv_config.ini') logging.info("Each test will be executed %d times" % iterations) apps_register = AppsRegister() apps_register.init() for i in range(iterations): logging.info("Starting iteration %d" % (i + 1)) for test in context.obj.tests: test_start = time.time() try: test.Run(runner, apps_register, paths, pics_file) test_end = time.time() logging.info('%-20s - Completed in %0.2f seconds' % (test.name, (test_end - test_start))) except Exception: test_end = time.time() logging.exception('%s - FAILED in %0.2f seconds' % (test.name, (test_end - test_start))) apps_register.uninit() sys.exit(2) apps_register.uninit()