diff mbox series

[rt-tests,v3,27/33] pip_stress: Return failure code if test fails

Message ID 20210320183829.1318-28-dwagner@suse.de
State New
Headers show
Series JSON cleanups and more tests updated | expand

Commit Message

Daniel Wagner March 20, 2021, 6:38 p.m. UTC
Let the test return a failure code when the test fails.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/pi_tests/pip_stress.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

John Kacur May 7, 2021, 4:54 p.m. UTC | #1
On Sat, 20 Mar 2021, Daniel Wagner wrote:

> Let the test return a failure code when the test fails.

> 

> Signed-off-by: Daniel Wagner <dwagner@suse.de>

> ---

>  src/pi_tests/pip_stress.c | 8 ++++----

>  1 file changed, 4 insertions(+), 4 deletions(-)

> 

> diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c

> index 2c3288984202..ed034799da66 100644

> --- a/src/pi_tests/pip_stress.c

> +++ b/src/pi_tests/pip_stress.c

> @@ -160,11 +160,11 @@ int main(int argc, char *argv[])

>  		}

>  	}

>  

> -	if (statep->inversion)

> -		printf("Successfully used priority inheritance to handle an inversion\n");

> -	else

> +	if (!statep->inversion) {

>  		printf("No inversion incurred\n");

> -

> +		exit(1);

> +	}

> +	printf("Successfully used priority inheritance to handle an inversion\n");

>  	exit(0);

>  }

>  

> -- 

> 2.30.2

> 

> 


It isn't really an error if no priority inheritance occurs.
An error from this program would be something like mmap returning an error 
code.

I'm not sure this one is suitable for the json treatment, it's more of a 
demonstration of how to use priority inheritance with processes instead of 
threads. Thomas told me this was possible and I was curious to see if this 
was true, so I scratched that itch. Not sure if it is useful as a test.

Let's leave pip_stress alone for now please
Daniel Wagner May 12, 2021, 7:35 a.m. UTC | #2
> It isn't really an error if no priority inheritance occurs.

> An error from this program would be something like mmap returning an error 

> code.

> 

> I'm not sure this one is suitable for the json treatment, it's more of a 

> demonstration of how to use priority inheritance with processes instead of 

> threads. Thomas told me this was possible and I was curious to see if this 

> was true, so I scratched that itch. Not sure if it is useful as a test.

> 

> Let's leave pip_stress alone for now please


If it's a for demonstration purposes only, could we remove it from the
source tree? I don't think it should be left there if it's not
considered a proper test.
John Kacur May 13, 2021, 7:27 p.m. UTC | #3
On Wed, May 12, 2021 at 3:36 AM Daniel Wagner <wagi@monom.org> wrote:
>

> > It isn't really an error if no priority inheritance occurs.

> > An error from this program would be something like mmap returning an error

> > code.

> >

> > I'm not sure this one is suitable for the json treatment, it's more of a

> > demonstration of how to use priority inheritance with processes instead of

> > threads. Thomas told me this was possible and I was curious to see if this

> > was true, so I scratched that itch. Not sure if it is useful as a test.

> >

> > Let's leave pip_stress alone for now please

>

> If it's a for demonstration purposes only, could we remove it from the

> source tree? I don't think it should be left there if it's not

> considered a proper test.

>


I suppose this is a fair question, although another question would be
is it useful in the rt-tests suites for other reasons?
It could be used as the "engine" of a test that would be similar to
pi_stress, with a different kind of mechanism.

So then the question would be, is there a value in another pi_stress
like test that avoids pthreads?
If so, I could work it up into a test.

John
Daniel Wagner May 14, 2021, 6:58 a.m. UTC | #4
On Thu, May 13, 2021 at 03:27:31PM -0400, John Kacur wrote:
> I suppose this is a fair question, although another question would be

> is it useful in the rt-tests suites for other reasons?

> It could be used as the "engine" of a test that would be similar to

> pi_stress, with a different kind of mechanism.


If there is clear indication which code is provided as coding example
and which is a RT test it would already help. I was under the impression
pi_stress tries to test RT behavior. Maybe moving pi_stress to
'examples' would already be enough.

> So then the question would be, is there a value in another pi_stress

> like test that avoids pthreads?

>

> If so, I could work it up into a test.


I suppose having more RT tests is good thing. IIRC there are more RT
tests available, e.g. in LTP. So not sure if this is not already covered
somewhere else.
diff mbox series

Patch

diff --git a/src/pi_tests/pip_stress.c b/src/pi_tests/pip_stress.c
index 2c3288984202..ed034799da66 100644
--- a/src/pi_tests/pip_stress.c
+++ b/src/pi_tests/pip_stress.c
@@ -160,11 +160,11 @@  int main(int argc, char *argv[])
 		}
 	}
 
-	if (statep->inversion)
-		printf("Successfully used priority inheritance to handle an inversion\n");
-	else
+	if (!statep->inversion) {
 		printf("No inversion incurred\n");
-
+		exit(1);
+	}
+	printf("Successfully used priority inheritance to handle an inversion\n");
 	exit(0);
 }