"Fossies" - the Fresh Open Source Software Archive

Member "bup-0.30/t/test.sh" (28 Sep 2019, 3158 Bytes) of package /linux/privat/bup-0.30.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "test.sh": 0.29.3_vs_0.30.

    1 #!/usr/bin/env bash
    2 . wvtest.sh
    3 . wvtest-bup.sh
    4 . t/lib.sh
    5 
    6 set -o pipefail
    7 
    8 top="$(WVPASS pwd)" || exit $?
    9 tmpdir="$(WVPASS wvmktempdir)" || exit $?
   10 export BUP_DIR="$tmpdir/bup"
   11 
   12 bup() { "$top/bup" "$@"; }
   13 
   14 WVPASS cd "$tmpdir"
   15 
   16 WVSTART "init"
   17 WVPASS bup init
   18 D=bupdata.tmp
   19 WVPASS force-delete $D
   20 WVPASS mkdir $D
   21 WVPASS touch $D/a
   22 WVPASS bup random 128k >$D/b
   23 WVPASS mkdir $D/d $D/d/e
   24 WVPASS bup random 512 >$D/f
   25 WVPASS touch $D/d/z
   26 WVPASS touch $D/d/z
   27 WVPASS bup index $D
   28 WVPASS bup save -t $D
   29 
   30 
   31 WVSTART "bloom"
   32 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
   33 WVPASS rm "$BUP_DIR"/objects/pack/bup.bloom
   34 WVPASS bup bloom -k 4
   35 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
   36 WVPASS bup bloom -d "$BUP_DIR"/objects/pack --ruin --force
   37 WVFAIL bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
   38 WVPASS bup bloom --force -k 5
   39 WVPASS bup bloom -c $(ls -1 "$BUP_DIR"/objects/pack/*.idx|head -n1)
   40 
   41 
   42 WVSTART "memtest"
   43 WVPASS bup memtest -c1 -n100
   44 WVPASS bup memtest -c1 -n100 --existing
   45 
   46 
   47 WVSTART "save/git-fsck"
   48 (
   49     WVPASS cd "$BUP_DIR"
   50     #git repack -Ad
   51     #git prune
   52     WVPASS bup random 4k | WVPASS bup split -b
   53     (WVPASS cd "$top/t/sampledata" && WVPASS bup save -vvn master /) || exit $?
   54     result="$(git fsck --full --strict 2>&1)" || exit $?
   55     n=$(echo "$result" |
   56         WVFAIL egrep -v 'dangling (commit|tree|blob)' |
   57         WVPASS tee -a /dev/stderr |
   58         WVPASS wc -l) || exit $?
   59     WVPASS [ "$n" -eq 0 ]
   60 ) || exit $?
   61 
   62 
   63 WVSTART "ftp"
   64 WVPASS bup ftp "cat /master/latest/$tmpdir/$D/b" >$D/b.new
   65 WVPASS bup ftp "cat /master/latest/$tmpdir/$D/f" >$D/f.new
   66 WVPASS bup ftp "cat /master/latest/$tmpdir/$D/f"{,} >$D/f2.new
   67 WVPASS bup ftp "cat /master/latest/$tmpdir/$D/a" >$D/a.new
   68 WVPASSEQ "$(sha1sum <$D/b)" "$(sha1sum <$D/b.new)"
   69 WVPASSEQ "$(sha1sum <$D/f)" "$(sha1sum <$D/f.new)"
   70 WVPASSEQ "$(cat $D/f.new{,} | sha1sum)" "$(sha1sum <$D/f2.new)"
   71 WVPASSEQ "$(sha1sum <$D/a)" "$(sha1sum <$D/a.new)"
   72 
   73 
   74 WVSTART "tag"
   75 WVFAIL bup tag -d v0.n 2>/dev/null
   76 WVFAIL bup tag v0.n non-existant 2>/dev/null
   77 WVPASSEQ "$(bup tag)" ""
   78 WVPASS bup tag v0.1 master
   79 WVPASSEQ "$(bup tag)" "v0.1"
   80 WVFAIL bup tag v0.1 master
   81 WVPASS bup tag -f v0.1 master
   82 WVPASS bup tag -d v0.1
   83 WVPASS bup tag -f -d v0.1
   84 WVFAIL bup tag -d v0.1
   85 
   86 
   87 WVSTART "indexfile"
   88 D=indexfile.tmp
   89 INDEXFILE=tmpindexfile.tmp
   90 WVPASS rm -f $INDEXFILE
   91 WVPASS force-delete $D
   92 WVPASS mkdir $D
   93 export BUP_DIR="$D/.bup"
   94 WVPASS bup init
   95 WVPASS touch $D/a
   96 WVPASS touch $D/b
   97 WVPASS mkdir $D/c
   98 WVPASS bup index -ux $D
   99 WVPASS bup save --strip -n bupdir $D
  100 WVPASSEQ "$(bup ls -F bupdir/latest/)" "a
  101 b
  102 c/"
  103 WVPASS bup index -f $INDEXFILE --exclude=$D/c -ux $D
  104 WVPASS bup save --strip -n indexfile -f $INDEXFILE $D
  105 WVPASSEQ "$(bup ls indexfile/latest/)" "a
  106 b"
  107 
  108 
  109 WVSTART "import-rsnapshot"
  110 D=rsnapshot.tmp
  111 export BUP_DIR="$tmpdir/$D/.bup"
  112 WVPASS force-delete $D
  113 WVPASS mkdir $D
  114 WVPASS bup init
  115 WVPASS mkdir -p $D/hourly.0/buptest/a
  116 WVPASS touch $D/hourly.0/buptest/a/b
  117 WVPASS mkdir -p $D/hourly.0/buptest/c/d
  118 WVPASS touch $D/hourly.0/buptest/c/d/e
  119 WVPASS true
  120 WVPASS bup import-rsnapshot $D/
  121 WVPASSEQ "$(bup ls -F buptest/latest/)" "a/
  122 c/"
  123 
  124 
  125 WVPASS rm -rf "$tmpdir"