aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2011-11-10 22:27:18 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2011-11-10 22:27:18 +0000
commit902a2e4bb5aa53241898ae34dcf7aafb29df7b7e (patch)
tree8ccc38229f02ecf7ae264712e829ba5ae64e5912 /tests
parent3556dd6310425a2c175e66a9ba6f7d5f61304302 (diff)
downloadgdbm-902a2e4bb5aa53241898ae34dcf7aafb29df7b7e.tar.gz
gdbm-902a2e4bb5aa53241898ae34dcf7aafb29df7b7e.tar.bz2
Fix handling of NDBM databases in read-only mode.
* compat/dbmopen.c (ndbm_open_dir_file0): Open dir file in read-only mode if the database is being opened as GDBM_READER. * tests/dbmcvt.at: New file. * tests/dbmfetch02.at: New file. * tests/dbmfetch03.at: New file. * tests/Makefile.am (TESTSUITE_AT): Add new files. * tests/testsuite.at: Include new testcases.
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/dbmcvt.at34
-rw-r--r--tests/dbmfetch02.at32
-rw-r--r--tests/dbmfetch03.at36
-rw-r--r--tests/testsuite.at4
5 files changed, 109 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6075c38..bfbcd9e 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -52,8 +52,11 @@ TESTSUITE_AT = \
52 dbmdel00.at\ 52 dbmdel00.at\
53 dbmdel01.at\ 53 dbmdel01.at\
54 dbmdel02.at\ 54 dbmdel02.at\
55 dbmcvt.at\
55 dbmfetch00.at\ 56 dbmfetch00.at\
56 dbmfetch01.at\ 57 dbmfetch01.at\
58 dbmfetch02.at\
59 dbmfetch03.at\
57 create00.at\ 60 create00.at\
58 delete00.at\ 61 delete00.at\
59 delete01.at\ 62 delete01.at\
diff --git a/tests/dbmcvt.at b/tests/dbmcvt.at
new file mode 100644
index 0000000..c314c8e
--- /dev/null
+++ b/tests/dbmcvt.at
@@ -0,0 +1,34 @@
1# This file is part of GDBM. -*- autoconf -*-
2# Copyright (C) 2011 Free Software Foundation, Inc.
3#
4# GDBM is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2, or (at your option)
7# any later version.
8#
9# GDBM is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with GDBM. If not, see <http://www.gnu.org/licenses/>. */
16
17AT_SETUP([converting a 1.8-style database])
18AT_KEYWORDS([dbm fetch cvt])
19
20AT_CHECK([
21AT_COMPAT_PREREQ
22num2word 1:10 | dtload test
23rm test.dir
24ln test.pag test.dir
25dtfetch test 6
26cmp test.pag test.dir >/dev/null 2>&1 && exit 1
27exit 0
28],
29[0],
30[six
31])
32
33AT_CLEANUP
34
diff --git a/tests/dbmfetch02.at b/tests/dbmfetch02.at
new file mode 100644
index 0000000..c581a22
--- /dev/null
+++ b/tests/dbmfetch02.at
@@ -0,0 +1,32 @@
1# This file is part of GDBM. -*- autoconf -*-
2# Copyright (C) 2011 Free Software Foundation, Inc.
3#
4# GDBM is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2, or (at your option)
7# any later version.
8#
9# GDBM is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with GDBM. If not, see <http://www.gnu.org/licenses/>. */
16
17AT_SETUP([fetch from a read-only database])
18AT_KEYWORDS([dbm fetch fetch02 dbmfetch02])
19
20AT_CHECK([
21AT_COMPAT_PREREQ
22num2word 1:10 | dtload test
23chmod -w test.dir test.pag
24dtfetch test 6 10
25],
26[0],
27[six
28ten
29])
30
31AT_CLEANUP
32
diff --git a/tests/dbmfetch03.at b/tests/dbmfetch03.at
new file mode 100644
index 0000000..b1e149b
--- /dev/null
+++ b/tests/dbmfetch03.at
@@ -0,0 +1,36 @@
1# This file is part of GDBM. -*- autoconf -*-
2# Copyright (C) 2011 Free Software Foundation, Inc.
3#
4# GDBM is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2, or (at your option)
7# any later version.
8#
9# GDBM is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with GDBM. If not, see <http://www.gnu.org/licenses/>. */
16
17AT_SETUP([fetch from a read-only 1.8-style database])
18AT_KEYWORDS([dbm fetch fetch03 dbmfetch03])
19
20AT_CHECK([
21AT_COMPAT_PREREQ
22mkdir dir
23cd dir
24num2word 1:10 | dtload test
25rm test.dir
26ln test.pag test.dir
27chmod -w test.dir test.pag .
28dtfetch test 6 10
29],
30[0],
31[six
32ten
33])
34
35AT_CLEANUP
36
diff --git a/tests/testsuite.at b/tests/testsuite.at
index a7827c2..a13b3fb 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -47,8 +47,12 @@ AT_BANNER([Compatibility library (dbm/ndbm)])
47 47
48m4_include([dbmcreate00.at]) 48m4_include([dbmcreate00.at])
49 49
50m4_include([dbmcvt.at])
51
50m4_include([dbmfetch00.at]) 52m4_include([dbmfetch00.at])
51m4_include([dbmfetch01.at]) 53m4_include([dbmfetch01.at])
54m4_include([dbmfetch02.at])
55m4_include([dbmfetch03.at])
52 56
53m4_include([dbmdel00.at]) 57m4_include([dbmdel00.at])
54m4_include([dbmdel01.at]) 58m4_include([dbmdel01.at])

Return to:

Send suggestions and report system problems to the System administrator.