diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-11-10 22:27:18 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2011-11-10 22:27:18 +0000 |
commit | 902a2e4bb5aa53241898ae34dcf7aafb29df7b7e (patch) | |
tree | 8ccc38229f02ecf7ae264712e829ba5ae64e5912 /tests | |
parent | 3556dd6310425a2c175e66a9ba6f7d5f61304302 (diff) | |
download | gdbm-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.am | 3 | ||||
-rw-r--r-- | tests/dbmcvt.at | 34 | ||||
-rw-r--r-- | tests/dbmfetch02.at | 32 | ||||
-rw-r--r-- | tests/dbmfetch03.at | 36 | ||||
-rw-r--r-- | tests/testsuite.at | 4 |
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 = \ dbmdel00.at\ dbmdel01.at\ dbmdel02.at\ + dbmcvt.at\ dbmfetch00.at\ dbmfetch01.at\ + dbmfetch02.at\ + dbmfetch03.at\ create00.at\ delete00.at\ 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 @@ +# This file is part of GDBM. -*- autoconf -*- +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# GDBM is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GDBM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ + +AT_SETUP([converting a 1.8-style database]) +AT_KEYWORDS([dbm fetch cvt]) + +AT_CHECK([ +AT_COMPAT_PREREQ +num2word 1:10 | dtload test +rm test.dir +ln test.pag test.dir +dtfetch test 6 +cmp test.pag test.dir >/dev/null 2>&1 && exit 1 +exit 0 +], +[0], +[six +]) + +AT_CLEANUP + 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 @@ +# This file is part of GDBM. -*- autoconf -*- +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# GDBM is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GDBM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ + +AT_SETUP([fetch from a read-only database]) +AT_KEYWORDS([dbm fetch fetch02 dbmfetch02]) + +AT_CHECK([ +AT_COMPAT_PREREQ +num2word 1:10 | dtload test +chmod -w test.dir test.pag +dtfetch test 6 10 +], +[0], +[six +ten +]) + +AT_CLEANUP + 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 @@ +# This file is part of GDBM. -*- autoconf -*- +# Copyright (C) 2011 Free Software Foundation, Inc. +# +# GDBM is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# GDBM is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GDBM. If not, see <http://www.gnu.org/licenses/>. */ + +AT_SETUP([fetch from a read-only 1.8-style database]) +AT_KEYWORDS([dbm fetch fetch03 dbmfetch03]) + +AT_CHECK([ +AT_COMPAT_PREREQ +mkdir dir +cd dir +num2word 1:10 | dtload test +rm test.dir +ln test.pag test.dir +chmod -w test.dir test.pag . +dtfetch test 6 10 +], +[0], +[six +ten +]) + +AT_CLEANUP + 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)]) m4_include([dbmcreate00.at]) +m4_include([dbmcvt.at]) + m4_include([dbmfetch00.at]) m4_include([dbmfetch01.at]) +m4_include([dbmfetch02.at]) +m4_include([dbmfetch03.at]) m4_include([dbmdel00.at]) m4_include([dbmdel01.at]) |