aboutsummaryrefslogtreecommitdiff
path: root/components/service/test_runner/provider/test_runner_backend.h
blob: 9c9cbc8156995599bb9aec960ae686ca577eff22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
 * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef CPPUTEST_TEST_RUNNER_BACKEND_H
#define CPPUTEST_TEST_RUNNER_BACKEND_H

#include <stddef.h>
#include <service/test_runner/common/test_runner.h>

#ifdef __cplusplus
extern "C" {
#endif

struct test_runner_provider;

/**
 * Provides an abstract interface for a backend test runner. A
 * concrete implementation will map methods to a test framework
 * such as CppUtets.  test_runner objects may be linked to
 * accommodate a mix of backend test frameworks.
 */
struct test_runner_backend
{
	/* Return the number of tests that are qualified by the test spec */
	size_t (*count_tests)(const struct test_spec *spec);

	/* Run a set of tests according to the provided test_spec */
	int (*run_tests)(const struct test_spec *spec,
		struct test_summary *summary, struct test_result *results, size_t result_limit);

	/* List a set of tests according to the provided test_spec */
	void (*list_tests)(const struct test_spec *spec,
		struct test_summary *summary, struct test_result *results, size_t result_limit);

	/* Used by the test_runner_provider to maintain a linked list */
	struct test_runner_backend *next;
};

/**
 * A concrete test_runner may provide an implementation of this function if it
 * is to be the default test runner for a deployment.  Additional test runners
 * may be registered but there can only be one default for a deployment.
 */
void test_runner_register_default_backend(struct test_runner_provider *context);

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* CPPUTEST_TEST_RUNNER_BACKEND_H */