def MainTestWrapper(options):
    try:
        # Spawn logcat monitor
        SpawnLogcatMonitor()

        # Run all device setup steps
        for _, cmd in GetDeviceSetupStepCmds():
            cmd(options)

        if options.install:
            test_obj = INSTRUMENTATION_TESTS[options.install]
            InstallApk(options, test_obj, print_step=True)

        if options.test_filter:
            bb_utils.RunSteps(options.test_filter, GetTestStepCmds(), options)

        if options.coverage_bucket:
            coverage_html = GenerateJavaCoverageReport(options)
            UploadHTML(options, '%s/java' % options.coverage_bucket,
                       coverage_html, 'Coverage Report')

        if options.experimental:
            RunTestSuites(options, gtest_config.EXPERIMENTAL_TEST_SUITES)

    finally:
        # Run all post test steps
        LogcatDump(options)
        GenerateTestReport(options)
        # KillHostHeartbeat() has logic to check if heartbeat process is running,
        # and kills only if it finds the process is running on the host.
        provision_devices.KillHostHeartbeat()
Beispiel #2
0
def MainTestWrapper(options):
    exit_code = 0
    try:
        # Spawn logcat monitor
        SpawnLogcatMonitor()

        # Run all device setup steps
        for _, cmd in GetDeviceSetupStepCmds():
            cmd(options)

        if options.install:
            for i in options.install:
                install_obj = INSTALLABLE_PACKAGES[i]
                InstallApk(options, install_obj, print_step=True)

        if options.test_filter:
            exit_code = bb_utils.RunSteps(
                options.test_filter, GetTestStepCmds(), options) or exit_code

        if options.coverage_bucket:
            coverage_html = GenerateJavaCoverageReport(options)
            UploadHTML(options, '%s/java' % options.coverage_bucket,
                       coverage_html, 'Coverage Report')
            shutil.rmtree(coverage_html, ignore_errors=True)

        if options.experimental:
            exit_code = RunTestSuites(
                options, gtest_config.EXPERIMENTAL_TEST_SUITES) or exit_code

        return exit_code

    finally:
        # Run all post test steps
        LogcatDump(options)
        if not options.disable_stack_tool:
            RunStackToolSteps(options)
        GenerateTestReport(options)
        # KillHostHeartbeat() has logic to check if heartbeat process is running,
        # and kills only if it finds the process is running on the host.
        provision_devices.KillHostHeartbeat()
        if options.cleanup:
            shutil.rmtree(os.path.join(CHROME_OUT_DIR, options.target),
                          ignore_errors=True)