From: Zoran Zaric Date: Mon, 6 Dec 2010 12:00:10 +0000 (+0100) Subject: Adds a testcase for import-rsnapshot. X-Git-Tag: bup-0.21-rc1^4 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=bup.git;a=commitdiff_plain;h=2e614df917acd7d66c92e11d8d19fd324abe1cd6 Adds a testcase for import-rsnapshot. Also makes import-rsnapshot use $BUP_MAIN_EXE if available. Signed-off-by: Zoran Zaric --- diff --git a/cmd/import-rsnapshot-cmd.sh b/cmd/import-rsnapshot-cmd.sh index e828f5b..94db5c1 100755 --- a/cmd/import-rsnapshot-cmd.sh +++ b/cmd/import-rsnapshot-cmd.sh @@ -10,9 +10,22 @@ usage() { exit -1 } -if [ "$1" == "-n" ] || [ "$1" == "--dry-run" ]; then - bup () { echo "bup $@"; } +if [ "$1" = "-n" -o "$1" = "--dry-run" ]; then + bup() + { + echo bup "$@" >&2 + } shift 1 +elif [ -n "$BUP_MAIN_EXE" ]; then + bup() + { + "$BUP_MAIN_EXE" "$@" + } +else + bup() + { + bup "$@" + } fi [ "$#" -eq 1 ] || [ "$#" -eq 2 ] || usage diff --git a/t/test.sh b/t/test.sh index 048c5df..08a4be5 100755 --- a/t/test.sh +++ b/t/test.sh @@ -358,3 +358,23 @@ WVPASS bup index -f $INDEXFILE --exclude=$D/c -ux $D bup save --strip -n indexfile -f $INDEXFILE $D WVPASSEQ "$(bup ls indexfile/latest/)" "a b" + +WVSTART "import-rsnapshot" + +#set -x +rm -rf "$BUP_DIR" +WVPASS bup init + +D=bupdata.tmp +rm -rf $D +mkdir $D + +mkdir -p $D/hourly.0/buptest/a +touch $D/hourly.0/buptest/a/b +mkdir -p $D/hourly.0/buptest/c/d +touch $D/hourly.0/buptest/c/d/e + +bup import-rsnapshot $D/ + +WVPASSEQ "$(bup ls buptest/latest/)" "a/ +c/"