Hi,

This patch fixes mmapstress07 test case by obtaining default settings from 
default page size. It also preserve the possibility to use user-specified 
arguments.

Signed-off-by: CAI Qian <[EMAIL PROTECTED]>

--- ./testcases/kernel/mem/mmapstress/mmapstress07.c.orig       2008-12-10 
15:31:03.404152070 +0800
+++ testcases/kernel/mem/mmapstress/mmapstress07.c      2008-12-11 
13:15:05.728135905 +0800
@@ -108,7 +108,7 @@
        (void)time(&t);
 //     (void)printf("%s: Started %s", argv[0], ctime(&t));
        /* Test fsync & mmap over a hole in a sparse file & extend fragment */
-       if (argc != 5) {
+       if (argc < 2 || argc > 5) {
                fprintf(stderr, "Usage: mmapstress07 filename holesize 
e_pageskip sparseoff\n");
                /*****  **      LTP Port 02/01/03       **      **** */
                fprintf(stderr, "\t*holesize should be a multiple of 
pagesize\n");
@@ -120,17 +120,32 @@
        }
        tst_tmpdir();
        tmpname = argv[1];
+
+       if (argc >= 3) {
 #ifdef LARGE_FILE
-       holesize = atoll(argv[2]);
+               holesize = atoll(argv[2]);
 #else /* LARGE_FILE */
-       holesize = atoi(argv[2]);
+               holesize = atoi(argv[2]);
 #endif /* LARGE_FILE */
-       e_pageskip = atoi(argv[3]);
+       }
+       else
+               holesize = pagesize;
+
+       if (argc >= 4)
+               e_pageskip = atoi(argv[3]);
+       else
+               e_pageskip = 1;
+
+       if (argc >= 5) {
 #ifdef LARGE_FILE
-       sparseoff = atoll(argv[4]);
+               sparseoff = atoll(argv[4]);
 #else /* LARGE_FILE */
-       sparseoff = atoi(argv[4]);
+               sparseoff = atoi(argv[4]);
 #endif /* LARGE_FILE */
+       }
+       else
+               sparseoff = pagesize*2;
+
         sa.sa_handler = cleanup;
         sa.sa_flags = 0;
         if (sigemptyset(&sa.sa_mask)) {
@@ -202,7 +217,7 @@
                CLEANERROR("mmap tmp file failed");
                anyfail(); /* LTP Port */
        }
-       /* fill out remainder of page + one more page to extend mmapped frag */
+       /* fill out remainder of page + one more page to extend mmapped flag */
        while (i < 2*pagesize && write(rwfd, "c", 1) == 1)
                i++;
        if (i != 2*pagesize) {


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to