#!/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
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
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
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
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
# 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