]> arthur.barton.de Git - bup.git/blobdiff - t/test.sh
vfs: File.open() needs to do a seek(0) on the cached FileReader.
[bup.git] / t / test.sh
index 512ddb6455c3c93853e07b29f67468dac8097f9a..1dca9f10a36ef7008c4a021b360a6cb0125a49ee 100755 (executable)
--- a/t/test.sh
+++ b/t/test.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
 . wvtest.sh
 #set -e
 
@@ -26,8 +26,10 @@ WVFAIL [ -e $D.fake ]
 WVFAIL bup index --check -u $D.fake
 WVPASS bup index --check -u $D
 WVPASSEQ "$(bup index --check -p $D)" "$D/"
-touch $D/a $D/b $D/f
+touch $D/a
+bup random 128k >$D/b
 mkdir $D/d $D/d/e
+bup random 512 >$D/f
 WVPASSEQ "$(bup index -s $D/)" "A $D/"
 WVPASSEQ "$(bup index -s $D/b)" ""
 WVPASSEQ "$(bup index --check -us $D/b)" "A $D/b"
@@ -81,6 +83,20 @@ a
 ./"
 WVPASSEQ "$(cd $D && bup index -s .)" "$(cd $D && bup index -s .)"
 
+WVFAIL bup save -t $D/doesnt-exist-filename
+
+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
+rm -f $D/d/e/fifotest
+WVPASS bup index -u $D/d/e
+WVFAIL bup save -t $D/d/e/fifotest
+mv $BUP_DIR/bi.old $BUP_DIR/bupindex
+
+WVPASS bup index -u $D/d/e
 WVPASS bup save -t $D/d/e
 WVPASSEQ "$(cd $D && bup index -m)" \
 "f
@@ -147,6 +163,16 @@ WVSTART "save/git-fsck"
     WVPASS [ "$n" -eq 0 ]
 ) || exit 1
 
+WVSTART "ftp"
+WVPASS bup ftp "cat /master/latest/$TOP/$D/b" >$D/b.new
+WVPASS bup ftp "cat /master/latest/$TOP/$D/f" >$D/f.new
+WVPASS bup ftp "cat /master/latest/$TOP/$D/f"{,} >$D/f2.new
+WVPASS bup ftp "cat /master/latest/$TOP/$D/a" >$D/a.new
+WVPASSEQ "$(sha1sum <$D/b)" "$(sha1sum <$D/b.new)"
+WVPASSEQ "$(sha1sum <$D/f)" "$(sha1sum <$D/f.new)"
+WVPASSEQ "$(cat $D/f.new{,} | sha1sum)" "$(sha1sum <$D/f2.new)"
+WVPASSEQ "$(sha1sum <$D/a)" "$(sha1sum <$D/a.new)"
+
 WVSTART "fsck"
 WVPASS bup fsck
 WVPASS bup fsck --quick