Message ID | 20230113053229.1281774-1-jeffxu@google.com (mailing list archive) |
---|---|
Headers | show |
Series | selftests/landlock: fix fs_tests when overlayfs | expand |
Thanks Jeff! I pushed this patch in -next: https://git.kernel.org/pub/scm/linux/kernel/git/mic/linux.git/log/?h=next On 13/01/2023 06:32, jeffxu@chromium.org wrote: > From: Jeff Xu <jeffxu@google.com> > > Overlayfs can be disabled in kernel config, causing related tests to > fail. Adding a check for overlayfs’s supportability at runtime, > so we can call SKIP() when needed. > > Note: > Below comments are raised during V7 discussion: > > Currently SKIP() is applied to FIXTURE_SETUP, FIXTURE_TEARDOWN, > TEST_F_FORK, this is because SKIP() apply within the function > scope, not the testcase. > > We would like test infra to have a dedicated environment > check hook (FIXTURE_ENV_CHECK) in test infra, called before > FIXTURE_SETUP(). If the environment check fails, the remaining > of the test will be skipped. The benefit of these are two: > 1> if env check pass, in theory, the test should pass. > 2> if env check fail, no need to call setup, so no need to cleanup > resource. > > v8: > style change, no logic change. > > v7: > https://lore.kernel.org/all/20221229211446.3154454-1-jeffxu@google.com/ > Fix bug in supports_overlayfs(). > Manual test with kernel with and without overlayfs. > > v6: https://lore.kernel.org/all/20221229201215.3006512-1-jeffxu@google.com/ > In v4, the SKIP() was applied at FIXTURE_SETUP() after mount() fail, > however, FIXTURE_TEARDOWN() will fail. It might be complicated > for test infra or testcase itself to have cleanup code handing the > success/failure of steps in SETUP(). > > This patch changes the approach, it calls supports_overlay() and SKIP() > at the beginning of FIXTURE_SETUP(), FIX_TEARDOWN(), TEST_F_FORK(). > Because no modification of system is done by the test, cleanup is not > needed. > > v4: > https://lore.kernel.org/all/20220823010216.2653012-1-jeffxu@google.com/ > > > Jeff Xu (1): > selftests/landlock: skip overlayfs test when not support > > tools/testing/selftests/landlock/fs_test.c | 48 ++++++++++++++++++++++ > 1 file changed, 48 insertions(+) > > > base-commit: 963a70bee5880640d0fd83ed29dc1e7ec0d2bd4a
Awesome, thanks! On Fri, Jan 13, 2023 at 11:58 AM Mickaël Salaün <mic@digikod.net> wrote: > > Thanks Jeff! I pushed this patch in -next: > https://git.kernel.org/pub/scm/linux/kernel/git/mic/linux.git/log/?h=next > > > On 13/01/2023 06:32, jeffxu@chromium.org wrote: > > From: Jeff Xu <jeffxu@google.com> > > > > Overlayfs can be disabled in kernel config, causing related tests to > > fail. Adding a check for overlayfs’s supportability at runtime, > > so we can call SKIP() when needed. > > > > Note: > > Below comments are raised during V7 discussion: > > > > Currently SKIP() is applied to FIXTURE_SETUP, FIXTURE_TEARDOWN, > > TEST_F_FORK, this is because SKIP() apply within the function > > scope, not the testcase. > > > > We would like test infra to have a dedicated environment > > check hook (FIXTURE_ENV_CHECK) in test infra, called before > > FIXTURE_SETUP(). If the environment check fails, the remaining > > of the test will be skipped. The benefit of these are two: > > 1> if env check pass, in theory, the test should pass. > > 2> if env check fail, no need to call setup, so no need to cleanup > > resource. > > > > v8: > > style change, no logic change. > > > > v7: > > https://lore.kernel.org/all/20221229211446.3154454-1-jeffxu@google.com/ > > Fix bug in supports_overlayfs(). > > Manual test with kernel with and without overlayfs. > > > > v6: https://lore.kernel.org/all/20221229201215.3006512-1-jeffxu@google.com/ > > In v4, the SKIP() was applied at FIXTURE_SETUP() after mount() fail, > > however, FIXTURE_TEARDOWN() will fail. It might be complicated > > for test infra or testcase itself to have cleanup code handing the > > success/failure of steps in SETUP(). > > > > This patch changes the approach, it calls supports_overlay() and SKIP() > > at the beginning of FIXTURE_SETUP(), FIX_TEARDOWN(), TEST_F_FORK(). > > Because no modification of system is done by the test, cleanup is not > > needed. > > > > v4: > > https://lore.kernel.org/all/20220823010216.2653012-1-jeffxu@google.com/ > > > > > > Jeff Xu (1): > > selftests/landlock: skip overlayfs test when not support > > > > tools/testing/selftests/landlock/fs_test.c | 48 ++++++++++++++++++++++ > > 1 file changed, 48 insertions(+) > > > > > > base-commit: 963a70bee5880640d0fd83ed29dc1e7ec0d2bd4a
From: Jeff Xu <jeffxu@google.com> Overlayfs can be disabled in kernel config, causing related tests to fail. Adding a check for overlayfs’s supportability at runtime, so we can call SKIP() when needed. Note: Below comments are raised during V7 discussion: Currently SKIP() is applied to FIXTURE_SETUP, FIXTURE_TEARDOWN, TEST_F_FORK, this is because SKIP() apply within the function scope, not the testcase. We would like test infra to have a dedicated environment check hook (FIXTURE_ENV_CHECK) in test infra, called before FIXTURE_SETUP(). If the environment check fails, the remaining of the test will be skipped. The benefit of these are two: 1> if env check pass, in theory, the test should pass. 2> if env check fail, no need to call setup, so no need to cleanup resource. v8: style change, no logic change. v7: https://lore.kernel.org/all/20221229211446.3154454-1-jeffxu@google.com/ Fix bug in supports_overlayfs(). Manual test with kernel with and without overlayfs. v6: https://lore.kernel.org/all/20221229201215.3006512-1-jeffxu@google.com/ In v4, the SKIP() was applied at FIXTURE_SETUP() after mount() fail, however, FIXTURE_TEARDOWN() will fail. It might be complicated for test infra or testcase itself to have cleanup code handing the success/failure of steps in SETUP(). This patch changes the approach, it calls supports_overlay() and SKIP() at the beginning of FIXTURE_SETUP(), FIX_TEARDOWN(), TEST_F_FORK(). Because no modification of system is done by the test, cleanup is not needed. v4: https://lore.kernel.org/all/20220823010216.2653012-1-jeffxu@google.com/ Jeff Xu (1): selftests/landlock: skip overlayfs test when not support tools/testing/selftests/landlock/fs_test.c | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) base-commit: 963a70bee5880640d0fd83ed29dc1e7ec0d2bd4a