summaryrefslogtreecommitdiff
path: root/debian/tests/ndbm
diff options
context:
space:
mode:
Diffstat (limited to 'debian/tests/ndbm')
-rwxr-xr-xdebian/tests/ndbm25
1 files changed, 25 insertions, 0 deletions
diff --git a/debian/tests/ndbm b/debian/tests/ndbm
new file mode 100755
index 0000000..101ff1f
--- /dev/null
+++ b/debian/tests/ndbm
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -e
+
+ARCH=$(dpkg --print-architecture)
+DATA=debian/tests/data
+
+[ -d $DATA/$ARCH ] || exit 77
+
+TDIR=$(mktemp -d)
+echo "testing NDBM reading..."
+
+for pag in $DATA/$ARCH/*-ndbm.pag; do
+ base=$(basename $pag .pag)
+ cp $pag $TDIR
+ dir=$(echo $pag | sed 's/\.pag$/.dir/')
+ if [ -e $dir ]; then
+ cp $dir $TDIR
+ else
+ # NDBM compat in stretch and earlier made .dir a hardlink to .pag
+ ln $TDIR/$base.pag $TDIR/$base.dir || exit 77
+ fi
+ 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
+done
+
+rm -r "$TDIR"