Add test_runner service
This is a new service with client and provider that can be
used for running tests in a secure processing environment
and retrieving the results. The test_runner provider allows
for arbitrary test farmework backends. The goal is to
have a cpputest backend. In this commit, a mock backend
is included for testing the service itself. The service
has its own access protocol defined under the protocols
top-level directory.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: If4e965c110763bd805abbdcb87e7e03cd76248b2
diff --git a/protocols/service/test_runner/packed-c/list_tests.h b/protocols/service/test_runner/packed-c/list_tests.h
new file mode 100644
index 0000000..25bab9e
--- /dev/null
+++ b/protocols/service/test_runner/packed-c/list_tests.h
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TS_TEST_RUNNER_LIST_TESTS
+#define TS_TEST_RUNNER_LIST_TESTS
+
+/**
+ * Input parmeters consist of test spec (defined in test_spec.h) to
+ * define the set of tests to run.
+ */
+#include "test_spec.h"
+
+/* Output parameters are the same as for run_tests except no
+ * tests are actually run.
+ */
+#include "test_result.h"
+
+#endif /* TS_TEST_RUNNER_LIST_TESTS */
diff --git a/protocols/service/test_runner/packed-c/opcodes.h b/protocols/service/test_runner/packed-c/opcodes.h
new file mode 100644
index 0000000..e28da24
--- /dev/null
+++ b/protocols/service/test_runner/packed-c/opcodes.h
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TS_TEST_RUNNER_OPCODES_H
+#define TS_TEST_RUNNER_OPCODES_H
+
+/**
+ * C/C++ definition of test_runner service opcodes
+ */
+#define TS_TEST_RUNNER_OPCODE_RUN_TESTS (0x0101)
+#define TS_TEST_RUNNER_OPCODE_LIST_TESTS (0x0102)
+
+#endif /* TS_TEST_RUNNER_OPCODES_H */
diff --git a/protocols/service/test_runner/packed-c/run_tests.h b/protocols/service/test_runner/packed-c/run_tests.h
new file mode 100644
index 0000000..9b25fa6
--- /dev/null
+++ b/protocols/service/test_runner/packed-c/run_tests.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TS_TEST_RUNNER_RUN_TESTS
+#define TS_TEST_RUNNER_RUN_TESTS
+
+/**
+ * Input parmeters consist of test spec (defined in test_spec.h) to
+ * define the set of tests to run.
+ */
+#include "test_spec.h"
+
+/* Output parameters consist of a test summary followed
+ * by a setof [0..*] variable length test result records.
+ * Each test result has a fixed size structure followed
+ * by variable length parameters that specify the test
+ * name and group.
+ */
+#include "test_result.h"
+
+#endif /* TS_TEST_RUNNER_RUN_TESTS */
diff --git a/protocols/service/test_runner/packed-c/status.h b/protocols/service/test_runner/packed-c/status.h
new file mode 100644
index 0000000..d0a00e0
--- /dev/null
+++ b/protocols/service/test_runner/packed-c/status.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TS_TEST_RUNNER_STATUS_H
+#define TS_TEST_RUNNER_STATUS_H
+
+/**
+ * Test runner service level statos codes
+ */
+enum
+{
+ /**
+ * Returned if an operation completed successfully.
+ * This doesn't mean that requested tests passed
+ * but rather that the test runner operation
+ * completed normally.
+ */
+ TS_TEST_RUNNER_STATUS_SUCCESS = 0,
+
+ /**
+ * Generic error occurred.
+ */
+ TS_TEST_RUNNER_STATUS_ERROR = -1,
+
+ /**
+ * Invalid test resuts returned by service provider.
+ */
+ TS_TEST_RUNNER_STATUS_INVALID_TEST_RESULTS = -2
+};
+
+#endif /* TS_TEST_RUNNER_STATUS_H */
diff --git a/protocols/service/test_runner/packed-c/test_result.h b/protocols/service/test_runner/packed-c/test_result.h
new file mode 100644
index 0000000..888d2ec
--- /dev/null
+++ b/protocols/service/test_runner/packed-c/test_result.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TS_TEST_RUNNER_TEST_RESULT
+#define TS_TEST_RUNNER_TEST_RESULT
+
+#include <stdint.h>
+
+/**
+ * Test result summary structure
+ */
+struct __attribute__ ((__packed__)) ts_test_runner_result_summary
+{
+ uint32_t num_tests;
+ uint32_t num_passed;
+ uint32_t num_failed;
+};
+
+/**
+ * Variable length parameter tag for a test result object.
+ * Multiple test results may be returned for a test run.
+ */
+enum
+{
+ /* A test result record describes the result of a
+ * particular test.
+ */
+ TS_TEST_RUNNER_TEST_RESULT_TAG = 1
+};
+
+/* Test run state values */
+enum
+{
+ TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_NOT_RUN = 1,
+ TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_PASSED = 2,
+ TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_FAILED = 3
+};
+
+/* Test result fixed sized structure */
+struct __attribute__ ((__packed__)) ts_test_runner_test_result
+{
+ uint32_t run_state;
+ uint32_t fail_line;
+};
+
+/* Variable length output parameter tags */
+enum
+{
+ /* The name of the test */
+ TS_TEST_RUNNER_TEST_RESULT_TAG_NAME = 1,
+
+ /* The group the test belongs to */
+ TS_TEST_RUNNER_TEST_RESULT_TAG_GROUP = 2
+};
+
+#endif /* TS_TEST_RUNNER_TEST_RESULT */
diff --git a/protocols/service/test_runner/packed-c/test_spec.h b/protocols/service/test_runner/packed-c/test_spec.h
new file mode 100644
index 0000000..c31b367
--- /dev/null
+++ b/protocols/service/test_runner/packed-c/test_spec.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TS_TEST_RUNNER_TEST_SPEC
+#define TS_TEST_RUNNER_TEST_SPEC
+
+/**
+ * Variable length parameters used to specify a test or
+ * group of tests. A missing parameter is interpreted
+ * as a wildcard.
+ */
+enum
+{
+ /* Specifies the name of a particular test to run.
+ * The parameter should consist of an ascii string
+ * without a zero terminator.
+ */
+ TS_TEST_RUNNER_TEST_SPEC_TAG_NAME = 1,
+
+ /* Specifies a group of tests to run.
+ * The parameter should consist of an ascii string
+ * without a zero terminator.
+ */
+ TS_TEST_RUNNER_TEST_SPEC_TAG_GROUP = 2
+};
+
+#endif /* TS_TEST_RUNNER_TEST_SPEC */