spnego: add client option to omit sending an optimistic token
[Samba.git] / lib / tdb / test / test_tdbbackup.sh
blobcf87921dac2651eac0ea77e3e4bc7e5cfbeba916
1 #!/bin/sh
2 # Blackbox test for tdbbackup of given ldb or tdb database
3 # Copyright (C) 2018 Andrew Bartlett <abartlet@samba.org>
5 if [ $# -lt 1 ]; then
6 echo "Usage: $0 LDBFILE"
7 exit 1;
8 fi
10 LDBFILE=$1
12 timestamp() {
13 date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/\..*NZ$/.000000Z/'
16 subunit_fail_test () {
17 timestamp
18 printf 'failure: %s [\n' "$1"
19 cat -
20 echo "]"
23 testit () {
24 name="$1"
25 shift
26 cmdline="$@"
27 timestamp
28 printf 'test: %s\n' "$1"
29 output=`$cmdline 2>&1`
30 status=$?
31 if [ x$status = x0 ]; then
32 timestamp
33 printf 'success: %s\n' "$name"
34 else
35 echo "$output" | subunit_fail_test "$name"
37 return $status
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
45 rm $LDBFILE.bak
46 rm 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
51 rm $LDBFILE.bak
52 rm bak_dump
54 rm orig_dump