Signed-Off-By: Subrata Modak<[email protected]>,
--
diff -uprN
ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
 
ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
---
ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
 2009-01-23 10:47:20.000000000 +0530
+++
ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
 2009-01-23 10:54:01.000000000 +0530
@@ -52,6 +52,7 @@
  */

#include "ipcshm.h"
+#include "system_specific_hugepages_info.h"

char *TCID = "hugeshmget03";
int TST_TOTAL = 1;
@@ -75,6 +76,7 @@ int main(int ac, char **av)
{
int lc; /* loop counter */
char *msg; /* message returned from parse_opts */
+        unsigned long huge_pages_shm_to_be_allocated;

/* parse standard options */
if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -84,7 +86,11 @@ int main(int ac, char **av)
setup(); /* global setup */

/* The following loop checks looping state if -i option given */
-
+        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 ;
+     
for (lc = 0; TEST_LOOPING(lc); lc++) {
/* reset Tst_count in case we are looping */
Tst_count = 0;
@@ -92,9 +98,8 @@ int main(int ac, char **av)
/*
* use the TEST() macro to make the call
*/
- 
- TEST(shmget(IPC_PRIVATE, HUGE_SHM_SIZE, SHM_HUGETLB | IPC_CREAT |
IPC_EXCL
-     | SHM_RW));
+         
+ TEST(shmget(IPC_PRIVATE, huge_pages_shm_to_be_allocated, SHM_HUGETLB |
IPC_CREAT | IPC_EXCL | SHM_RW));

if (TEST_RETURN != -1) {
tst_resm(TFAIL, "call succeeded when error expected");


Regards--
Subrata

diff -uprN ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c
--- ltp-intermediate-20090121.orig/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c	2009-01-23 10:47:20.000000000 +0530
+++ ltp-intermediate-20090121/testcases/kernel/mem/hugetlb/hugeshmget/hugeshmget03.c	2009-01-23 10:54:01.000000000 +0530
@@ -52,6 +52,7 @@
  */
 
 #include "ipcshm.h"
+#include "system_specific_hugepages_info.h"
 
 char *TCID = "hugeshmget03";
 int TST_TOTAL = 1;
@@ -75,6 +76,7 @@ int main(int ac, char **av)
 {
 	int lc;				/* loop counter */
 	char *msg;			/* message returned from parse_opts */
+        unsigned long huge_pages_shm_to_be_allocated;
 
 	/* parse standard options */
 	if ((msg = parse_opts(ac, av, (option_t *)NULL, NULL)) != (char *)NULL){
@@ -84,7 +86,11 @@ int main(int ac, char **av)
 	setup();			/* global setup */
 
 	/* The following loop checks looping state if -i option given */
-
+        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 ;
+     
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 		/* reset Tst_count in case we are looping */
 		Tst_count = 0;
@@ -92,9 +98,8 @@ int main(int ac, char **av)
 		/*
 		 * use the TEST() macro to make the call
 		 */
-	
-		TEST(shmget(IPC_PRIVATE, HUGE_SHM_SIZE, SHM_HUGETLB | IPC_CREAT | IPC_EXCL
-			    | SHM_RW));
+	        
+		TEST(shmget(IPC_PRIVATE, huge_pages_shm_to_be_allocated, SHM_HUGETLB | IPC_CREAT | IPC_EXCL | SHM_RW));
 	
 		if (TEST_RETURN != -1) {
 			tst_resm(TFAIL, "call succeeded when error expected");
------------------------------------------------------------------------------
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

Reply via email to