* [LTP] [PATCH v1] kernel/pty06: Skip test when TTY not available
@ 2022-03-11 12:39 Bogdan Lezhepekov
2022-03-11 15:33 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Bogdan Lezhepekov @ 2022-03-11 12:39 UTC (permalink / raw)
To: ltp
Since TTYs under test are hardcoded, they
might not be available in some systems.
Signed-off-by: Bogdan Lezhepekov <blezhepekov@suse.de>
---
testcases/kernel/pty/pty06.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/testcases/kernel/pty/pty06.c b/testcases/kernel/pty/pty06.c
index b621f584f..250c38f6b 100644
--- a/testcases/kernel/pty/pty06.c
+++ b/testcases/kernel/pty/pty06.c
@@ -45,8 +45,6 @@ static struct tst_fzsync_pair fzp;
static void *open_close(void *unused)
{
- sprintf(tty_path_b, "/dev/tty%d", test_tty_port);
-
while (tst_fzsync_run_b(&fzp)) {
tst_fzsync_start_race_b(&fzp);
int fd = SAFE_OPEN(tty_path_b, O_RDWR);
@@ -60,7 +58,6 @@ static void *open_close(void *unused)
static void do_test(void)
{
- sprintf(tty_path_a, "/dev/tty%d", test_tty_port + 1);
int fd = SAFE_OPEN(tty_path_a, O_RDWR);
tst_fzsync_pair_reset(&fzp, open_close);
@@ -80,6 +77,12 @@ static void do_test(void)
static void setup(void)
{
+ sprintf(tty_path_a, "/dev/tty%d", test_tty_port + 1);
+ sprintf(tty_path_b, "/dev/tty%d", test_tty_port);
+
+ if (access(tty_path_a, F_OK) != 0 || access(tty_path_b, F_OK) != 0)
+ tst_brk(TCONF, "TTY(s) under test not available in system");
+
tst_fzsync_pair_init(&fzp);
}
--
2.35.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v1] kernel/pty06: Skip test when TTY not available
2022-03-11 12:39 [LTP] [PATCH v1] kernel/pty06: Skip test when TTY not available Bogdan Lezhepekov
@ 2022-03-11 15:33 ` Cyril Hrubis
2022-04-05 6:49 ` blezhepekov
0 siblings, 1 reply; 4+ messages in thread
From: Cyril Hrubis @ 2022-03-11 15:33 UTC (permalink / raw)
To: Bogdan Lezhepekov; +Cc: ltp
Hi!
> Since TTYs under test are hardcoded, they
> might not be available in some systems.
Is the system you are running the tests on completely without ttys?
> Signed-off-by: Bogdan Lezhepekov <blezhepekov@suse.de>
> ---
> testcases/kernel/pty/pty06.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/testcases/kernel/pty/pty06.c b/testcases/kernel/pty/pty06.c
> index b621f584f..250c38f6b 100644
> --- a/testcases/kernel/pty/pty06.c
> +++ b/testcases/kernel/pty/pty06.c
> @@ -45,8 +45,6 @@ static struct tst_fzsync_pair fzp;
>
> static void *open_close(void *unused)
> {
> - sprintf(tty_path_b, "/dev/tty%d", test_tty_port);
> -
> while (tst_fzsync_run_b(&fzp)) {
> tst_fzsync_start_race_b(&fzp);
> int fd = SAFE_OPEN(tty_path_b, O_RDWR);
> @@ -60,7 +58,6 @@ static void *open_close(void *unused)
>
> static void do_test(void)
> {
> - sprintf(tty_path_a, "/dev/tty%d", test_tty_port + 1);
> int fd = SAFE_OPEN(tty_path_a, O_RDWR);
>
> tst_fzsync_pair_reset(&fzp, open_close);
> @@ -80,6 +77,12 @@ static void do_test(void)
>
> static void setup(void)
> {
> + sprintf(tty_path_a, "/dev/tty%d", test_tty_port + 1);
> + sprintf(tty_path_b, "/dev/tty%d", test_tty_port);
> +
> + if (access(tty_path_a, F_OK) != 0 || access(tty_path_b, F_OK) != 0)
> + tst_brk(TCONF, "TTY(s) under test not available in system");
There is no need for the != 0 could be simplified just to:
if (access(...) || access(...))
tst_brk(TCONF, ...);
> tst_fzsync_pair_init(&fzp);
> }
>
> --
> 2.35.1
>
>
> --
> Mailing list info: https://lists.linux.it/listinfo/ltp
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v1] kernel/pty06: Skip test when TTY not available
2022-03-11 15:33 ` Cyril Hrubis
@ 2022-04-05 6:49 ` blezhepekov
2022-04-11 11:25 ` Richard Palethorpe
0 siblings, 1 reply; 4+ messages in thread
From: blezhepekov @ 2022-04-05 6:49 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: ltp
On 2022-03-11 17:33, Cyril Hrubis wrote:
> Hi!
>> Since TTYs under test are hardcoded, they
>> might not be available in some systems.
>
> Is the system you are running the tests on completely without ttys?
>
>> Signed-off-by: Bogdan Lezhepekov <blezhepekov@suse.de>
>> ---
>> testcases/kernel/pty/pty06.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/testcases/kernel/pty/pty06.c
>> b/testcases/kernel/pty/pty06.c
>> index b621f584f..250c38f6b 100644
>> --- a/testcases/kernel/pty/pty06.c
>> +++ b/testcases/kernel/pty/pty06.c
>> @@ -45,8 +45,6 @@ static struct tst_fzsync_pair fzp;
>>
>> static void *open_close(void *unused)
>> {
>> - sprintf(tty_path_b, "/dev/tty%d", test_tty_port);
>> -
>> while (tst_fzsync_run_b(&fzp)) {
>> tst_fzsync_start_race_b(&fzp);
>> int fd = SAFE_OPEN(tty_path_b, O_RDWR);
>> @@ -60,7 +58,6 @@ static void *open_close(void *unused)
>>
>> static void do_test(void)
>> {
>> - sprintf(tty_path_a, "/dev/tty%d", test_tty_port + 1);
>> int fd = SAFE_OPEN(tty_path_a, O_RDWR);
>>
>> tst_fzsync_pair_reset(&fzp, open_close);
>> @@ -80,6 +77,12 @@ static void do_test(void)
>>
>> static void setup(void)
>> {
>> + sprintf(tty_path_a, "/dev/tty%d", test_tty_port + 1);
>> + sprintf(tty_path_b, "/dev/tty%d", test_tty_port);
>> +
>> + if (access(tty_path_a, F_OK) != 0 || access(tty_path_b, F_OK) != 0)
>> + tst_brk(TCONF, "TTY(s) under test not available in system");
>
> There is no need for the != 0 could be simplified just to:
>
> if (access(...) || access(...))
> tst_brk(TCONF, ...);
>
>> tst_fzsync_pair_init(&fzp);
>> }
>>
>> --
>> 2.35.1
>>
>>
>> --
>> Mailing list info: https://lists.linux.it/listinfo/ltp
Hi Cyril,
Sorry for the delayed reply. I see the test requires an emulated
terminal (ttyX), whilst our system supports serial console only (ttySX).
What would be your recommendation, does it make sense to switch to
ttySX? I wasn't sure about it, so disabling seemed more logical.
Thanks,
Bogdan
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH v1] kernel/pty06: Skip test when TTY not available
2022-04-05 6:49 ` blezhepekov
@ 2022-04-11 11:25 ` Richard Palethorpe
0 siblings, 0 replies; 4+ messages in thread
From: Richard Palethorpe @ 2022-04-11 11:25 UTC (permalink / raw)
To: blezhepekov; +Cc: ltp
Hello Bogdan,
blezhepekov <blezhepekov@suse.de> writes:
> On 2022-03-11 17:33, Cyril Hrubis wrote:
>> Hi!
>>> Since TTYs under test are hardcoded, they
>>> might not be available in some systems.
>> Is the system you are running the tests on completely without ttys?
>>
>>> Signed-off-by: Bogdan Lezhepekov <blezhepekov@suse.de>
>>> ---
>>> testcases/kernel/pty/pty06.c | 9 ++++++---
>>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>> diff --git a/testcases/kernel/pty/pty06.c
>>> b/testcases/kernel/pty/pty06.c
>>> index b621f584f..250c38f6b 100644
>>> --- a/testcases/kernel/pty/pty06.c
>>> +++ b/testcases/kernel/pty/pty06.c
>>> @@ -45,8 +45,6 @@ static struct tst_fzsync_pair fzp;
>>> static void *open_close(void *unused)
>>> {
>>> - sprintf(tty_path_b, "/dev/tty%d", test_tty_port);
>>> -
>>> while (tst_fzsync_run_b(&fzp)) {
>>> tst_fzsync_start_race_b(&fzp);
>>> int fd = SAFE_OPEN(tty_path_b, O_RDWR);
>>> @@ -60,7 +58,6 @@ static void *open_close(void *unused)
>>> static void do_test(void)
>>> {
>>> - sprintf(tty_path_a, "/dev/tty%d", test_tty_port + 1);
>>> int fd = SAFE_OPEN(tty_path_a, O_RDWR);
>>> tst_fzsync_pair_reset(&fzp, open_close);
>>> @@ -80,6 +77,12 @@ static void do_test(void)
>>> static void setup(void)
>>> {
>>> + sprintf(tty_path_a, "/dev/tty%d", test_tty_port + 1);
>>> + sprintf(tty_path_b, "/dev/tty%d", test_tty_port);
>>> +
>>> + if (access(tty_path_a, F_OK) != 0 || access(tty_path_b, F_OK) != 0)
>>> + tst_brk(TCONF, "TTY(s) under test not available in system");
>> There is no need for the != 0 could be simplified just to:
>> if (access(...) || access(...))
>> tst_brk(TCONF, ...);
>>
>>> tst_fzsync_pair_init(&fzp);
>>> }
>>> --
>>> 2.35.1
>>>
>>> --
>>> Mailing list info: https://lists.linux.it/listinfo/ltp
>
> Hi Cyril,
>
> Sorry for the delayed reply. I see the test requires an emulated
> terminal (ttyX), whilst our system supports serial console only
> (ttySX).
>
> What would be your recommendation, does it make sense to switch to
> ttySX? I wasn't sure about it, so disabling seemed more logical.
No, I think this only applies to graphical VTs. I'm not sure if it is
possible to create one on a system without real graphics.
Unless someone has an answer to the above, I think it is enough for now
to address Cyril's access comments and post a V2.
>
> Thanks,
> Bogdan
--
Thank you,
Richard.
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-11 11:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-11 12:39 [LTP] [PATCH v1] kernel/pty06: Skip test when TTY not available Bogdan Lezhepekov
2022-03-11 15:33 ` Cyril Hrubis
2022-04-05 6:49 ` blezhepekov
2022-04-11 11:25 ` Richard Palethorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox