Commit 2a6b6c9a authored by Masahiro Yamada's avatar Masahiro Yamada Committed by Shuah Khan
Browse files

selftests: harness: remove unneeded __constructor_order_last()



__constructor_order_last() is unneeded.

If __constructor_order_last() is not called on backward-order systems,
__constructor_order will remain 0 instead of being set to
_CONSTRUCTOR_ORDER_BACKWARD (= -1).

__LIST_APPEND() will still take the 'else' branch, so there is no
difference in the behavior.

Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent f0a1ffa6
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -257,12 +257,6 @@ TEST_F(attest_fixture, att_inval_addr)
	att_inval_addr_test(&self->uvio_attest.meas_addr, _metadata, self);
}

static void __attribute__((constructor)) __constructor_order_last(void)
{
	if (!__constructor_order)
		__constructor_order = _CONSTRUCTOR_ORDER_BACKWARD;
}

int main(int argc, char **argv)
{
	int fd = open(UV_PATH, O_ACCMODE);
+0 −6
Original line number Diff line number Diff line
@@ -1331,12 +1331,6 @@ static int libbpf_print_fn(enum libbpf_print_level level,
	return 0;
}

static void __attribute__((constructor)) __constructor_order_last(void)
{
	if (!__constructor_order)
		__constructor_order = _CONSTRUCTOR_ORDER_BACKWARD;
}

int main(int argc, char **argv)
{
	/* Use libbpf 1.0 API mode */
+1 −9
Original line number Diff line number Diff line
@@ -488,12 +488,6 @@
 * Use once to append a main() to the test file.
 */
#define TEST_HARNESS_MAIN \
	static void __attribute__((constructor)) \
	__constructor_order_last(void) \
	{ \
		if (!__constructor_order) \
			__constructor_order = _CONSTRUCTOR_ORDER_BACKWARD; \
	} \
	int main(int argc, char **argv) { \
		return test_harness_run(argc, argv); \
	}
@@ -891,7 +885,6 @@ static struct __fixture_metadata *__fixture_list = &_fixture_global;
static int __constructor_order;

#define _CONSTRUCTOR_ORDER_FORWARD   1
#define _CONSTRUCTOR_ORDER_BACKWARD -1

static inline void __register_fixture(struct __fixture_metadata *f)
{
@@ -1337,7 +1330,6 @@ static int test_harness_run(int argc, char **argv)

static void __attribute__((constructor)) __constructor_order_first(void)
{
	if (!__constructor_order)
	__constructor_order = _CONSTRUCTOR_ORDER_FORWARD;
}

+0 −7
Original line number Diff line number Diff line
@@ -410,13 +410,6 @@ TEST_F_TIMEOUT(rtc, alarm_wkalm_set_minute, 65) {
	ASSERT_EQ(new, secs);
}

static void __attribute__((constructor))
__constructor_order_last(void)
{
	if (!__constructor_order)
		__constructor_order = _CONSTRUCTOR_ORDER_BACKWARD;
}

int main(int argc, char **argv)
{
	switch (argc) {