All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup()
@ 2021-06-24  8:14 Alexey Kodanev
  2021-06-24  8:15 ` [LTP] [PATCH 2/2] fcntl38: check required kernel config option for dnotify Alexey Kodanev
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alexey Kodanev @ 2021-06-24  8:14 UTC (permalink / raw)
  To: ltp

TCID can be NULL in tst_tmpdir() because it is set after do_setup():

    tst_run_tcases()
        do_setup()
            ...
            tid = get_tid();
            ...
            tst_tmpdir()  /* using TCID here */
        TCID = tid;

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 lib/tst_test.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/tst_test.c b/lib/tst_test.c
index 36a4809c7..55449c80b 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -915,7 +915,7 @@ static void do_setup(int argc, char *argv[])
 
 	assert_test_fn();
 
-	tid = get_tid(argv);
+	TCID = tid = get_tid(argv);
 
 	if (tst_test->sample)
 		tst_test = tst_timer_test_setup(tst_test);
@@ -1412,8 +1412,6 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
 
 	do_setup(argc, argv);
 
-	TCID = tid;
-
 	SAFE_SIGNAL(SIGALRM, alarm_handler);
 	SAFE_SIGNAL(SIGUSR1, heartbeat_handler);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 2/2] fcntl38: check required kernel config option for dnotify
  2021-06-24  8:14 [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup() Alexey Kodanev
@ 2021-06-24  8:15 ` Alexey Kodanev
  2021-06-24  8:37 ` [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup() Li Wang
  2021-06-25  9:27 ` Cyril Hrubis
  2 siblings, 0 replies; 5+ messages in thread
From: Alexey Kodanev @ 2021-06-24  8:15 UTC (permalink / raw)
  To: ltp

Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
---
 testcases/kernel/syscalls/fcntl/fcntl38.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/testcases/kernel/syscalls/fcntl/fcntl38.c b/testcases/kernel/syscalls/fcntl/fcntl38.c
index 6185d3209..fae2ab4f7 100644
--- a/testcases/kernel/syscalls/fcntl/fcntl38.c
+++ b/testcases/kernel/syscalls/fcntl/fcntl38.c
@@ -93,4 +93,5 @@ static struct tst_test test = {
 	.setup = setup,
 	.cleanup = cleanup,
 	.test_all = verify_dnotify,
+	.needs_kconfigs = (const char *[]) { "CONFIG_DNOTIFY=y", NULL },
 };
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup()
  2021-06-24  8:14 [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup() Alexey Kodanev
  2021-06-24  8:15 ` [LTP] [PATCH 2/2] fcntl38: check required kernel config option for dnotify Alexey Kodanev
@ 2021-06-24  8:37 ` Li Wang
  2021-06-25  9:27 ` Cyril Hrubis
  2 siblings, 0 replies; 5+ messages in thread
From: Li Wang @ 2021-06-24  8:37 UTC (permalink / raw)
  To: ltp

Hi Alexey,

Good catch.

On Thu, Jun 24, 2021 at 4:15 PM Alexey Kodanev <aleksei.kodanev@bell-sw.com>
wrote:

> TCID can be NULL in tst_tmpdir() because it is set after do_setup():
>
>     tst_run_tcases()
>         do_setup()
>             ...
>             tid = get_tid();
>             ...
>             tst_tmpdir()  /* using TCID here */
>         TCID = tid;
>
> Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
>

Reviewed-by: Li Wang <liwang@redhat.com>

-- 
Regards,
Li Wang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linux.it/pipermail/ltp/attachments/20210624/342af4b5/attachment-0001.htm>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup()
  2021-06-24  8:14 [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup() Alexey Kodanev
  2021-06-24  8:15 ` [LTP] [PATCH 2/2] fcntl38: check required kernel config option for dnotify Alexey Kodanev
  2021-06-24  8:37 ` [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup() Li Wang
@ 2021-06-25  9:27 ` Cyril Hrubis
  2021-06-28  9:47   ` Alexey Kodanev
  2 siblings, 1 reply; 5+ messages in thread
From: Cyril Hrubis @ 2021-06-25  9:27 UTC (permalink / raw)
  To: ltp

Hi!
> TCID can be NULL in tst_tmpdir() because it is set after do_setup():
> 
>     tst_run_tcases()
>         do_setup()
>             ...
>             tid = get_tid();
>             ...
>             tst_tmpdir()  /* using TCID here */
>         TCID = tid;

Good catch, I wonder how we missed this for so long...

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup()
  2021-06-25  9:27 ` Cyril Hrubis
@ 2021-06-28  9:47   ` Alexey Kodanev
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Kodanev @ 2021-06-28  9:47 UTC (permalink / raw)
  To: ltp

Hi Li, Cyril,
On 25.06.2021 12:27, Cyril Hrubis wrote:
> Hi!
>> TCID can be NULL in tst_tmpdir() because it is set after do_setup():
>>
>>     tst_run_tcases()
>>         do_setup()
>>             ...
>>             tid = get_tid();
>>             ...
>>             tst_tmpdir()  /* using TCID here */
>>         TCID = tid;
> 
> Good catch, I wonder how we missed this for so long...

Ran into this with musl, it pastes "(null)" to the tmpdir path if
TCID is NULL, so the final template looked like "/tmp/(nuXXXXXX".
But glibc skips it because the same string doesn't fit in 3 chars
template in snprintf(..., "%s/%.3sXXXXXX",...).

Applied the patch. Thanks for review!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-06-28  9:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-24  8:14 [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup() Alexey Kodanev
2021-06-24  8:15 ` [LTP] [PATCH 2/2] fcntl38: check required kernel config option for dnotify Alexey Kodanev
2021-06-24  8:37 ` [LTP] [PATCH 1/2] lib/tst_test: setup TCID earlier in do_setup() Li Wang
2021-06-25  9:27 ` Cyril Hrubis
2021-06-28  9:47   ` Alexey Kodanev

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.