Ejemplo n.º 1
0
def CreateTestRun(args, env, test_instance, error_func):
    if isinstance(env, local_device_environment.LocalDeviceEnvironment):
        if isinstance(test_instance, gtest_test_instance.GtestTestInstance):
            return local_device_gtest_run.LocalDeviceGtestRun(
                env, test_instance)
        if isinstance(
                test_instance,
                instrumentation_test_instance.InstrumentationTestInstance):
            return (local_device_instrumentation_test_run.
                    LocalDeviceInstrumentationTestRun(env, test_instance))
        if isinstance(test_instance, linker_test_instance.LinkerTestInstance):
            return (local_device_linker_test_run.LocalDeviceLinkerTestRun(
                env, test_instance))
        if isinstance(test_instance, monkey_test_instance.MonkeyTestInstance):
            return (local_device_monkey_test_run.LocalDeviceMonkeyTestRun(
                env, test_instance))
        if isinstance(test_instance, perf_test_instance.PerfTestInstance):
            return _CreatePerfTestRun(args, env, test_instance)

    if isinstance(env, local_machine_environment.LocalMachineEnvironment):
        if isinstance(test_instance, junit_test_instance.JunitTestInstance):
            return (local_machine_junit_test_run.LocalMachineJunitTestRun(
                env, test_instance))

    error_func('Unable to create test run for %s tests in %s environment' %
               (str(test_instance), str(env)))
Ejemplo n.º 2
0
def CreateTestRun(env, test_instance, error_func):
    if isinstance(env, local_device_environment.LocalDeviceEnvironment):
        if isinstance(test_instance, gtest_test_instance.GtestTestInstance):
            return local_device_gtest_run.LocalDeviceGtestRun(
                env, test_instance)
        if isinstance(
                test_instance,
                instrumentation_test_instance.InstrumentationTestInstance):
            return (local_device_instrumentation_test_run.
                    LocalDeviceInstrumentationTestRun(env, test_instance))
        if isinstance(test_instance, monkey_test_instance.MonkeyTestInstance):
            return (local_device_monkey_test_run.LocalDeviceMonkeyTestRun(
                env, test_instance))

    if isinstance(env, local_machine_environment.LocalMachineEnvironment):
        if isinstance(test_instance, junit_test_instance.JunitTestInstance):
            return (local_machine_junit_test_run.LocalMachineJunitTestRun(
                env, test_instance))

    error_func('Unable to create test run for %s tests in %s environment' %
               (str(test_instance), str(env)))
    raise RuntimeError('error_func must call exit inside.')