wh_abs_path=$WH_LOC"/"$NAME
wh_dir=`dirname $wh_abs_path`
wh_file=".wh."`basename $wh_abs_path`
- wh_abs_path=$wh_dir""$wh_file
+ wh_abs_path=$wh_dir"/"$wh_file
touch $wh_abs_path
fi
else
function check_hierarchy {
grep -v '^$' > /tmp/expected-$$
+ # Get a hint on which dirs we are expected to browse
for i in 0 1 2 3; do
- cat "/tmp/expected-$$" | grep "\/n\/lower\/b$i" >/dev/null
- ret=$?
- if [ $ret == 0 ]; then
- browse_path="/n/lower/b$i "$browse_path
- fi
+ ( grep -q "$TOP_LOWER_DIR/b$i" /tmp/expected-$$ ) && browse_path="$TOP_LOWER_DIR/b$i "$browse_path
done
- browse_path=$browse_path" $ODF_DIR/ns/"
+ if [ $ODF -eq 1 ]; then
+ browse_path=$browse_path" $ODF_DIR/ns/"
+ fi
+
for i in $browse_path; do
(
if [ "$i" == $ODF_DIR/ns/ ]; then
find $i -type d -printf 'd %p\n'
find $i -type f -not -name ".wh.*" -printf 'f %p\n'
if [ $ODF -eq 0 ]; then
- find $i -type f -name ".wh.*" | sed "s:$i:w $i :g" | sed "s:\.wh\.::g"
+ find $i -type f -name ".wh.*" | sed "s:$i/:w $i :g" | sed "s:\.wh\.::g"
fi
find $i -type b -printf 'b %p\n'
find $i -type c -printf 'c %p\n'
done
# Test cases expect this
- echo "d $TOP_LOWER_DIR" >> /tmp/check-$$
+ ( grep -q "$TOP_LOWER_DIR$" /tmp/expected-$$ ) && ( echo "d $TOP_LOWER_DIR" >> /tmp/check-$$ )
+
sort /tmp/check-$$ > /tmp/check-$$-tmp
mv /tmp/check-$$-tmp /tmp/check-$$
- while read line ; do
- first=`echo $line | cut -d" " -f 1`
- if [ "$first" == "w" ]; then
- echo $line | sed "s: [a-zA-Z0-9\/\_\-]* : $ODF_DIR/ns/ :g" >> /tmp/expected-$$-tmp
- else
- echo $line >> /tmp/expected-$$-tmp
- fi
- done < /tmp/expected-$$
+ if [ $ODF -eq 1 ]; then
+ while read line ; do
+ first=`echo $line | cut -d" " -f 1`
+ if [ "$first" == "w" ]; then
+ echo $line | sed "s: [a-zA-Z0-9\/\_\-]* : $ODF_DIR/ns/ :g" >> /tmp/expected-$$-tmp
+ else
+ echo $line >> /tmp/expected-$$-tmp
+ fi
+ done < /tmp/expected-$$
+ else
+ cp /tmp/expected-$$ /tmp/expected-$$-tmp
+ fi
sort /tmp/expected-$$-tmp > /tmp/expected-$$
rm /tmp/expected-$$-tmp
diff -u /tmp/expected-$$ /tmp/check-$$
-
ERR=$?
rm -f /tmp/check-$$
rm -f /tmp/expected-$$
f $LOWER_DIR0/b/creat-open
FILES
}
-if [ $ODF -eq 1 ]; then
- POPULATE_ODF=0
-fi
+
+init_odf
( files ) | create_hierarchy
EXPECTED_SIZE=`ls -l progs/creat-open | awk '{print $5}'`
cp progs/creat-open $LOWER_DIR0/b/
-if [ $ODF -eq 1 ]; then
- setup_odf
- mount_union "odf=$ODF_DIR" $LOWER_DIR0/b
-else
- mount_union "" $LOWER_DIR0/b
-fi
+mount_union "" $LOWER_DIR0/b
RET=0
$MOUNTPOINT/creat-open || RET="$?"
unmount_union
-( afterfiles ) | check_hierarchy $LOWER_DIR0
+( afterfiles ) | check_hierarchy
-if [ $ODF -eq 1 ]; then
- discard_odf
-fi
+discard_odf
complete_test
}
-if [ $ODF -eq 1 ]; then
- POPULATE_ODF=0
-fi
+init_odf
( files ) | create_hierarchy
-if [ $ODF -eq 1 ]; then
- setup_odf
- mount_union "odf=$ODF_DIR" $LOWER_DIR0 $LOWER_DIR1=ro
-else
- mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro
-fi
+mount_union "" $LOWER_DIR0 $LOWER_DIR1=ro
./progs/flock-copyup $MOUNTPOINT/a || exit $?
unmount_union
-( afterfiles_ro ) | check_hierarchy $TOP_LOWER_DIR
+( afterfiles_ro ) | check_hierarchy
-if [ $ODF -eq 1 ]; then
- discard_odf
-fi
+discard_odf
( files ) | create_hierarchy
-if [ $ODF -eq 1 ]; then
- setup_odf
- mount_union "odf=$ODF_DIR" $LOWER_DIR0 $LOWER_DIR1
-else
- mount_union "" $LOWER_DIR0 $LOWER_DIR1
-fi
+init_odf
+mount_union "" $LOWER_DIR0 $LOWER_DIR1
./progs/flock-copyup $MOUNTPOINT/a || exit $?
unmount_union
-( afterfiles_rw ) | check_hierarchy $TOP_LOWER_DIR
+( afterfiles_rw ) | check_hierarchy
-if [ $ODF -eq 1 ]; then
- discard_odf
-fi
+discard_odf
complete_test
}
function rw {
- if [ $ODF -eq 1 ]; then
- POPULATE_ODF=0
- fi
+ init_odf
( files ) | create_hierarchy
- if [ $ODF -eq 1 ]; then
- setup_odf
- mount_union "odf=$ODF_DIR" $LOWER_DIR0 $LOWER_DIR1
- else
- mount_union "" $LOWER_DIR0 $LOWER_DIR1
- fi
+ mount_union "" $LOWER_DIR0 $LOWER_DIR1
./progs/fsync $MOUNTPOINT/a || exit $?
unmount_union
- ( files ) | check_hierarchy $TOP_LOWER_DIR
- if [ $ODF -eq 1 ]; then
- discard_odf
- fi
+ ( files ) | check_hierarchy
+ discard_odf
}
if [ -z "$FXNS" ] ; then