blob: bb516ed6c4d34c21937e81a5e8e09774cc4cf5e5 (
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
|
#!/bin/sh
set -e
ARCH=$(dpkg --print-architecture)
DB=$(mktemp).gdbm
DATA=debian/tests/data
[ -d $DATA/$ARCH ] || exit 77
echo "testing GDBM reading..."
msg="GDBM file read OK"
printf 'open %s\nstore %s "%s"\n' $DB foo "$msg" | gdbmtool -f -
for db in $DB $DATA/$ARCH/*.gdbm; do
perl -MGDBM_File -le 'tie %h, q(GDBM_File), shift, &GDBM_READER, 0640 or die "opening GDBM file failed: $!"; die "contents of GDBM file not found?" if !exists $h{foo}; print $h{foo}' $db | grep OK
done
rm $DB
echo "testing GDBM writing..."
msg="GDBM file written OK"
DB=$(mktemp).db
perl -MGDBM_File -e 'tie %h, q(GDBM_File), shift, &GDBM_WRCREAT, 0640 or die "opening GDBM file failed: $!"; $h{foo} = shift; untie %h' $DB "$msg"
printf 'open %s\nfetch %s\n' $DB foo | gdbmtool -f - | grep "$msg"
rm $DB
|