summaryrefslogtreecommitdiffabout
path: root/tests
authorSergey Poznyakoff <gray@gnu.org>2018-05-19 15:07:38 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2018-05-19 15:07:38 (GMT)
commit625a871bdd3fac33d236d63d6c053e969fdec9d7 (patch) (side-by-side diff)
tree635bad6108b9ccb54bd486622ca148b71c792bbf /tests
parent2ed5403c82833c8977171972b6779ec92bcc086f (diff)
downloadgdbm-625a871bdd3fac33d236d63d6c053e969fdec9d7.tar.gz
gdbm-625a871bdd3fac33d236d63d6c053e969fdec9d7.tar.bz2
Add new tests
* src/gdbm_dump.c: Fix exit code. * configure.ac: Determine presence of gzip and base64 (GZIP_BIN,BASE64_BIN): New variables. * tests/atlocal.in (GZIP_BIN,BASE64_BIN): New variables. * tests/dump00.at: New file. * tests/dump01.at: New file. * tests/dump02.at: New file. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Add new tests.
Diffstat (limited to 'tests') (more/less context) (ignore whitespace changes)
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/atlocal.in3
-rw-r--r--tests/dump00.at30
-rw-r--r--tests/dump01.at38
-rw-r--r--tests/dump02.at35
-rw-r--r--tests/testsuite.at9
6 files changed, 117 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 45a98e8..fc9fc42 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -64,6 +64,9 @@ TESTSUITE_AT = \
dbmfetch01.at\
dbmfetch02.at\
dbmfetch03.at\
+ dump00.at\
+ dump01.at\
+ dump02.at\
create00.at\
delete00.at\
delete01.at\
diff --git a/tests/atlocal.in b/tests/atlocal.in
index 3a6f1ff..9f57aa9 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -18,7 +18,8 @@ PATH=@abs_top_builddir@/src:$PATH
@COMPAT_OPT_TRUE@COMPAT=1
@COMPAT_OPT_FALSE@COMPAT=0
-
+GZIP_BIN=@GZIP_BIN@
+BASE64_BIN=@BASE64_BIN@
diff --git a/tests/dump00.at b/tests/dump00.at
new file mode 100644
index 0000000..740d3c0
--- a/dev/null
+++ b/tests/dump00.at
@@ -0,0 +1,30 @@
+# This file is part of GDBM. -*- autoconf -*-
+# Copyright (C) 2018 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([Invalid bucket address])
+AT_KEYWORDS([dump])
+AT_CHECK([
+AT_UNPACK([t.db],dnl
+[H4sICNrE/1oAA2lkOjAwMDAxMCxzaWc6MTEsc3JjOjAwMDAwMCxvcDpoYXZvYyxyZXA6MgDt2b0J
+hUAQAOE1NBNswBIswS7szQJsx0qsQOHEH8zkRU8Fv4FjuIk22GyHri2jiNhe7M4P96ubPc8BAAAA
+AD+Znh4AwAUVMzMzMzMz3+wxpfSGOfhDzo7vef+v46+kbcl1Xdd1Xdd1Xdd1Xb+zL3sGJWsAMAAA])
+gdbm_dump t.db t
+],
+[1],
+[],
+[gdbm_dump: dump error: File seek error: Invalid argument
+])
+AT_CLEANUP \ No newline at end of file
diff --git a/tests/dump01.at b/tests/dump01.at
new file mode 100644
index 0000000..dae4f25
--- a/dev/null
+++ b/tests/dump01.at
@@ -0,0 +1,38 @@
+# This file is part of GDBM. -*- autoconf -*-
+# Copyright (C) 2018 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([Invalid bucket size in header])
+AT_KEYWORDS([dump])
+AT_CHECK([
+AT_UNPACK([t.db],dnl
+[H4sICC3M/1oAA2lkOjAwMDAwMCxzaWc6MTEsc3JjOjAwMDAwMCxvcDpoYXZvYyxyZXA6MTI4AO1a
+XUrDQBjctUXbgrVYsEVbLdRXwSPkwRMI4gUEvUVzC8EHD+BlvIBo+6AWERSfCtV8bmtj/nbTJPub
+tgM67OTbmbGJEBfvb87rqIZQg3xNQbg84YEPZPmNcoK21nSsIuTAvygGr32ApFBLrN2OWLuUcE60
+xpuFMw+eSB7kpr5KFOj9vV5hybCRekdx/ggdP4HVkYeshorxkmUTDDgStzn2hmEL9FKOPY3Zd6l3
+DAsSauQUAPAkx/ld1htgjlDSXWCCKtfu2vwRP2yKpuSPkRXC6P9Bdw3UWRaGnhk9XN4ypEfeeJxk
+Dh6l5b8Bp48DgfWVkF4W536DuKwqr6IoZxGZLusstSnXn7yK93V/6HJ43ZAeGbhrSI9GynnthReC
+Xw3psWIhDNAD1vVDXn8svq8ONqCCOLbU5/JsnhxMKi3L5AuEEs1FGLv73HOjYyQV5KWJcs7YjOg4
+dp6qg5NunluPn7ml67NDh4CO/31wZD6KNaTiZ6ScIyr4bJ0MPpGmsfOXQa2WradAfZfbh42EPiPI
+lJtAP6XpNjDn2frAW+i9X6bp5NuIorfU9CkMEdqX6G+w3nZ1S2luK6L71p0QC84vRfVq3HxQDz+S
+ht3PWL1sWJ8kepOhcxiPWQ9eSh9bUJ/86Cqy+jHzn1JymdPXyVxsEW0wQ0/m43xlzV0QvSvKfzug
+133D0wvh8YqoXIIHQT6zf08y5fY8zzr+Ao/nJqluLwAA])
+gdbm_dump t.db t
+],
+[1],
+[],
+[gdbm_dump: gdbm_open failed: Malformed database file header
+])
+AT_CLEANUP
diff --git a/tests/dump02.at b/tests/dump02.at
new file mode 100644
index 0000000..da0b62b
--- a/dev/null
+++ b/tests/dump02.at
@@ -0,0 +1,35 @@
+# This file is part of GDBM. -*- autoconf -*-
+# Copyright (C) 2018 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([Invalid count of bucket elements in header])
+AT_KEYWORDS([dump])
+AT_CHECK([
+AT_UNPACK([t.db],dnl
+[H4sICC3M/1oAA2lkOjAwMDAwMSxzaWc6MTEsc3JjOjAwMDAwMCxvcDpoYXZvYyxyZXA6NjQA7ZpB
+asJQEIaf0gjVIpYWBEF4R+i6q9yix9FzuOqq6x6gd+gZ3LlxIQgSkb6mJopKXpNMZjITMj/qT/4X
+Zz6S8KJJvhdvT2ZkzPFtEr9P/SOKPUziQzo8d6bdCpwLLhZdrPJFemg4KtWV7rgBmqZJ7R1noDmD
+WVtugDZo4B2hPmPsjy9VntZ0pWE/JWjV5QZoswRs/PpPjqrGaff/xBWPLmtjUZHINsRfhHCoM3uf
+rP5nkfW6OePqMH/n59g43v5ZboVwVHJbcD31s78K4VAHeqKpEBqb3u3h58D1S52usvAxjZn6UvhI
+CEfikSPvQ1wefGhzc6jT+DNP3066eH4s4PTHmki+a9/Y+RdT39bkfx9WEM8ctX50O1ikjvPkCDzX
+egDuL3QQzTWvlq9+8Oo/drLznDo9T16Zx3uvJOc7IVVvzWXmEhjk5kNhPOS58+Tl6hR8fhWSZw0A
+jvkgK2TZ/qGI/a45Sn5An5Or8YDy2e1gWf5fmUPXK/AvAAA=])
+gdbm_dump t.db t
+],
+[1],
+[],
+[gdbm_dump: gdbm_open failed: Malformed database file header
+])
+AT_CLEANUP \ No newline at end of file
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 63950fa..c492e9f 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -27,6 +27,10 @@ m4_define([AT_COMPAT_PREREQ],[
test $COMPAT -eq 1 || AT_SKIP_TEST
])
+m4_define([AT_UNPACK],[
+test -n "$GZIP_BIN" && test -n "$BASE64_BIN" || AT_SKIP_TEST
+echo "$2" | $BASE64_BIN -d | $GZIP_BIN -d -c > $1])
+
dnl # Begin tests
AT_INIT
@@ -75,4 +79,9 @@ m4_include([cloexec01.at])
m4_include([cloexec02.at])
m4_include([cloexec03.at])
+AT_BANNER([Handling invalid input])
+m4_include([dump00.at])
+m4_include([dump01.at])
+m4_include([dump02.at])
+
# End of testsuite.at

Return to:

Send suggestions and report system problems to the System administrator.