blob: 6240dfb95bdece7d0177be27a28162f10bc47143 [file] [log] [blame]
julhal013ec4c322021-02-05 17:30:49 +00001// SPDX-License-Identifier: BSD-2-Clause
2/*
3 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
4 */
5
6#include <service/test_runner/client/cpp/test_runner_client.h>
7#include <app/remote-test-runner/remote_test_runner.h>
8#include <protocols/rpc/common/packed-c/encoding.h>
9#include <service_locator.h>
10#include <rpc_caller.h>
11#include <cstdio>
12
13int main(int argc, char *argv[]) {
14 (void) argc;
15 (void) argv;
16
17 int status = -1;
18 struct service_context *test_runner_service_context = NULL;
19
20 service_locator_init();
21
Imre Kis9f6f1b42023-08-02 16:24:10 +020022 test_runner_service_context = service_locator_query("sn:trustedfirmware.org:test-runner:0");
julhal013ec4c322021-02-05 17:30:49 +000023
24 if (test_runner_service_context) {
25
Imre Kis9f6f1b42023-08-02 16:24:10 +020026 struct rpc_caller_session *session = NULL;
julhal013ec4c322021-02-05 17:30:49 +000027
Imre Kis9f6f1b42023-08-02 16:24:10 +020028 session = service_context_open(test_runner_service_context);
julhal013ec4c322021-02-05 17:30:49 +000029
Imre Kis9f6f1b42023-08-02 16:24:10 +020030 if (session) {
julhal013ec4c322021-02-05 17:30:49 +000031
Imre Kis9f6f1b42023-08-02 16:24:10 +020032 test_runner_client test_runner_client(session);
julhal013ec4c322021-02-05 17:30:49 +000033 remote_test_runner commandline_runner(&test_runner_client);
34
35 status = commandline_runner.execute(argc, argv);
36
37 if (status != 0) {
38 printf("Command failed with test status: %d rpc status: %d\n", status, test_runner_client.err_rpc_status());
39 }
40
Imre Kis9f6f1b42023-08-02 16:24:10 +020041 service_context_close(test_runner_service_context, session);
julhal013ec4c322021-02-05 17:30:49 +000042 }
43 else {
44 printf("Failed to open rpc session\n");
45 }
46
47 service_context_relinquish(test_runner_service_context);
48 }
49 else {
50 printf("Failed to discover test_runner service\n");
51 }
52
53 return status;
54}