From: Bill Kendall Date: Tue, 1 Nov 2011 19:53:04 +0000 (-0500) Subject: xfstests: refactor cumulative restore tests X-Git-Tag: v2022.05.01~3664 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=dd9768d1d6d15da74bf2325858e6b246301f0194;p=xfstests-dev.git xfstests: refactor cumulative restore tests 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 Signed-off-by: Christoph Hellwig --- diff --git a/064 b/064 index 16960c9e..bf8a7bc9 100755 --- 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 f21a87fc..2ebe1cc5 100755 --- 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 33e53a9f..5de1623d 100644 --- 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 diff --git a/common.dump b/common.dump index 3942e830..56b348aa 100644 --- a/common.dump +++ b/common.dump @@ -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"