-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·42 lines (34 loc) · 865 Bytes
/
test.sh
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
#! /bin/bash
#
# Most tests are now in t-tget.cl.
set -eu
function tget {
./tget/tget --debug --root \
$PWD --db $PWD/main.db \
--config $PWD/tget-test-data/config.cl \
"$@"
}
set -x
######### test #1
# copy production db, compact it, which also tests upgrade code
rm -fr main.db*
cp -rp ~/.tget.d/db main.db
if ! tget --cron --dump-all | egrep '^#' > test.compact.before; then
echo ERROR: before --dump-all failed
exit 1
fi
if ! tget --compact-database; then
echo ERROR: compact failed
exit 1
fi
if ! tget --cron --dump-all | egrep '^#' > test.compact.after; then
echo ERROR: after --dump-all failed
exit 1
fi
if ! diff <(sort < test.compact.before) <(sort < test.compact.after); then
echo ERROR: compare of compact before/after failed
exit 1
else
rm -f test.compact.before test.compact.after
fi
du -sh main.db*