summaryrefslogtreecommitdiff
path: root/test/format/s_dumpcmp.sh
blob: 2760d5e9268a72d5af9c3e0878bc7e46d3ce5e2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#! /bin/sh

trap 'exit 1' 1 2

top=../..

home="RUNDIR"
wturi="file:wt"

colflag=0
bdbdir=""
while :
	do case "$1" in
	# -b means we need to dump the Berkeley DB database
	-b)
		bdbdir="$2";
		shift ; shift ;;
	# -c means it was a column-store.
	-c)
		colflag=1
		shift ;;
	-h)
		shift ;
		home=$1
		shift;;
	-n)
		shift ;
		wturi=$1
		shift ;;
	*)
		break ;;
	esac
done

if test $# -ne 0; then
	echo 'usage: s_dumpcmp [-bc]' >&2
	exit 1
fi

ext="\"$top/ext/collators/reverse/.libs/libwiredtiger_reverse_collator.so\""

bzip2_ext="$top/ext/compressors/bzip2/.libs/libwiredtiger_bzip2.so"
if test -e $bzip2_ext ; then
        ext="$ext,\"$bzip2_ext\""
fi
lzo_ext=".libs/lzo_compress.so"
if test -e $lzo_ext ; then
        ext="$ext,\"$lzo_ext\""
fi
bzip_raw_ext=".libs/bzip_raw_compress.so"
if test -e $bzip_raw_ext ; then
        ext="$ext,\"$bzip_raw_ext\""
fi
lz4_ext="$top/ext/compressors/lz4/.libs/libwiredtiger_lz4.so"
if test -e $lz4_ext ; then
        ext="$ext,\"$lz4_ext\""
fi
snappy_ext="$top/ext/compressors/snappy/.libs/libwiredtiger_snappy.so"
if test -e $snappy_ext ; then
        ext="$ext,\"$snappy_ext\""
fi
zlib_ext="$top/ext/compressors/zlib/.libs/libwiredtiger_zlib.so"
if test -e $zlib_ext ; then
        ext="$ext,\"$zlib_ext\""
fi

config='extensions=['$ext']'

$top/wt -h $home -C "$config" dump $wturi |
    sed -e '1,/^Data$/d' > $home/wt_dump

if test "X$bdbdir" = "X"; then
	exit 0
fi

if test $colflag -eq 0; then
	$bdbdir/bin/db_dump -p $home/bdb |
	    sed -e '1,/HEADER=END/d' \
		-e '/DATA=END/d' \
		-e 's/^ //' > $home/bdb_dump
else
	# Format stores record numbers in Berkeley DB as string keys,
	# it's simpler that way.  Convert record numbers from strings
	# to numbers.
	$bdbdir/bin/db_dump -p $home/bdb |
	    sed -e '1,/HEADER=END/d' \
		-e '/DATA=END/d' \
		-e 's/^ //' |
	    sed -e 's/^0*//' \
		-e 's/\.00$//' \
		-e N > $home/bdb_dump
fi

cmp $home/wt_dump $home/bdb_dump > /dev/null

exit $?