Skip to contentSkip to conversation

semop/semop04.c: fix a bug when running with -i option

PATCH Applied Xiaoguang Wang 3 participants 3 messages Dec 24, 2013 – Dec 25, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 semop/semop04.c: fix a bug when running with -i option

If we run semop04 like this: ./semop04 -i 2,
its output will be:

semop04     1  TPASS  :  expected failure - errno = 11 : Resource temporarily unavailable
semop04     2  TPASS  :  expected failure - errno = 11 : Resource temporarily unavailable
semop04     1  TBROK  :  semctl() failed
semop04     2  TBROK  :  Remaining cases broken.

Actually in the second iteration, semctl will return ERANGE. This is because the val variable will be less than zero in the sceond iteration.

Variable val should be reset to 1 before this actual errno test.

---
 testcases/kernel/syscalls/ipc/semop/semop04.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/ipc/semop/semop04.c +2 -1
index 2725378..f7efd86 100644
@@ -80,7 +80,7 @@ int main(int ac, char **av)
 {
 	int lc;
 	char *msg;
-	int val = 1;		/* value for SETVAL */
+	int val;		/* value for SETVAL */
 
 	int i;
 
@@ -96,6 +96,7 @@ int main(int ac, char **av)
 		/* reset tst_count in case we are looping */
 		tst_count = 0;
 
+		val = 1;
 		for (i = 0; i < TST_TOTAL; i++) {
 
 			/* initialize the s_buf buffer */
Signature · 13 lines
1.8.2.1


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Reviewed-by on v1 1/1
#1 lore raw

----- Original Message -----

Quoted 15 lines

From: "Xiaoguang Wang" <[email protected]>
To: [email protected]
Sent: Tuesday, 24 December, 2013 11:24:20 AM
Subject: [LTP] [PATCH] semop/semop04.c: fix a bug when running with -i option

If we run semop04 like this: ./semop04 -i 2,
its output will be:

semop04 1 TPASS : expected failure - errno = 11 : Resource temporarily
unavailable
semop04 2 TPASS : expected failure - errno = 11 : Resource temporarily
unavailable

semop04     1  TBROK  :  semctl() failed
semop04     2  TBROK  :  Remaining cases broken.
Quoted 6 lines

Actually in the second iteration, semctl will return ERANGE. This is because the val variable will be less than zero in the sceond iteration.

Variable val should be reset to 1 before this actual errno test.

Looks good:

Quoted 30 lines
---
 testcases/kernel/syscalls/ipc/semop/semop04.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
testcases/kernel/syscalls/ipc/semop/semop04.c +2 -2
index 2725378..f7efd86 100644
@@ -80,7 +80,7 @@ int main(int ac, char **av)
 {
 	int lc;
 	char *msg;
-	int val = 1;		/* value for SETVAL */
+	int val;		/* value for SETVAL */
 
 	int i;
 
@@ -96,6 +96,7 @@ int main(int ac, char **av)
 		/* reset tst_count in case we are looping */
 		tst_count = 0;
 
+		val = 1;
 		for (i = 0; i < TST_TOTAL; i++) {
 
 			/* initialize the s_buf buffer */
--

1.8.2.1

Quoted 12 lines

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Applied
#2 lore raw
In reply to Xiaoguang Wang
Quoted 11 lines · Xiaoguang Wang

If we run semop04 like this: ./semop04 -i 2,
its output will be:

semop04     1  TPASS  :  expected failure - errno = 11 : Resource temporarily unavailable
semop04     2  TPASS  :  expected failure - errno = 11 : Resource temporarily unavailable
semop04     1  TBROK  :  semctl() failed
semop04     2  TBROK  :  Remaining cases broken.

Actually in the second iteration, semctl will return ERANGE. This is because the val variable will be less than zero in the sceond iteration.

Quoted 6 lines

Variable val should be reset to 1 before this actual errno test.

---
 testcases/kernel/syscalls/ipc/semop/semop04.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied, thank you.

Wanlong Gao

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list