summaryrefslogtreecommitdiffstats
path: root/userspace/include/unit/unit.h
diff options
context:
space:
mode:
Diffstat (limited to 'userspace/include/unit/unit.h')
-rw-r--r--userspace/include/unit/unit.h24
1 files changed, 23 insertions, 1 deletions
diff --git a/userspace/include/unit/unit.h b/userspace/include/unit/unit.h
index 9438d4d9..2f93bab5 100644
--- a/userspace/include/unit/unit.h
+++ b/userspace/include/unit/unit.h
@@ -68,19 +68,41 @@ struct unit_module {
68 unsigned long nr_tests; 68 unsigned long nr_tests;
69 69
70 /* 70 /*
71 * Run priority. Currently 3 defined:
72 *
73 * UNIT_PRIO_SELF_TEST
74 * UNIT_PRIO_POSIX_TEST
75 * UNIT_PRIO_NVGPU_TEST
76 *
77 * These let us run environment and POSIX API wrapper tests before the
78 * rest of the unit tests run.
79 */
80 unsigned int prio;
81
82 /*
71 * For the core FW to use. Not for modules!!! 83 * For the core FW to use. Not for modules!!!
72 */ 84 */
73 void *lib_handle; 85 void *lib_handle;
74 struct unit_fw *fw; 86 struct unit_fw *fw;
75}; 87};
76 88
77#define UNIT_MODULE(__name, __tests) \ 89/*
90 * Zero is the higest priority. Increasing the prio value decreases priority to
91 * run.
92 */
93#define UNIT_PRIO_SELF_TEST 0U
94#define UNIT_PRIO_POSIX_TEST 50U
95#define UNIT_PRIO_NVGPU_TEST 100U
96
97#define UNIT_MODULE(__name, __tests, __prio) \
78 struct unit_module __unit_module__ = { \ 98 struct unit_module __unit_module__ = { \
79 .name = #__name, \ 99 .name = #__name, \
80 .tests = __tests, \ 100 .tests = __tests, \
81 .nr_tests = (sizeof(__tests) / \ 101 .nr_tests = (sizeof(__tests) / \
82 sizeof(struct unit_module_test)), \ 102 sizeof(struct unit_module_test)), \
103 .prio = __prio, \
83 .lib_handle = NULL, \ 104 .lib_handle = NULL, \
105 .fw = NULL, \
84 } 106 }
85 107
86#define UNIT_TEST(__name, __fn, __args) \ 108#define UNIT_TEST(__name, __fn, __args) \