Do more testing on cumulative restores.
[xfstests-dev.git] / common.dump
index 1148be4545f0fc295fbbdd081f11524355aef8d3..88651c50691e74540e695426266f57172c55c710 100644 (file)
@@ -296,10 +296,12 @@ _cleanup()
 #
 _stable_fs()
 {
+    _saveddir=`pwd`; cd /
     umount $SCRATCH_MNT >>$seq.full ||\
        _error "unmount failed"
     mount -t xfs $SCRATCH_DEV $SCRATCH_MNT >>$seq.full ||\
        _error "mount failed"
+    cd $_saveddir
 }
 
 #
@@ -753,6 +755,7 @@ _dump_filter_main()
       -e "s#$dumptape#TAPE_DEV#"    \
       -e "s#$SCRATCH_MNT#SCRATCH_MNT#"    \
       -e "s#$dump_file#DUMP_FILE#"  \
+      -e 's#/var/lib/xfsdump#/var/xfsdump#' \
       -e 's/id:[       ]*[0-9a-f-]*/id: ID/'  \
       -e 's/time:[     ].*/time: TIME/'       \
       -e 's/date:[     ].*/date: DATE/'       \
@@ -786,7 +789,7 @@ _dump_filter()
 {
    if $do_quota_check
    then
-       _dump_filter_main | _check_quota_dumprestore
+       _dump_filter_main | _check_quota_dumprestore | _check_quota_entries
    else
        _dump_filter_main
    fi
@@ -1037,6 +1040,7 @@ _do_restore_toc()
     cd $SCRATCH_MNT # for IRIX which needs xfs cwd
     xfsrestore $opts 2>&1 | tee -a $seq.full | _dump_filter_main |\
     _check_quota_file |\
+    _check_quota_entries |\
     $AWK_PROG 'NF != 1 { print; next }
               {files = sprintf("%s\n%s", files, $1)}
                END { print files | "sort" } '
@@ -1247,6 +1251,25 @@ _check_quota()
     '
 }
 
+#
+# xfsrestore: 3 directories and 40 entries processed 
+#   $5 = 40 
+#   num entries needs to be reduced by num quota file(s) 
+#
+_check_quota_entries()
+{
+    uquota=0
+    gquota=0 
+    $here/src/feature -U $SCRATCH_DEV && uquota=1
+    $here/src/feature -G $SCRATCH_DEV && gquota=1
+    $AWK_PROG -v uquota=$uquota -v gquota=$gquota '
+       /entries processed/ { 
+               if (uquota) $5--
+               if (gquota) $5--
+       }
+       {print}'
+}
+
 #
 # Look for:
 # xfsdump: saving user quota information for: SCRATCH_MNT