2 # Blackbox test for tdbbackup of given ldb or tdb database
3 # Copyright (C) 2018 Andrew Bartlett <abartlet@samba.org>
6 echo "Usage: $0 LDBFILE"
13 date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/\..*NZ$/.000000Z/'
16 subunit_fail_test () {
18 printf 'failure: %s [\n' "$1"
28 printf 'test: %s\n' "$1"
29 output=`$cmdline 2>&1`
31 if [ x$status = x0 ]; then
33 printf 'success: %s\n' "$name"
35 echo "$output" | subunit_fail_test "$name"
40 $BINDIR/tdbdump $LDBFILE | sort > orig_dump
42 testit "normal tdbbackup on tdb file" $BINDIR/tdbbackup $LDBFILE -s .bak
43 $BINDIR/tdbdump $LDBFILE.bak | sort > bak_dump
44 testit "cmp between tdbdumps of original and backup" cmp orig_dump bak_dump
48 testit "readonly tdbbackup on tdb file" $BINDIR/tdbbackup $LDBFILE -s .bak -r
49 $BINDIR/tdbdump $LDBFILE.bak | sort > bak_dump
50 testit "cmp between tdbdumps of original and back dbs" cmp orig_dump bak_dump