diff options
Diffstat (limited to 'userspace/include/unit/results.h')
-rw-r--r-- | userspace/include/unit/results.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/userspace/include/unit/results.h b/userspace/include/unit/results.h new file mode 100644 index 00000000..fb88e59d --- /dev/null +++ b/userspace/include/unit/results.h | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
5 | * copy of this software and associated documentation files (the "Software"), | ||
6 | * to deal in the Software without restriction, including without limitation | ||
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
9 | * Software is furnished to do so, subject to the following conditions: | ||
10 | * | ||
11 | * The above copyright notice and this permission notice shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
20 | * DEALINGS IN THE SOFTWARE. | ||
21 | */ | ||
22 | |||
23 | #ifndef __UNIT_RESULTS_H__ | ||
24 | #define __UNIT_RESULTS_H__ | ||
25 | |||
26 | /* | ||
27 | * Keep track of the the results of a set of unit tests. This is effectively | ||
28 | * just a single linked list of records for each test. | ||
29 | */ | ||
30 | |||
31 | struct unit_test_record { | ||
32 | /* | ||
33 | * Let's us determine the name of the test. | ||
34 | */ | ||
35 | struct unit_module *mod; | ||
36 | struct unit_module_test *test; | ||
37 | |||
38 | /* | ||
39 | * True for pass, false for fail. | ||
40 | */ | ||
41 | bool status; | ||
42 | |||
43 | struct unit_test_record *next; | ||
44 | }; | ||
45 | |||
46 | struct unit_test_list { | ||
47 | struct unit_test_record *head; | ||
48 | struct unit_test_record *last; | ||
49 | }; | ||
50 | |||
51 | struct unit_results { | ||
52 | struct unit_test_list passing; | ||
53 | struct unit_test_list failing; | ||
54 | |||
55 | int nr_tests; | ||
56 | int nr_passing; | ||
57 | }; | ||
58 | |||
59 | #define for_record_in_test_list(__test_list, __test) \ | ||
60 | for ((__test) = (__test_list)->head; \ | ||
61 | (__test) != NULL; \ | ||
62 | (__test) = (__test)->next) | ||
63 | |||
64 | int core_add_test_record(struct unit_fw *fw, | ||
65 | struct unit_module *mod, | ||
66 | struct unit_module_test *test, | ||
67 | bool success); | ||
68 | void core_print_test_status(struct unit_fw *fw); | ||
69 | |||
70 | #endif | ||