Improve the mmap test.
authorErez_Zadok <ezk@cs.sunysb.edu>
Sat, 14 Jul 2007 07:58:01 +0000 (03:58 -0400)
committerErez_Zadok <ezk@cs.sunysb.edu>
Sat, 14 Jul 2007 07:58:01 +0000 (03:58 -0400)
1. produce files that are larger than one page, so we test multi-page mmap
   reads and writes.

2. perform mmap reads and writes on BOTH the read-write and read-only
   branches.

t-mmap.sh

index 5ada47b1236e10e292f3d4f16aadf8b7ee005fb5..86328833167f64b5d535e90fb0ffa0762d271473 100755 (executable)
--- a/t-mmap.sh
+++ b/t-mmap.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 # TEST: Branches: b0,b1=ro and b0,b1
-# TEST: open(a), mmap) for reading, read, unmap, close
-# TEST: open(b), mmap for writing/copyup, read, rewrite, unmap, close
+# read-only TEST: open(f), mmap for reading, read, unmap, close
+# readwrite TEST: open(f), mmap for writing/copyup, read, rewrite, unmap, close
 
 source scaffold
 
@@ -9,8 +9,8 @@ function files {
 cat <<FILES
 d $TOP_LOWER_DIR
 d $LOWER_DIR0
+f $LOWER_DIR0/a
 d $LOWER_DIR1
-f $LOWER_DIR1/a
 f $LOWER_DIR1/b
 d $LOWER_DIR2
 d $LOWER_DIR3
@@ -21,8 +21,8 @@ function afterfiles_ro {
 cat <<FILES
 d $TOP_LOWER_DIR
 d $LOWER_DIR0
+f $LOWER_DIR0/a
 d $LOWER_DIR1
-f $LOWER_DIR1/a
 f $LOWER_DIR1/b
 d $LOWER_DIR2
 d $LOWER_DIR3
@@ -33,9 +33,9 @@ function afterfiles_rw {
 cat <<FILES
 d $TOP_LOWER_DIR
 d $LOWER_DIR0
+f $LOWER_DIR0/a
 f $LOWER_DIR0/b
 d $LOWER_DIR1
-f $LOWER_DIR1/a
 f $LOWER_DIR1/b
 d $LOWER_DIR2
 d $LOWER_DIR3
@@ -46,7 +46,10 @@ FILES
 function test_ro {
     ( files ) | create_hierarchy
     mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro
+    dd if=/dev/zero of=$LOWER_DIR0/a bs=4096 count=4 2>/dev/null
+    dd if=/dev/zero of=$LOWER_DIR1/b bs=4096 count=4 2>/dev/null
     ./progs/mapper -r $MOUNTPOINT/a > /dev/null
+    ./progs/mapper -r $MOUNTPOINT/b > /dev/null
     unmount_union
     echo -n "[ro] "
     ( afterfiles_ro ) | check_hierarchy $TOP_LOWER_DIR
@@ -55,7 +58,10 @@ function test_ro {
 # read-write mmap test
 function test_rw {
     ( files ) | create_hierarchy
+    dd if=/dev/zero of=$LOWER_DIR0/a bs=4096 count=4 2>/dev/null
+    dd if=/dev/zero of=$LOWER_DIR1/b bs=4096 count=4 2>/dev/null
     mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro
+    ./progs/mapper -w $MOUNTPOINT/a > /dev/null
     ./progs/mapper -w $MOUNTPOINT/b > /dev/null
     echo -n "[rw] "
     unmount_union