julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
julhal01 | 37e1aea | 2021-02-09 15:22:20 +0000 | [diff] [blame^] | 7 | #ifndef TEST_RUNNER_H |
| 8 | #define TEST_RUNNER_H |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 9 | |
| 10 | #include <protocols/service/test_runner/packed-c/test_result.h> |
julhal01 | 37e1aea | 2021-02-09 15:22:20 +0000 | [diff] [blame^] | 11 | #include <stdint.h> |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 12 | |
| 13 | #ifdef __cplusplus |
| 14 | extern "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 | */ |
| 26 | struct 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 | */ |
| 35 | struct test_summary |
| 36 | { |
julhal01 | 37e1aea | 2021-02-09 15:22:20 +0000 | [diff] [blame^] | 37 | 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 */ |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 41 | }; |
| 42 | |
| 43 | /** |
| 44 | * The run state of a test case |
| 45 | */ |
| 46 | enum 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 | /** |
julhal01 | 37e1aea | 2021-02-09 15:22:20 +0000 | [diff] [blame^] | 54 | * Test failue to describe a failure |
| 55 | */ |
| 56 | struct 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 | /** |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 63 | * The result for a particular test case. |
| 64 | */ |
| 65 | struct test_result |
| 66 | { |
| 67 | char name[TEST_NAME_MAX_LEN]; |
| 68 | char group[TEST_GROUP_MAX_LEN]; |
| 69 | enum test_run_state run_state; |
julhal01 | 37e1aea | 2021-02-09 15:22:20 +0000 | [diff] [blame^] | 70 | struct test_failure failure; |
julhal01 | 3ec4c32 | 2021-02-05 17:30:49 +0000 | [diff] [blame] | 71 | }; |
| 72 | |
| 73 | #ifdef __cplusplus |
| 74 | } /* extern "C" */ |
| 75 | #endif |
| 76 | |
julhal01 | 37e1aea | 2021-02-09 15:22:20 +0000 | [diff] [blame^] | 77 | #endif /* TEST_RUNNER_H */ |