1 /* 2 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef TEST_RUNNER_CLIENT_H 8 #define TEST_RUNNER_CLIENT_H 9 10 #include <cstdint> 11 #include <vector> 12 #include <string> 13 #include <service/test_runner/common/test_runner.h> 14 #include <service/common/client/service_client.h> 15 16 /* 17 * Provides a client interface for running remote tests using the test-runner 18 * service access protocol. 19 */ 20 class test_runner_client 21 { 22 public: 23 test_runner_client(); 24 test_runner_client(struct rpc_caller_session *session); 25 virtual ~test_runner_client(); 26 27 void set_caller(struct rpc_caller_session *session); 28 int err_rpc_status() const; 29 30 int run_tests(const struct test_spec &spec, 31 struct test_summary &summary, 32 std::vector<struct test_result> &results); 33 34 int list_tests(const struct test_spec &spec, 35 struct test_summary &summary, 36 std::vector<struct test_result> &results); 37 38 private: 39 40 int iterate_over_tests(const struct test_spec &spec, bool list_only, 41 struct test_summary &summary, 42 std::vector<struct test_result> &results); 43 44 void serialize_test_spec(std::vector<uint8_t> &serialized_data, 45 const struct test_spec &spec) const; 46 47 int deserialize_results(const uint8_t *resp_buf, size_t resp_len, 48 struct test_summary &summary, 49 std::vector<struct test_result> &results) const; 50 51 int deserialize_result(const uint8_t *value_buf, size_t value_len, 52 struct test_result &result) const; 53 54 struct service_client m_client; 55 }; 56 57 #endif /* TEST_RUNNER_CLIENT_H */ 58