xfstests: refactor cumulative restore tests
authorBill Kendall <wkendall@sgi.com>
Tue, 1 Nov 2011 19:53:04 +0000 (14:53 -0500)
committerChristoph Hellwig <hch@lst.de>
Thu, 3 Nov 2011 10:16:13 +0000 (10:16 +0000)
The cumulative restore tests call _do_restore_file_cum(),
which requires a dump level to be passed in the -l option
in order to determine whether the restore directory needs
to be prepared or not. -l is not a valid xfsrestore option,
so doing things this way prevents tests from passing options
to xfsrestore. It's more straightforward to have the test
call _prepare_restore_dir itself prior to starting a series
of cumulative restores.

Signed-off-by: Bill Kendall <wkendall@sgi.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
064
065
266
common.dump

diff --git a/064 b/064
index 16960c9ea4df043e20c37f2f0f2be46394b5f6ee..bf8a7bc935bc99ff27deeed1befe0c06f9ec0d3a 100755 (executable)
--- a/064
+++ b/064
@@ -97,12 +97,13 @@ while [ $i -le 9 ]; do
 done
 
 echo "Do the cumulative restores"
+_prepare_restore_dir
 i=0
 while [ $i -le 9 ]; do
     dump_file=$tmp.df.level$i
     echo ""
     echo "restoring from df.level$i"
-    _do_restore_file_cum -l $i
+    _do_restore_file_cum
     echo "ls -l restore_dir"
     ls -lR $restore_dir | _ls_size_filter | _check_quota_file
     let i=$i+1
diff --git a/065 b/065
index f21a87fcc5beae4dcedabaa4b03fc78807682ea0..2ebe1cc55a9aec4a43e84e6986dd859d32ee872a 100755 (executable)
--- a/065
+++ b/065
@@ -174,12 +174,13 @@ while [ $i -le $num_dumps ]; do
 done
 
 echo "Do the cumulative restores"
+_prepare_restore_dir
 i=0
 while [ $i -le $num_dumps ]; do
     dump_file=$tmp.df.level$i
     echo ""
     echo "restoring from df.level$i"
-    _do_restore_file_cum -l $i
+    _do_restore_file_cum
     echo "list restore_dir"
     _list_dir $restore_dir | _check_quota_file | tee $tmp.restorals.$i
     let i=$i+1
diff --git a/266 b/266
index 33e53a9fd843a86e0a4358206a299292b3d13da7..5de1623d081ac456d1d6e98347c429d58f6f379b 100644 (file)
--- a/266
+++ b/266
@@ -63,10 +63,11 @@ _do_dump_file
 _add_and_append_dumpdir_fill
 dump_file=$tmp.df.1
 _do_dump_file -l 1 -D
+_prepare_restore_dir
 dump_file=$tmp.df.0
-_do_restore_file_cum -l 0
+_do_restore_file_cum
 dump_file=$tmp.df.1
-_do_restore_file_cum -l 1
+_do_restore_file_cum
 _ls_compare_sub
 _diff_compare
 
index 3942e8304126bfbd4c8b6b8c716cdf2b659f8f79..56b348aaa1f91185e4ca511671d15992f033be3a 100644 (file)
@@ -1065,14 +1065,12 @@ _do_restore_file()
 
 #
 # Cumulative restore from a file
-# Need to specify the dump level e.g. "-l 0"
+# Must call _prepare_restore_dir before the first
+# (and only the first) call to this function.
 #
 _do_restore_file_cum()
 {
     _parse_args $*
-    if echo $dump_args | grep '\-l0' >/dev/null; then
-       _prepare_restore_dir
-    fi
 
     echo "Restoring cumumlative from file..."
     opts="$_restore_debug -f $dump_file -r $restore_dir"