* [PATCH] selftests/clone3: Skip new time namespace test when unsupported
@ 2023-10-19 23:08 Mark Brown
2023-10-19 23:35 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2023-10-19 23:08 UTC (permalink / raw)
To: Christian Brauner, Shuah Khan, Tiezhu Yang, Tobias Klauser
Cc: Thomas Gleixner, Andrew Morton, Stephen Rothwell, linux-kernel,
linux-kselftest, Mark Brown
Use a filter function to skip the time namespace test on systems with
!CONFIG_TIME_NS. This reworks a fix originally done by Tiezhu Yang prior
to the refactoring in 34dce23f7e40 ("selftests/clone3: Report descriptive
test names"). The changelog from their fix explains the issue very clearly:
When execute the following command to test clone3 under !CONFIG_TIME_NS:
# make headers && cd tools/testing/selftests/clone3 && make && ./clone3
we can see the following error info:
# [7538] Trying clone3() with flags 0x80 (size 0)
# Invalid argument - Failed to create new process
# [7538] clone3() with flags says: -22 expected 0
not ok 18 [7538] Result (-22) is different than expected (0)
...
# Totals: pass:18 fail:1 xfail:0 xpass:0 skip:0 error:0
This is because if CONFIG_TIME_NS is not set, but the flag
CLONE_NEWTIME (0x80) is used to clone a time namespace, it
will return -EINVAL in copy_time_ns().
If kernel does not support CONFIG_TIME_NS, /proc/self/ns/time
will be not exist, and then we should skip clone3() test with
CLONE_NEWTIME.
With this patch under !CONFIG_TIME_NS:
# make headers && cd tools/testing/selftests/clone3 && make && ./clone3
...
# Time namespaces are not supported
ok 18 # SKIP Skipping clone3() with CLONE_NEWTIME
...
# Totals: pass:18 fail:0 xfail:0 xpass:0 skip:1 error:0
Fixes: 515bddf0ec41 ("selftests/clone3: test clone3 with CLONE_NEWTIME")
Suggested-by: Thomas Gleixner <tglx@linutronix.de>
Original-fix-from: Tiezhu Yang <yangtiezhu@loongson.cn>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
tools/testing/selftests/clone3/clone3.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c
index 9429d361059e..915846bc32cc 100644
--- a/tools/testing/selftests/clone3/clone3.c
+++ b/tools/testing/selftests/clone3/clone3.c
@@ -138,6 +138,16 @@ static bool not_root(void)
return false;
}
+static bool timens_unsupported(void)
+{
+ if (access("/proc/self/ns/time", F_OK) == 0) {
+ ksft_print_msg("Time namespaces are not supported\n");
+ return true;
+ }
+
+ return false;
+}
+
static size_t page_size_plus_8(void)
{
return getpagesize() + 8;
@@ -282,6 +292,7 @@ static const struct test tests[] = {
.size = 0,
.expected = 0,
.test_mode = CLONE3_ARGS_NO_TEST,
+ .filter = timens_unsupported,
},
{
.name = "exit signal (SIGCHLD) in flags",
---
base-commit: 8d4099dd0727acfc8b0f644eacaf852f9d5dc649
change-id: 20231019-kselftest-clone3-time-ns-730b6f4187c7
Best regards,
--
Mark Brown <broonie@kernel.org>
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/clone3: Skip new time namespace test when unsupported
2023-10-19 23:08 [PATCH] selftests/clone3: Skip new time namespace test when unsupported Mark Brown
@ 2023-10-19 23:35 ` Andrew Morton
2023-10-20 1:34 ` Tiezhu Yang
2023-10-20 11:46 ` Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2023-10-19 23:35 UTC (permalink / raw)
To: Mark Brown
Cc: Christian Brauner, Shuah Khan, Tiezhu Yang, Tobias Klauser,
Thomas Gleixner, Stephen Rothwell, linux-kernel, linux-kselftest
On Fri, 20 Oct 2023 00:08:12 +0100 Mark Brown <broonie@kernel.org> wrote:
> Use a filter function to skip the time namespace test on systems with
> !CONFIG_TIME_NS. This reworks a fix originally done by Tiezhu Yang prior
> to the refactoring in 34dce23f7e40 ("selftests/clone3: Report descriptive
> test names"). The changelog from their fix explains the issue very clearly:
I was about to send Tiezhu Yang's fix to Linus. I'll rebase mm-hotfixes-stable
to drop that patch, so you own it now!
Please note that your version lacks an explicit cc:stable, but I suppose the
stablebots will scoop it up anyway.
> Original-fix-from: Tiezhu Yang <yangtiezhu@loongson.cn>
"Original-fix-from" isn't a thing. In fact it seems to be the first
time this has been used. Grepping for "Original-.*:" shows
all sorts of innovations, including "Based-on-the-original-screenplay-by:".
I guess Documentation/process/submitting-patches.rst and checkpatch
lost this fight a long time ago.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/clone3: Skip new time namespace test when unsupported
2023-10-19 23:35 ` Andrew Morton
@ 2023-10-20 1:34 ` Tiezhu Yang
2023-10-20 11:46 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Tiezhu Yang @ 2023-10-20 1:34 UTC (permalink / raw)
To: Andrew Morton, Mark Brown
Cc: Christian Brauner, Shuah Khan, Tobias Klauser, Thomas Gleixner,
Stephen Rothwell, linux-kernel, linux-kselftest
On 10/20/2023 07:35 AM, Andrew Morton wrote:
> On Fri, 20 Oct 2023 00:08:12 +0100 Mark Brown <broonie@kernel.org> wrote:
>
>> Use a filter function to skip the time namespace test on systems with
>> !CONFIG_TIME_NS. This reworks a fix originally done by Tiezhu Yang prior
>> to the refactoring in 34dce23f7e40 ("selftests/clone3: Report descriptive
>> test names"). The changelog from their fix explains the issue very clearly:
>
> I was about to send Tiezhu Yang's fix to Linus. I'll rebase mm-hotfixes-stable
> to drop that patch, so you own it now!
>
> Please note that your version lacks an explicit cc:stable, but I suppose the
> stablebots will scoop it up anyway.
>
>> Original-fix-from: Tiezhu Yang <yangtiezhu@loongson.cn>
>
> "Original-fix-from" isn't a thing. In fact it seems to be the first
> time this has been used. Grepping for "Original-.*:" shows
> all sorts of innovations, including "Based-on-the-original-screenplay-by:".
>
> I guess Documentation/process/submitting-patches.rst and checkpatch
> lost this fight a long time ago.
>
Thank you all.
If it is possible, I think it is better to rebase linux-kselftest next
to do the following things sequentially.
(1) Apply patch "selftests/clone3: Fix broken test under !CONFIG_TIME_NS"
which is sent on 11 Jul 2023.
https://lore.kernel.org/linux-kselftest/1689066814-13295-1-git-send-email-yangtiezhu@loongson.cn/
(2) Squash the changes in patch "selftests/clone3: Skip new time
namespace test when unsupported"
https://lore.kernel.org/linux-kselftest/20231020-kselftest-clone3-time-ns-v1-1-31a17e072a05@kernel.org/
into patch "selftests/clone3: Report descriptive test names", and then
apply it.
https://lore.kernel.org/linux-kselftest/20231018-kselftest-clone3-output-v1-1-12b7c50ea2cf@kernel.org/
This can make the log more clear. Anyway, I am fine with either way.
Thanks,
Tiezhu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/clone3: Skip new time namespace test when unsupported
2023-10-19 23:35 ` Andrew Morton
2023-10-20 1:34 ` Tiezhu Yang
@ 2023-10-20 11:46 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2023-10-20 11:46 UTC (permalink / raw)
To: Andrew Morton
Cc: Christian Brauner, Shuah Khan, Tiezhu Yang, Tobias Klauser,
Thomas Gleixner, Stephen Rothwell, linux-kernel, linux-kselftest
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]
On Thu, Oct 19, 2023 at 04:35:38PM -0700, Andrew Morton wrote:
> On Fri, 20 Oct 2023 00:08:12 +0100 Mark Brown <broonie@kernel.org> wrote:
> > Use a filter function to skip the time namespace test on systems with
> > !CONFIG_TIME_NS. This reworks a fix originally done by Tiezhu Yang prior
> > to the refactoring in 34dce23f7e40 ("selftests/clone3: Report descriptive
> > test names"). The changelog from their fix explains the issue very clearly:
> I was about to send Tiezhu Yang's fix to Linus. I'll rebase mm-hotfixes-stable
> to drop that patch, so you own it now!
> Please note that your version lacks an explicit cc:stable, but I suppose the
> stablebots will scoop it up anyway.
I think I was expecting Tiezhu's version to still get sent and then the
two versions to get merged - the refactoring that caused the conflict is
very clearly not stable material.
> > Original-fix-from: Tiezhu Yang <yangtiezhu@loongson.cn>
> "Original-fix-from" isn't a thing. In fact it seems to be the first
> time this has been used. Grepping for "Original-.*:" shows
> all sorts of innovations, including "Based-on-the-original-screenplay-by:".
> I guess Documentation/process/submitting-patches.rst and checkpatch
> lost this fight a long time ago.
Well, they've always been documenting existing practice.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-20 11:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-19 23:08 [PATCH] selftests/clone3: Skip new time namespace test when unsupported Mark Brown
2023-10-19 23:35 ` Andrew Morton
2023-10-20 1:34 ` Tiezhu Yang
2023-10-20 11:46 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.