| 1 |
#!/bin/sh |
| 2 |
set -e |
| 3 |
|
| 4 |
ARCH=$(dpkg --print-architecture) |
| 5 |
DATA=debian/tests/data |
| 6 |
|
| 7 |
[ -d $DATA/$ARCH ] || exit 77 |
| 8 |
|
| 9 |
TDIR=$(mktemp -d) |
| 10 |
echo "testing NDBM reading..." |
| 11 |
|
| 12 |
for pag in $DATA/$ARCH/*-ndbm.pag; do |
| 13 |
base=$(basename $pag .pag) |
| 14 |
cp $pag $TDIR |
| 15 |
dir=$(echo $pag | sed 's/\.pag$/.dir/') |
| 16 |
if [ -e $dir ]; then |
| 17 |
cp $dir $TDIR |
| 18 |
else |
| 19 |
# NDBM compat in stretch and earlier made .dir a hardlink to .pag |
| 20 |
ln $TDIR/$base.pag $TDIR/$base.dir || exit 77 |
| 21 |
fi |
| 22 |
perl -MFcntl -MNDBM_File -le 'tie %h, q(NDBM_File), shift, O_RDWR, 0640 or die "opening NDBM file failed: $!"; die "contents of NDBM file not found?" if !$h{foo}; print $h{foo}' $TDIR/$base | grep OK |
| 23 |
done |
| 24 |
|
| 25 |
rm -r "$TDIR" |