* [LTP] [PATCH] openposix: make use of tst_process_state_wait3
@ 2021-09-07 2:52 ` Li Wang
2021-09-07 9:54 ` Cyril Hrubis
0 siblings, 1 reply; 3+ messages in thread
From: Li Wang @ 2021-09-07 2:52 UTC (permalink / raw)
To: ltp
Replaces that sleep 1 sec with a wait until child process state
changes to 'S' (sleeping).
Signed-off-by: Li Wang <liwang@redhat.com>
---
.../conformance/interfaces/clock_nanosleep/1-3.c | 3 ++-
.../conformance/interfaces/clock_nanosleep/1-4.c | 3 ++-
.../conformance/interfaces/clock_nanosleep/1-5.c | 3 ++-
.../conformance/interfaces/clock_nanosleep/10-1.c | 3 ++-
.../conformance/interfaces/clock_nanosleep/2-2.c | 3 ++-
.../conformance/interfaces/clock_nanosleep/2-3.c | 3 ++-
.../conformance/interfaces/clock_nanosleep/9-1.c | 3 ++-
7 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c
index 98de93a9e..e2fdc4c37 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-3.c
@@ -22,6 +22,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include "posixtest.h"
+#include "proc.h"
#define SLEEPSEC 30
@@ -63,7 +64,7 @@ int main(void)
/* parent here */
int i;
- sleep(1);
+ tst_process_state_wait3(pid, 'S', 1);
if (kill(pid, SIGABRT) != 0) {
printf("Could not raise signal being tested\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-4.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-4.c
index 9808c5c4f..ca3d0798f 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-4.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-4.c
@@ -14,6 +14,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include "posixtest.h"
+#include "proc.h"
#define SLEEPSEC 30
@@ -36,7 +37,7 @@ int main(void)
/* parent here */
int i;
- sleep(1);
+ tst_process_state_wait3(pid, 'S', 1);
if (kill(pid, SIGABRT) != 0) {
printf("Could not raise signal being tested\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c
index 46f26163d..263d98a08 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/1-5.c
@@ -18,6 +18,7 @@
#include <sys/wait.h>
#include <stdlib.h>
#include "posixtest.h"
+#include "proc.h"
#define SLEEPSEC 5
@@ -52,7 +53,7 @@ int main(void)
/* parent here */
int i;
- sleep(1);
+ tst_process_state_wait3(pid, 'S', 1);
if (kill(pid, SIGSTOP) != 0) {
printf("Could not raise SIGSTOP\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c
index f6adcc938..9fae578b4 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/10-1.c
@@ -15,6 +15,7 @@
#include <sys/wait.h>
#include <errno.h>
#include "posixtest.h"
+#include "proc.h"
#define SLEEPSEC 30
@@ -59,7 +60,7 @@ int main(void)
/* parent here */
int i;
- sleep(1);
+ tst_process_state_wait3(pid, 'S', 1);
if (kill(pid, SIGABRT) != 0) {
printf("Could not raise signal being tested\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
index 330618877..8cafb3bf0 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-2.c
@@ -23,6 +23,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include "posixtest.h"
+#include "proc.h"
#define SLEEPSEC 30
@@ -71,7 +72,7 @@ int main(void)
/* parent here */
int i;
- sleep(1);
+ tst_process_state_wait3(pid, 'S', 1);
if (kill(pid, SIGABRT) != 0) {
printf("Could not raise signal being tested\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-3.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-3.c
index 06a79a96d..3938f44b7 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-3.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/2-3.c
@@ -16,6 +16,7 @@
#include <unistd.h>
#include <sys/wait.h>
#include "posixtest.h"
+#include "proc.h"
#define SLEEPSEC 30
@@ -45,7 +46,7 @@ int main(void)
/* parent here */
int i;
- sleep(1);
+ tst_process_state_wait3(pid, 'S', 1);
if (kill(pid, SIGABRT) != 0) {
printf("Could not raise signal being tested\n");
diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
index 04ef0a2cc..554714695 100644
--- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
+++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
@@ -17,6 +17,7 @@
#include <stdlib.h>
#include <errno.h>
#include "posixtest.h"
+#include "proc.h"
#define SLEEPSEC 30
@@ -88,7 +89,7 @@ int main(void)
/* parent here */
int i;
- sleep(1);
+ tst_process_state_wait3(pid, 'S', 1);
if (kill(pid, SIGABRT) != 0) {
printf("Could not raise signal being tested\n");
--
2.31.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] openposix: make use of tst_process_state_wait3
@ 2021-09-07 9:54 ` Cyril Hrubis
2021-09-08 1:24 ` Li Wang
0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2021-09-07 9:54 UTC (permalink / raw)
To: Li Wang; +Cc: ltp
Hi!
> diff --git a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
> index 04ef0a2cc..554714695 100644
> --- a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
> +++ b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
> @@ -17,6 +17,7 @@
> #include <stdlib.h>
> #include <errno.h>
> #include "posixtest.h"
> +#include "proc.h"
>
> #define SLEEPSEC 30
>
> @@ -88,7 +89,7 @@ int main(void)
> /* parent here */
> int i;
>
> - sleep(1);
> + tst_process_state_wait3(pid, 'S', 1);
This test is actually the only one that looks at the remining time as
returned by clock_nanosleep() so it may make a sense to keep the
sleep(1) in this test so that the remaining time is smaller than the
sleep time by some reasonable margin. But I guess that the test will
work fine without it as well.
The rest is obviously fine.
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH] openposix: make use of tst_process_state_wait3
@ 2021-09-08 1:24 ` Li Wang
0 siblings, 0 replies; 3+ messages in thread
From: Li Wang @ 2021-09-08 1:24 UTC (permalink / raw)
To: Cyril Hrubis; +Cc: LTP List
[-- Attachment #1.1: Type: text/plain, Size: 1213 bytes --]
On Tue, Sep 7, 2021 at 5:54 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > diff --git
> a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
> b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
> > index 04ef0a2cc..554714695 100644
> > ---
> a/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
> > +++
> b/testcases/open_posix_testsuite/conformance/interfaces/clock_nanosleep/9-1.c
> > @@ -17,6 +17,7 @@
> > #include <stdlib.h>
> > #include <errno.h>
> > #include "posixtest.h"
> > +#include "proc.h"
> >
> > #define SLEEPSEC 30
> >
> > @@ -88,7 +89,7 @@ int main(void)
> > /* parent here */
> > int i;
> >
> > - sleep(1);
> > + tst_process_state_wait3(pid, 'S', 1);
>
> This test is actually the only one that looks at the remining time as
> returned by clock_nanosleep() so it may make a sense to keep the
> sleep(1) in this test so that the remaining time is smaller than the
> sleep time by some reasonable margin. But I guess that the test will
> work fine without it as well.
>
Good point, I have retrieved that 1 sec sleep and applied. Thanks!
--
Regards,
Li Wang
[-- Attachment #1.2: Type: text/html, Size: 1965 bytes --]
[-- Attachment #2: Type: text/plain, Size: 60 bytes --]
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-08 1:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-07 2:52 [LTP] [PATCH] openposix: make use of tst_process_state_wait3 Li Wang
2021-09-07 2:52 ` Li Wang
2021-09-07 9:54 ` Cyril Hrubis
2021-09-07 9:54 ` Cyril Hrubis
2021-09-08 1:24 ` Li Wang
2021-09-08 1:24 ` Li Wang
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.