Message ID | 20210320183829.1318-27-dwagner@suse.de |
---|---|
State | New |
Headers | show |
Series | JSON cleanups and more tests updated | expand |
On Sat, 20 Mar 2021, Daniel Wagner wrote: > Instead printing the result high() close directly move it to main() > function to simplify the return code if the test fails. > > Signed-off-by: Daniel Wagner <dwagner@suse.de> > --- > src/pi_tests/pip_stress.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c > index 8b91578f9ab8..2c3288984202 100644 > --- a/src/pi_tests/pip_stress.c > +++ b/src/pi_tests/pip_stress.c > @@ -146,6 +146,7 @@ int main(int argc, char *argv[]) > exit(1); > } else if (pid1 != 0) { /* parent code */ > low(pid1); > + exit(0); > } else { /* child code */ > pid2 = fork(); /* parent code */ > if (pid2 == -1) { > @@ -155,9 +156,15 @@ int main(int argc, char *argv[]) > high(pid2); > } else { /* child code */ > medium(); > + exit(0); > } > } > > + if (statep->inversion) > + printf("Successfully used priority inheritance to handle an inversion\n"); > + else > + printf("No inversion incurred\n"); > + > exit(0); > } > > @@ -222,14 +229,6 @@ void high(pid_t pid) > Pthread_mutex_unlock(resource); > kill(pid, SIGKILL); /* kill the medium thread */ > waitpid(pid, &status, 0); > - > - Pthread_mutex_lock(statep->mutex); > - > - if (statep->inversion) > - printf("Successfully used priority inheritance to handle an inversion\n"); > - else > - printf("No inversion incurred\n"); > - Pthread_mutex_unlock(statep->mutex); > } > > /* mmap a page of anonymous shared memory */ > -- > 2.30.2 > > NAK, see comments in the next patch
diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c index 8b91578f9ab8..2c3288984202 100644 --- a/src/pi_tests/pip_stress.c +++ b/src/pi_tests/pip_stress.c @@ -146,6 +146,7 @@ int main(int argc, char *argv[]) exit(1); } else if (pid1 != 0) { /* parent code */ low(pid1); + exit(0); } else { /* child code */ pid2 = fork(); /* parent code */ if (pid2 == -1) { @@ -155,9 +156,15 @@ int main(int argc, char *argv[]) high(pid2); } else { /* child code */ medium(); + exit(0); } } + if (statep->inversion) + printf("Successfully used priority inheritance to handle an inversion\n"); + else + printf("No inversion incurred\n"); + exit(0); } @@ -222,14 +229,6 @@ void high(pid_t pid) Pthread_mutex_unlock(resource); kill(pid, SIGKILL); /* kill the medium thread */ waitpid(pid, &status, 0); - - Pthread_mutex_lock(statep->mutex); - - if (statep->inversion) - printf("Successfully used priority inheritance to handle an inversion\n"); - else - printf("No inversion incurred\n"); - Pthread_mutex_unlock(statep->mutex); } /* mmap a page of anonymous shared memory */
Instead printing the result high() close directly move it to main() function to simplify the return code if the test fails. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- src/pi_tests/pip_stress.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)