Beispiel #1
0
def test_ClLauncherHarness_RunTestcases_no_testbed():
    """Test that invalid request params returned if no testbed requested."""
    config = harness_pb2.ClLauncherHarness()
    harness = cl_launcher.ClLauncherHarness(config)
    req = harness_pb2.RunTestcasesRequest(testbed=None, testcases=[])
    res = harness.RunTestcases(req, None)
    assert (res.status.returncode ==
            service_pb2.ServiceStatus.INVALID_REQUEST_PARAMETERS)
    assert res.status.error_message == "Requested testbed not found."
Beispiel #2
0
def test_ClLauncherHarness_RunTestcases_no_testcases():
    """Test that empty results returned if no testcase requested."""
    config = harness_pb2.ClLauncherHarness()
    harness = cl_launcher.ClLauncherHarness(config)
    assert len(harness.testbeds)
    req = harness_pb2.RunTestcasesRequest(testbed=harness.testbeds[0],
                                          testcases=[])
    res = harness.RunTestcases(req, None)
    assert res.status.returncode == service_pb2.ServiceStatus.SUCCESS
    assert not res.results
Beispiel #3
0
def test_ClLauncherHarness_oclgrind_testbed():
    """Test that harness can be made from project-local oclgrind."""
    config = harness_pb2.ClLauncherHarness()
    config.opencl_env.extend([
        env.OclgrindOpenCLEnvironment().name,
        env.OclgrindOpenCLEnvironment().name
    ])
    config.opencl_opt.extend([True, False])
    harness = cl_launcher.ClLauncherHarness(config)
    assert len(harness.testbeds) == 2
    assert harness.testbeds[0].name == env.OclgrindOpenCLEnvironment().name
    assert harness.testbeds[0].opts["opencl_opt"] == "enabled"
    assert harness.testbeds[1].name == env.OclgrindOpenCLEnvironment().name
    assert harness.testbeds[1].opts["opencl_opt"] == "disabled"
Beispiel #4
0
def main(argv):
    """Main entry point."""
    if len(argv) > 1:
        raise app.UsageError('Unrecognized arguments')
    config = services.ServiceConfigFromFlag('harness_config',
                                            harness_pb2.ClLauncherHarness())
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    services.AssertLocalServiceHostname(config.service)
    service = ClLauncherHarness(config)
    harness_pb2_grpc.add_HarnessServiceServicer_to_server(service, server)
    server.add_insecure_port(f'[::]:{config.service.port}')
    logging.info('%s listening on %s:%s',
                 type(service).__name__, config.service.hostname,
                 config.service.port)
    server.start()
    try:
        while True:
            time.sleep(3600 * 24)
    except KeyboardInterrupt:
        server.stop(0)
Beispiel #5
0
def abc_harness_config() -> harness_pb2.ClLauncherHarness:
    """A test fixture which returns an oclgrind harness config."""
    config = harness_pb2.ClLauncherHarness()
    config.opencl_env.extend([env.OclgrindOpenCLEnvironment().name])
    config.opencl_opt.extend([True])
    return config
Beispiel #6
0
def cl_launcher_harness_config() -> harness_pb2.ClLauncherHarness:
  """Test fixture to return a cl_launcher test harness."""
  config = harness_pb2.ClLauncherHarness()
  config.opencl_env.extend([env.OclgrindOpenCLEnvironment().name])
  config.opencl_opt.extend([True])
  return config