]> arthur.barton.de Git - bup.git/blobdiff - t/test.sh
Explicitly use "du -k" to set block size in t/test.sh.
[bup.git] / t / test.sh
index 7e1039f5881d356a443de97831e2249f1e6a4af7..4d65f26d3484df59cdfffd1620373412022640ba 100755 (executable)
--- a/t/test.sh
+++ b/t/test.sh
@@ -94,8 +94,8 @@ mv $BUP_DIR/bupindex $BUP_DIR/bi.old
 WVFAIL bup save -t $D/d/e/fifotest
 mkfifo $D/d/e/fifotest
 WVPASS bup index -u $D/d/e/fifotest
-WVFAIL bup save -t $D/d/e/fifotest
-WVFAIL bup save -t $D/d/e
+WVPASS bup save -t $D/d/e/fifotest
+WVPASS bup save -t $D/d/e
 rm -f $D/d/e/fifotest
 WVPASS bup index -u $D/d/e
 WVFAIL bup save -t $D/d/e/fifotest
@@ -298,7 +298,7 @@ mkdir $D/d $D/d/e
 WVPASS bup random 512 >$D/f
 WVPASS bup index -ux $D
 bup save -n exclude-bupdir $D
-WVPASSEQ "$(bup ls exclude-bupdir/latest/$TOP/$D/)" "a
+WVPASSEQ "$(bup ls -a exclude-bupdir/latest/$TOP/$D/)" "a
 b
 d/
 f"
@@ -392,6 +392,8 @@ WVPASS bup random 128k >$D/b
 mkdir $D/d $D/d/e
 WVPASS bup random 512 >$D/f
 WVPASS bup index -ux $D
+WVFAIL bup save --graft =/grafted -n graft-point-absolute $D
+WVFAIL bup save --graft $TOP/$D= -n graft-point-absolute $D
 bup save --graft $TOP/$D=/grafted -n graft-point-absolute $D
 WVPASSEQ "$(bup ls graft-point-absolute/latest/grafted/)" "a
 b
@@ -441,6 +443,23 @@ WVPASSEQ "$(bup ls buptest/latest/)" "a/
 c/"
 
 
+if [ "$(which rdiff-backup)" != "" ]; then
+    WVSTART "import-rdiff-backup"
+    D=rdiff-backup.tmp
+    export BUP_DIR="$TOP/$D/.bup"
+    rm -rf $D
+    mkdir $D
+    WVPASS bup init
+    mkdir $D/rdiff-backup
+    rdiff-backup $TOP/cmd $D/rdiff-backup
+    bup tick
+    rdiff-backup $TOP/Documentation $D/rdiff-backup
+    WVPASS bup import-rdiff-backup $D/rdiff-backup import-rdiff-backup
+    WVPASSEQ "$(bup ls import-rdiff-backup/ | wc -l)" "3"
+    WVPASSEQ "$(bup ls import-rdiff-backup/latest/ | sort)" "$(ls $TOP/Documentation | sort)"
+fi
+
+
 WVSTART "compression"
 D=compression0.tmp
 export BUP_DIR="$TOP/$D/.bup"
@@ -454,7 +473,7 @@ WVPASS bup save -n compression -0 --strip $TOP/Documentation
 # is harmless there.)
 WVPASSEQ "$(bup ls compression/latest/ | sort)" \
         "$(ls $TOP/Documentation | grep -v '^\.' | sort)"
-COMPRESSION_0_SIZE=$(du -s $D | cut -f1)
+COMPRESSION_0_SIZE=$(du -k -s $D | cut -f1)
 
 D=compression9.tmp
 export BUP_DIR="$TOP/$D/.bup"
@@ -464,6 +483,34 @@ WVPASS bup init
 WVPASS bup index $TOP/Documentation
 WVPASS bup save -n compression -9 --strip $TOP/Documentation
 WVPASSEQ "$(bup ls compression/latest/ | sort)" "$(ls $TOP/Documentation | sort)"
-COMPRESSION_9_SIZE=$(du -s $D | cut -f1)
+COMPRESSION_9_SIZE=$(du -k -s $D | cut -f1)
 
 WVPASS [ "$COMPRESSION_9_SIZE" -lt "$COMPRESSION_0_SIZE" ]
+
+
+WVSTART "save disjoint top-level directories"
+(
+    set -e
+    top_dir="$(echo $(pwd) | awk -F "/" '{print $2}')"
+    if [ "$top_dir" == tmp ]; then
+        echo "(running from within /tmp; skipping test)"
+        exit 0
+    fi
+    D=bupdata.tmp
+    rm -rf $D
+    mkdir -p $D/x
+    date > $D/x/1
+    tmpdir="$(mktemp --tmpdir=/tmp -d bup-test-XXXXXXX)"
+    cleanup() { set -x; rm -rf "${tmpdir}"; set +x; }
+    trap cleanup EXIT
+    date > "$tmpdir/2"
+
+    export BUP_DIR="$TOP/buptest.tmp"
+    rm -rf "$BUP_DIR"
+
+    WVPASS bup init
+    WVPASS bup index -vu $(pwd)/$D/x "$tmpdir"
+    WVPASS bup save -t -n src $(pwd)/$D/x "$tmpdir"
+    # For now, assume that "ls -a" and "sort" use the same order.
+    WVPASSEQ "$(bup ls -a src/latest)" "$(echo -e "$top_dir/\ntmp/" | sort)"
+) || WVFAIL