blob: ffc62430b4002719251589db5ebfeb20aa1bced1 [file] [log] [blame]
julhal013ec4c322021-02-05 17:30:49 +00001/*
2 * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
julhal0137e1aea2021-02-09 15:22:20 +00007#ifndef TEST_RUNNER_H
8#define TEST_RUNNER_H
julhal013ec4c322021-02-05 17:30:49 +00009
10#include <protocols/service/test_runner/packed-c/test_result.h>
julhal0137e1aea2021-02-09 15:22:20 +000011#include <stdint.h>
julhal013ec4c322021-02-05 17:30:49 +000012
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17/**
18 * Constants
19 */
20#define TEST_NAME_MAX_LEN (30)
21#define TEST_GROUP_MAX_LEN (30)
22
23/**
24 * Specifies a set of tests for running or listing.
25 */
26struct test_spec
27{
28 char name[TEST_NAME_MAX_LEN];
29 char group[TEST_GROUP_MAX_LEN];
30};
31
32/**
33 * A summary of a set of tests qualified by a test_spec.
34 */
35struct test_summary
36{
julhal0137e1aea2021-02-09 15:22:20 +000037 unsigned int num_tests; /* Number of qualifying tests */
38 unsigned int num_results; /* Number of available test result objects */
39 unsigned int num_passed; /* Number that ran and passed */
40 unsigned int num_failed; /* Number that ran and failed */
julhal013ec4c322021-02-05 17:30:49 +000041};
42
43/**
44 * The run state of a test case
45 */
46enum test_run_state
47{
48 TEST_RUN_STATE_NOT_RUN = TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_NOT_RUN,
49 TEST_RUN_STATE_PASSED = TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_PASSED,
50 TEST_RUN_STATE_FAILED = TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_FAILED
51};
52
53/**
julhal0137e1aea2021-02-09 15:22:20 +000054 * Test failue to describe a failure
55 */
56struct test_failure
57{
58 unsigned int line_num; /* Source line where test assertion failed */
59 uint64_t info; /* Provides test specific information about the failure */
60};
61
62/**
julhal013ec4c322021-02-05 17:30:49 +000063 * The result for a particular test case.
64 */
65struct test_result
66{
67 char name[TEST_NAME_MAX_LEN];
68 char group[TEST_GROUP_MAX_LEN];
69 enum test_run_state run_state;
julhal0137e1aea2021-02-09 15:22:20 +000070 struct test_failure failure;
julhal013ec4c322021-02-05 17:30:49 +000071};
72
73#ifdef __cplusplus
74} /* extern "C" */
75#endif
76
julhal0137e1aea2021-02-09 15:22:20 +000077#endif /* TEST_RUNNER_H */