Changes to make some tests generic(ODF and non-ODF cases)
authorRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Wed, 17 Oct 2007 03:24:16 +0000 (23:24 -0400)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Wed, 17 Oct 2007 03:24:16 +0000 (23:24 -0400)
Modifed the following tests:
1) t-lookup
2) t-flock
3) t-fsync
4) t-creat-open

scaffold
t-creat-open.sh [changed mode: 0755->0644]
t-flock.sh
t-fsync.sh
t-lookup.sh [changed mode: 0755->0644]

index 2f5479e5ea520c0478cde45e13971fee96a8492d..c7363673d9ce4ba4e9809cf3ec701d06c6e9df0d 100644 (file)
--- a/scaffold
+++ b/scaffold
@@ -128,7 +128,7 @@ function create_hierarchy {
                                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
@@ -192,15 +192,15 @@ function uncramit {
 
 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
@@ -210,7 +210,7 @@ function check_hierarchy {
            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'
@@ -219,24 +219,28 @@ function check_hierarchy {
        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-$$
old mode 100755 (executable)
new mode 100644 (file)
index 43b1db2..4260794
@@ -20,20 +20,14 @@ d $LOWER_DIR0/b
 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="$?"
@@ -49,9 +43,7 @@ fi
 
 unmount_union
 
-( afterfiles ) | check_hierarchy $LOWER_DIR0
+( afterfiles ) | check_hierarchy
 
-if [ $ODF -eq 1 ]; then
-       discard_odf
-fi
+discard_odf
 complete_test
index 7a62d68cea9aad49a7c92c1acaf9aabfa8ec98ce..5fd96763de003fc7d620114e4490c423096dddfc 100755 (executable)
@@ -37,38 +37,23 @@ FILES
 }
 
 
-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
index 2c4af0ba03136319485b6cedd62c5b60b95c5f5e..395d9efe9904e3602795a606a59583f0da8575e1 100755 (executable)
@@ -16,22 +16,13 @@ FILES
 }
 
 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
old mode 100755 (executable)
new mode 100644 (file)
index 1b64bdf..76ed85a
@@ -23,19 +23,14 @@ d $LOWER_DIR0/b
 f $LOWER_DIR1/b
 d $LOWER_DIR2/b
 
+w $LOWER_DIR1 c
 d $LOWER_DIR2/c
 f $LOWER_DIR2/c/d
 FILES
 }
 
-function beforefiles {
-cat <<FILES
-w $LOWER_DIR1 c
-FILES
-}
-
 init_odf $TOP_LOWER_DIR/b?
-( files ; beforefiles ) | create_hierarchy
+files | create_hierarchy
 mount_union "" $TOP_LOWER_DIR/b?
 
 checktype $MOUNTPOINT/a 'f'
@@ -43,7 +38,7 @@ checktype $MOUNTPOINT/b 'd'
 checktype $MOUNTPOINT/c '-'
 
 unmount_union
-( files ; beforefiles ) | check_hierarchy
+files | check_hierarchy
 discard_odf
 
 complete_test