Commit 372b304c authored by Magali Lemes's avatar Magali Lemes Committed by Jakub Kicinski
Browse files

selftests/harness: allow tests to be skipped during setup



Before executing each test from a fixture, FIXTURE_SETUP is run once.
When SKIP is used in FIXTURE_SETUP, the setup function returns early
but the test still proceeds to run, unless another SKIP macro is used
within the test definition, leading to some code repetition. Therefore,
allow tests to be skipped directly from the setup function.

Suggested-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarMagali Lemes <magali.lemes@canonical.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 40f71e7c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@

/**
 * FIXTURE_SETUP() - Prepares the setup function for the fixture.
 * *_metadata* is included so that EXPECT_* and ASSERT_* work correctly.
 * *_metadata* is included so that EXPECT_*, ASSERT_* etc. work correctly.
 *
 * @fixture_name: fixture name
 *
@@ -275,7 +275,7 @@

/**
 * FIXTURE_TEARDOWN()
 * *_metadata* is included so that EXPECT_* and ASSERT_* work correctly.
 * *_metadata* is included so that EXPECT_*, ASSERT_* etc. work correctly.
 *
 * @fixture_name: fixture name
 *
@@ -388,7 +388,7 @@
		if (setjmp(_metadata->env) == 0) { \
			fixture_name##_setup(_metadata, &self, variant->data); \
			/* Let setup failure terminate early. */ \
			if (!_metadata->passed) \
                       if (!_metadata->passed || _metadata->skip) \
				return; \
			_metadata->setup_completed = true; \
			fixture_name##_##test_name(_metadata, &self, variant->data); \