Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Purva Yeshi <purvayeshi550@gmail.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	skhan@linuxfoundation.org
Cc: shuah@kernel.org, Jason@zx2c4.com, liaoyu15@huawei.com,
	broonie@kernel.org, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests/vDSO: Fix undefined CLONE_NEWTIME by including
Date: Wed, 29 Jan 2025 23:47:51 +0530	[thread overview]
Message-ID: <171e15dc-b48f-4592-8466-b220185bae78@gmail.com> (raw)
In-Reply-To: <d85f9c94-249a-4847-a323-2f547fe60732@csgroup.eu>

On 27/01/25 13:32, Christophe Leroy wrote:
> 
> 
> Le 26/01/2025 à 11:59, Purva Yeshi a écrit :
>> [Vous ne recevez pas souvent de courriers de purvayeshi550@gmail.com. 
>> Découvrez pourquoi ceci est important à 
>> https://aka.ms/LearnAboutSenderIdentification ]
>>
>> Fix the build failure caused by the undefined `CLONE_NEWTIME`.
>> Include the `linux/sched.h` header file where the function is defined to
>> ensure successful compilation of the selftests.
> 
> This is supposed to be already fixed by commit 34d5b600172b ("selftests: 
> vDSO: Explicitly include sched.h")
> 
> Can you explain what is the exact problem still ? And why linux/sched.h ?

Yes, I noticed that sched.h is already included, but I still encountered 
an "undeclared CLONE_NEWTIME" error during compilation.

Error I got:
CC       vdso_test_getrandom
vdso_test_getrandom.c: In function ‘kselftest’:
vdso_test_getrandom.c:257:29: error: ‘CLONE_NEWTIME’ undeclared (first 
use in this function); did you mean ‘CLONE_NEWPID’?
   257 |         ksft_assert(unshare(CLONE_NEWTIME) == 0);
       |                             ^~~~~
vdso_test_getrandom.c:47:20: note: in definition of macro ‘ksft_assert’
    47 |         do { if (!(condition)) ksft_exit_fail_msg("Assertion 
failed: %s\n", #condition); } while (0)
       |                    ^~~~~
vdso_test_getrandom.c:257:29: note: each undeclared identifier is 
reported only once for each function it appears in
   257 |         ksft_assert(unshare(CLONE_NEWTIME) == 0);
       |                             ^~~~~
vdso_test_getrandom.c:47:20: note: in definition of macro ‘ksft_assert’
    47 |         do { if (!(condition)) ksft_exit_fail_msg("Assertion 
failed: %s\n", #condition); } while (0)
       |                    ^~~~~
make[1]: * [../lib.mk:222: 
/home/purva/linux/tools/testing/selftests/vDSO/vdso_test_getrandom] Error 1
make[1]: Leaving directory '/home/purva/linux/tools/testing/selftests/vDSO'

I found that CLONE_NEWTIME is declared in both sched.h and 
linux/sched.h. Since sched.h was already included, it was surprising 
that the error persisted. Adding linux/sched.h as a header resolved the 
issue, and the selftests compiled successfully after that.

> 
> Did you properly build kernel headers before building selftests ?

Yes, I ensured that I properly built the kernel headers before building 
the selftests by following the documentation provided here 
(https://docs.kernel.org/dev-tools/kselftest.html#running-the-selftests-hotplug-tests-are-run-in-limited-mode). 
I used the 'make headers' command as part of the process.

> 
> 
>>
>> Signed-off-by: Purva Yeshi <purvayeshi550@gmail.com>
>> ---
>>   tools/testing/selftests/vDSO/vdso_test_getrandom.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c 
>> b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
>> index 95057f7567db..b2c9cf15878b 100644
>> --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
>> +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
>> @@ -29,6 +29,8 @@
>>   #include "vdso_config.h"
>>   #include "vdso_call.h"
>>
>> +#include <linux/sched.h>
>> +
>>   #ifndef timespecsub
>>   #define        timespecsub(tsp, usp, 
>> vsp)                                      \
>>          do 
>> {                                                            \
>> -- 
>> 2.34.1
>>
> 

Let me know if there’s anything further you'd like me to verify or adjust.

Thank you for your time and feedback!

Best regards,
Purva Yeshi

  reply	other threads:[~2025-01-29 18:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-26 10:59 [PATCH] selftests/vDSO: Fix undefined CLONE_NEWTIME by including Purva Yeshi
2025-01-27  8:02 ` Christophe Leroy
2025-01-29 18:17   ` Purva Yeshi [this message]
2025-01-30  7:02     ` Christophe Leroy
2025-02-01 11:20       ` Purva Yeshi
2025-01-29 18:24   ` Purva Yeshi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=171e15dc-b48f-4592-8466-b220185bae78@gmail.com \
    --to=purvayeshi550@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=broonie@kernel.org \
    --cc=christophe.leroy@csgroup.eu \
    --cc=liaoyu15@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox