|
36 | 36 | rcutils_fault_injection_is_test_complete(void);
|
37 | 37 |
|
38 | 38 | /**
|
39 |
| - * \def RCUTILS_FAULT_INJECTION_SET_COUNT |
40 | 39 | * \brief Atomically set the fault injection counter.
|
41 | 40 | *
|
42 |
| - * There will be at most one fault injected failure per call to RCUTILS_FAULT_INJECTION_SET_COUNT. |
| 41 | + * There will be at most one fault injected failure per call to `rcutils_fault_injection_set_count`. |
43 | 42 | * To test all reachable fault injection locations, call this macro inside a loop and set the count
|
44 | 43 | * to an incrementing count variable.
|
45 | 44 | *
|
46 | 45 | * for (int i = 0; i < SUFFICIENTLY_LARGE_ITERATION_COUNT; ++i) {
|
47 |
| - * RCUTILS_FAULT_INJECTION_SET_COUNT(i); |
| 46 | + * rcutils_fault_injection_set_count(i); |
48 | 47 | * ... // Call function under test
|
49 | 48 | * }
|
50 | 49 | * ASSERT_LT(RCUTILS_FAULT_INJECTION_NEVER_FAIL, RCUTILS_FAULT_INJECTION_GET_COUNT());
|
|
69 | 68 | rcutils_fault_injection_set_count(int count);
|
70 | 69 |
|
71 | 70 | /**
|
72 |
| - * \def RCUTILS_FAULT_INJECTION_GET_COUNT |
73 | 71 | * \brief Atomically get the fault injection counter value
|
74 | 72 | *
|
75 |
| - * Use this macro after running the code under test to check whether the counter reached a negative |
76 |
| - * value. This is helpful so you can verify that you ran the fault injection test in a loop a |
77 |
| - * sufficient number of times. Likewise, if the code under test returned with an error, but the |
78 |
| - * count value was greater or equal to 0, then the failure was not caused by the fault injection |
79 |
| - * counter. |
| 73 | + * Use this function after running the code under test to check whether the counter reached a |
| 74 | + * negative value. This is helpful so you can verify that you ran the fault injection test in a |
| 75 | + * loop a sufficient number of times. Likewise, if the code under test returned with an error, but |
| 76 | + * the count value was greater or equal to 0, then the failure was not caused by the fault |
| 77 | + * injection counter. |
80 | 78 | */
|
81 | 79 | RCUTILS_PUBLIC
|
82 | 80 | RCUTILS_WARN_UNUSED
|
83 | 81 | int_least64_t
|
84 | 82 | rcutils_fault_injection_get_count(void);
|
85 | 83 |
|
| 84 | +/** |
| 85 | + * \brief Implementation of fault injection decrementer |
| 86 | + * |
| 87 | + * This is included inside of macros, so it needs to be exported as a public function, but it |
| 88 | + * should not be used directly. |
| 89 | + */ |
86 | 90 | RCUTILS_PUBLIC
|
87 | 91 | RCUTILS_WARN_UNUSED
|
88 | 92 | int_least64_t
|
|
0 commit comments