* [LTP] [PATCH 2/2] semop/semop02.c: add ERANGE error value test
@ 2013-12-26 6:23 Xiaoguang Wang
2014-01-06 11:42 ` Jan Stancek
2014-01-21 2:10 ` Wanlong Gao
0 siblings, 2 replies; 3+ messages in thread
From: Xiaoguang Wang @ 2013-12-26 6:23 UTC (permalink / raw)
To: ltp-list
Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
---
testcases/kernel/syscalls/ipc/semop/semop02.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/testcases/kernel/syscalls/ipc/semop/semop02.c b/testcases/kernel/syscalls/ipc/semop/semop02.c
index 08fc43c..b2ed38c 100644
--- a/testcases/kernel/syscalls/ipc/semop/semop02.c
+++ b/testcases/kernel/syscalls/ipc/semop/semop02.c
@@ -19,7 +19,7 @@
/*
* DESCRIPTION
- * semop02 - test for E2BIG, EACCES, EFAULT and EINVAL errors
+ * semop02 - test for E2BIG, EACCES, EFAULT, EINVAL and ERANGE errors
*
* HISTORY
* 03/2001 - Written by Wayne Boyer
@@ -29,6 +29,7 @@
* conflict with the key from another task.
*/
+#define _GNU_SOURCE
#include <pwd.h>
#include "test.h"
#include "safe_macros.h"
@@ -38,7 +39,7 @@ char *TCID = "semop02";
static void semop_verify(int i);
-static int exp_enos[] = { E2BIG, EACCES, EFAULT, EINVAL, 0 };
+static int exp_enos[] = { E2BIG, EACCES, EFAULT, EINVAL, ERANGE, 0 };
int sem_id_1 = -1; /* a semaphore set with read & alter permissions */
int sem_id_2 = -1; /* a semaphore set without read & alter permissions */
int bad_id = -1;
@@ -50,7 +51,6 @@ int badbuf = -1;
#define NSOPS 5 /* a resonable number of operations */
#define BIGOPS 1024 /* a value that is too large for the number */
/* of semop operations that are permitted */
-
struct test_case_t {
int *semid;
struct sembuf *t_sbuf;
@@ -61,7 +61,8 @@ struct test_case_t {
{&sem_id_2, (struct sembuf *)&s_buf, NSOPS, EACCES},
{&sem_id_1, (struct sembuf *)-1, NSOPS, EFAULT},
{&sem_id_1, (struct sembuf *)&s_buf, 0, EINVAL},
- {&bad_id, (struct sembuf *)&s_buf, NSOPS, EINVAL}
+ {&bad_id, (struct sembuf *)&s_buf, NSOPS, EINVAL},
+ {&sem_id_1, (struct sembuf *)&s_buf, 1, ERANGE}
};
int TST_TOTAL = ARRAY_SIZE(TC);
@@ -94,6 +95,8 @@ void setup(void)
char nobody_uid[] = "nobody";
struct passwd *ltpuser;
key_t semkey2;
+ struct seminfo ipc_buf;
+ union semun arr;
tst_require_root(NULL);
@@ -127,6 +130,16 @@ void setup(void)
tst_brkm(TBROK | TERRNO, cleanup,
"couldn't create semaphore in setup");
}
+
+ arr.ipc_buf = &ipc_buf;
+ if (semctl(sem_id_1, 0, IPC_INFO, arr) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "semctl() IPC_INFO failed");
+
+ /* for ERANGE errno test */
+ arr.val = 1;
+ s_buf[0].sem_op = ipc_buf.semvmx;
+ if (semctl(sem_id_1, 0, SETVAL, arr) == -1)
+ tst_brkm(TBROK | TERRNO, cleanup, "semctl() SETVAL failed");
}
static void semop_verify(int i)
--
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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH 2/2] semop/semop02.c: add ERANGE error value test
2013-12-26 6:23 [LTP] [PATCH 2/2] semop/semop02.c: add ERANGE error value test Xiaoguang Wang
@ 2014-01-06 11:42 ` Jan Stancek
2014-01-21 2:10 ` Wanlong Gao
1 sibling, 0 replies; 3+ messages in thread
From: Jan Stancek @ 2014-01-06 11:42 UTC (permalink / raw)
To: Xiaoguang Wang; +Cc: ltp-list
----- Original Message -----
> From: "Xiaoguang Wang" <wangxg.fnst@cn.fujitsu.com>
> To: ltp-list@lists.sourceforge.net
> Sent: Thursday, 26 December, 2013 7:23:01 AM
> Subject: [LTP] [PATCH 2/2] semop/semop02.c: add ERANGE error value test
>
>
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
Looks good to me:
Reviewed-by: Jan Stancek <jstancek@redhat.com>
I also ran it on RHEL 5.3/6.5/7 Beta and didn't see any issues.
Regards,
Jan
> ---
> testcases/kernel/syscalls/ipc/semop/semop02.c | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/ipc/semop/semop02.c
> b/testcases/kernel/syscalls/ipc/semop/semop02.c
> index 08fc43c..b2ed38c 100644
> --- a/testcases/kernel/syscalls/ipc/semop/semop02.c
> +++ b/testcases/kernel/syscalls/ipc/semop/semop02.c
> @@ -19,7 +19,7 @@
>
> /*
> * DESCRIPTION
> - * semop02 - test for E2BIG, EACCES, EFAULT and EINVAL errors
> + * semop02 - test for E2BIG, EACCES, EFAULT, EINVAL and ERANGE errors
> *
> * HISTORY
> * 03/2001 - Written by Wayne Boyer
> @@ -29,6 +29,7 @@
> * conflict with the key from another task.
> */
>
> +#define _GNU_SOURCE
> #include <pwd.h>
> #include "test.h"
> #include "safe_macros.h"
> @@ -38,7 +39,7 @@ char *TCID = "semop02";
>
> static void semop_verify(int i);
>
> -static int exp_enos[] = { E2BIG, EACCES, EFAULT, EINVAL, 0 };
> +static int exp_enos[] = { E2BIG, EACCES, EFAULT, EINVAL, ERANGE, 0 };
> int sem_id_1 = -1; /* a semaphore set with read & alter permissions */
> int sem_id_2 = -1; /* a semaphore set without read & alter permissions */
> int bad_id = -1;
> @@ -50,7 +51,6 @@ int badbuf = -1;
> #define NSOPS 5 /* a resonable number of operations */
> #define BIGOPS 1024 /* a value that is too large for the number */
> /* of semop operations that are permitted */
> -
> struct test_case_t {
> int *semid;
> struct sembuf *t_sbuf;
> @@ -61,7 +61,8 @@ struct test_case_t {
> {&sem_id_2, (struct sembuf *)&s_buf, NSOPS, EACCES},
> {&sem_id_1, (struct sembuf *)-1, NSOPS, EFAULT},
> {&sem_id_1, (struct sembuf *)&s_buf, 0, EINVAL},
> - {&bad_id, (struct sembuf *)&s_buf, NSOPS, EINVAL}
> + {&bad_id, (struct sembuf *)&s_buf, NSOPS, EINVAL},
> + {&sem_id_1, (struct sembuf *)&s_buf, 1, ERANGE}
> };
>
> int TST_TOTAL = ARRAY_SIZE(TC);
> @@ -94,6 +95,8 @@ void setup(void)
> char nobody_uid[] = "nobody";
> struct passwd *ltpuser;
> key_t semkey2;
> + struct seminfo ipc_buf;
> + union semun arr;
>
> tst_require_root(NULL);
>
> @@ -127,6 +130,16 @@ void setup(void)
> tst_brkm(TBROK | TERRNO, cleanup,
> "couldn't create semaphore in setup");
> }
> +
> + arr.ipc_buf = &ipc_buf;
> + if (semctl(sem_id_1, 0, IPC_INFO, arr) == -1)
> + tst_brkm(TBROK | TERRNO, cleanup, "semctl() IPC_INFO failed");
> +
> + /* for ERANGE errno test */
> + arr.val = 1;
> + s_buf[0].sem_op = ipc_buf.semvmx;
> + if (semctl(sem_id_1, 0, SETVAL, arr) == -1)
> + tst_brkm(TBROK | TERRNO, cleanup, "semctl() SETVAL failed");
> }
>
> static void semop_verify(int i)
> --
> 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
> Ltp-list@lists.sourceforge.net
> 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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [LTP] [PATCH 2/2] semop/semop02.c: add ERANGE error value test
2013-12-26 6:23 [LTP] [PATCH 2/2] semop/semop02.c: add ERANGE error value test Xiaoguang Wang
2014-01-06 11:42 ` Jan Stancek
@ 2014-01-21 2:10 ` Wanlong Gao
1 sibling, 0 replies; 3+ messages in thread
From: Wanlong Gao @ 2014-01-21 2:10 UTC (permalink / raw)
To: Xiaoguang Wang; +Cc: ltp-list
On 12/26/2013 02:23 PM, Xiaoguang Wang wrote:
> Signed-off-by: Xiaoguang Wang <wangxg.fnst@cn.fujitsu.com>
> ---
> testcases/kernel/syscalls/ipc/semop/semop02.c | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
Applied, thank you.
Wanlong Gao
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-21 2:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-26 6:23 [LTP] [PATCH 2/2] semop/semop02.c: add ERANGE error value test Xiaoguang Wang
2014-01-06 11:42 ` Jan Stancek
2014-01-21 2:10 ` Wanlong Gao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox