Commit 2c082b62 authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Shuah Khan

selftests: harness: rename __constructor_order for clarification

Now, __constructor_order is boolean; 1 for forward-order systems,
0 for backward-order systems while parsing __LIST_APPEND().

Change it into a bool variable, and rename it for clarification.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 2a6b6c9a
...@@ -818,7 +818,7 @@ ...@@ -818,7 +818,7 @@
item->prev = item; \ item->prev = item; \
return; \ return; \
} \ } \
if (__constructor_order == _CONSTRUCTOR_ORDER_FORWARD) { \ if (__constructor_order_forward) { \
item->next = NULL; \ item->next = NULL; \
item->prev = head->prev; \ item->prev = head->prev; \
item->prev->next = item; \ item->prev->next = item; \
...@@ -882,9 +882,7 @@ struct __test_xfail { ...@@ -882,9 +882,7 @@ struct __test_xfail {
} }
static struct __fixture_metadata *__fixture_list = &_fixture_global; static struct __fixture_metadata *__fixture_list = &_fixture_global;
static int __constructor_order; static bool __constructor_order_forward;
#define _CONSTRUCTOR_ORDER_FORWARD 1
static inline void __register_fixture(struct __fixture_metadata *f) static inline void __register_fixture(struct __fixture_metadata *f)
{ {
...@@ -935,7 +933,7 @@ static inline bool __test_passed(struct __test_metadata *metadata) ...@@ -935,7 +933,7 @@ static inline bool __test_passed(struct __test_metadata *metadata)
* list so tests are run in source declaration order. * list so tests are run in source declaration order.
* https://gcc.gnu.org/onlinedocs/gccint/Initialization.html * https://gcc.gnu.org/onlinedocs/gccint/Initialization.html
* However, it seems not all toolchains do this correctly, so use * However, it seems not all toolchains do this correctly, so use
* __constructor_order to detect which direction is called first * __constructor_order_foward to detect which direction is called first
* and adjust list building logic to get things running in the right * and adjust list building logic to get things running in the right
* direction. * direction.
*/ */
...@@ -1330,7 +1328,7 @@ static int test_harness_run(int argc, char **argv) ...@@ -1330,7 +1328,7 @@ static int test_harness_run(int argc, char **argv)
static void __attribute__((constructor)) __constructor_order_first(void) static void __attribute__((constructor)) __constructor_order_first(void)
{ {
__constructor_order = _CONSTRUCTOR_ORDER_FORWARD; __constructor_order_forward = true;
} }
#endif /* __KSELFTEST_HARNESS_H */ #endif /* __KSELFTEST_HARNESS_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment