1/* @title: Test API internal functions */
2#pragma once
3
4/* 1D piecewise-log */
5#define TEST_INTENSITY_LOG(min, def, max, unit_str) \
6 .flags = TEST_FLAG_HONORS_INTENSITY, .intensity_desc = { \
7 .curve = SCALE_PIECEWISE_LOG, \
8 .min_val = (min), \
9 .def_val = (def), \
10 .max_val = (max), \
11 .unit = (unit_str), \
12 }
13
14/* Linear scaling */
15#define TEST_INTENSITY_LINEAR(min, def, max, unit_str) \
16 .flags = TEST_FLAG_HONORS_INTENSITY, .intensity_desc = { \
17 .curve = SCALE_PIECEWISE_LINEAR, \
18 .min_val = (min), \
19 .def_val = (def), \
20 .max_val = (max), \
21 .unit = (unit_str), \
22 }
23
24/* Core-scaled thread counts (threads = base * core_count) */
25#define TEST_INTENSITY_CORES(min_per_core, def_per_core, max_per_core, \
26 unit_str) \
27 .flags = TEST_FLAG_HONORS_INTENSITY, .intensity_desc = { \
28 .curve = SCALE_CORE_MULTIPLIER, \
29 .min_val = (min_per_core), \
30 .def_val = (def_per_core), \
31 .max_val = (max_per_core), \
32 .unit = (unit_str), \
33 }
34
35/* set scale with min and max */
36#define TEST_INTENSITY_CUSTOM_PRINT(scale, min, def, max, unit_str, print_fn) \
37 .flags = TEST_FLAG_HONORS_INTENSITY, .intensity_desc = { \
38 .curve = scale, \
39 .min_val = (min), \
40 .def_val = (def), \
41 .max_val = (max), \
42 .unit = (unit_str), \
43 .custom_print = (print_fn), \
44 }
45
46/* Entirely custom */
47#define TEST_INTENSITY_CUSTOM(scale_fn, print_fn) \
48 .flags = TEST_FLAG_HONORS_INTENSITY, .intensity_desc = { \
49 .curve = SCALE_CUSTOM, \
50 .custom_scale = (scale_fn), \
51 .custom_print = (print_fn), \
52 }
53
54#define TEST_DEFINE_SMOKE(grp, id, ...) \
55 TEST_DEFINE(grp, id, .tier = TEST_TIER_SMOKE, ##__VA_ARGS__)
56#define TEST_DEFINE_UNIT(grp, id, ...) \
57 TEST_DEFINE(grp, id, .tier = TEST_TIER_UNIT, ##__VA_ARGS__)
58#define TEST_DEFINE_INTEGRATION(grp, id, ...) \
59 TEST_DEFINE(grp, id, .tier = TEST_TIER_INTEGRATION, ##__VA_ARGS__)
60
61#define TEST_DEFINE_SMOKE(grp, id, ...) \
62 TEST_DEFINE(grp, id, .tier = TEST_TIER_SMOKE, ##__VA_ARGS__)
63#define TEST_DEFINE_UNIT(grp, id, ...) \
64 TEST_DEFINE(grp, id, .tier = TEST_TIER_UNIT, ##__VA_ARGS__)
65#define TEST_DEFINE_INTEGRATION(grp, id, ...) \
66 TEST_DEFINE(grp, id, .tier = TEST_TIER_INTEGRATION, ##__VA_ARGS__)
67
68/* Goofy macros needed for the EXTERN macro,
69 * TODO: do something about this HACK: */
70#define __test_group_TEST_GROUP_NONE test_group_orphan_parent
71#define __test_group_none test_group_orphan_parent
72#define __test_group_orphan test_group_orphan_parent
73#define __test_group_test_group_orphan_parent test_group_orphan_parent
74