Signed-Off-By: Subrata Modak<[email protected]>,
--
diff -uprN
ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
---
ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
2009-01-23 11:53:20.000000000 +0530
+++
ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
2009-01-23 11:58:16.000000000 +0530
@@ -54,12 +54,14 @@
#include "ipcshm.h"
#include <pwd.h>
+#include "system_specific_hugepages_info.h"
char *TCID = "hugeshmctl02";
int TST_TOTAL = 4;
extern int Tst_count;
char nobody_uid[] = "nobody";
struct passwd *ltpuser;
+unsigned long huge_pages_shm_to_be_allocated;
int exp_enos[] = {EPERM, EACCES, EFAULT, EINVAL, 0}; /* 0 terminated
list */
/* of expected errnos */
@@ -99,6 +101,11 @@ int main(int ac, char **av)
tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
}
+ if ( get_no_of_hugepages() <= 0 || hugepages_size() <= 0 )
+ tst_brkm(TBROK, cleanup, "Test cannot be continued owning
to sufficient availability of Hugepages on the system");
+ else
+ huge_pages_shm_to_be_allocated = ( get_no_of_hugepages() *
hugepages_size() * 1024) / 2 ;
+
setup(); /* global setup */
/* The following loop checks looping state if -i option given */
@@ -166,14 +173,13 @@ setup(void)
shmkey = getipckey();
/* create a shared memory segment without read or write permissions */
- if ((shm_id_1 = shmget(shmkey, HUGE_SHM_SIZE, SHM_HUGETLB | IPC_CREAT
| IPC_EXCL)) == -1) {
+ if ((shm_id_1 = shmget(shmkey, huge_pages_shm_to_be_allocated,
SHM_HUGETLB | IPC_CREAT | IPC_EXCL)) == -1) {
tst_brkm(TBROK, cleanup, "couldn't create shared memory "
"segment #1 in setup()");
}
/* create a shared memory segment with read and write permissions */
- if ((shm_id_2 = shmget(shmkey + 1, HUGE_SHM_SIZE, SHM_HUGETLB |
IPC_CREAT | IPC_EXCL |
- SHM_RW)) == -1) {
+ if ((shm_id_2 = shmget(shmkey + 1, huge_pages_shm_to_be_allocated,
SHM_HUGETLB | IPC_CREAT | IPC_EXCL | SHM_RW)) == -1) {
tst_brkm(TBROK, cleanup, "couldn't create shared memory "
"segment #2 in setup()");
}
Regards--
Subrata
diff -uprN ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c
--- ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c 2009-01-23 11:53:20.000000000 +0530
+++ ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmctl/hugeshmctl02.c 2009-01-23 11:58:16.000000000 +0530
@@ -54,12 +54,14 @@
#include "ipcshm.h"
#include <pwd.h>
+#include "system_specific_hugepages_info.h"
char *TCID = "hugeshmctl02";
int TST_TOTAL = 4;
extern int Tst_count;
char nobody_uid[] = "nobody";
struct passwd *ltpuser;
+unsigned long huge_pages_shm_to_be_allocated;
int exp_enos[] = {EPERM, EACCES, EFAULT, EINVAL, 0}; /* 0 terminated list */
/* of expected errnos */
@@ -99,6 +101,11 @@ int main(int ac, char **av)
tst_brkm(TBROK, cleanup, "OPTION PARSING ERROR - %s", msg);
}
+ if ( get_no_of_hugepages() <= 0 || hugepages_size() <= 0 )
+ tst_brkm(TBROK, cleanup, "Test cannot be continued owning to sufficient availability of Hugepages on the system");
+ else
+ huge_pages_shm_to_be_allocated = ( get_no_of_hugepages() * hugepages_size() * 1024) / 2 ;
+
setup(); /* global setup */
/* The following loop checks looping state if -i option given */
@@ -166,14 +173,13 @@ setup(void)
shmkey = getipckey();
/* create a shared memory segment without read or write permissions */
- if ((shm_id_1 = shmget(shmkey, HUGE_SHM_SIZE, SHM_HUGETLB | IPC_CREAT | IPC_EXCL)) == -1) {
+ if ((shm_id_1 = shmget(shmkey, huge_pages_shm_to_be_allocated, SHM_HUGETLB | IPC_CREAT | IPC_EXCL)) == -1) {
tst_brkm(TBROK, cleanup, "couldn't create shared memory "
"segment #1 in setup()");
}
/* create a shared memory segment with read and write permissions */
- if ((shm_id_2 = shmget(shmkey + 1, HUGE_SHM_SIZE, SHM_HUGETLB | IPC_CREAT | IPC_EXCL |
- SHM_RW)) == -1) {
+ if ((shm_id_2 = shmget(shmkey + 1, huge_pages_shm_to_be_allocated, SHM_HUGETLB | IPC_CREAT | IPC_EXCL | SHM_RW)) == -1) {
tst_brkm(TBROK, cleanup, "couldn't create shared memory "
"segment #2 in setup()");
}
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list