diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2018-05-19 18:07:38 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2018-05-19 18:07:38 +0300 |
commit | 625a871bdd3fac33d236d63d6c053e969fdec9d7 (patch) | |
tree | 635bad6108b9ccb54bd486622ca148b71c792bbf /tests | |
parent | 2ed5403c82833c8977171972b6779ec92bcc086f (diff) | |
download | gdbm-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')
-rw-r--r-- | tests/Makefile.am | 3 | ||||
-rw-r--r-- | tests/atlocal.in | 3 | ||||
-rw-r--r-- | tests/dump00.at | 30 | ||||
-rw-r--r-- | tests/dump01.at | 38 | ||||
-rw-r--r-- | tests/dump02.at | 35 | ||||
-rw-r--r-- | tests/testsuite.at | 9 |
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 = \ | |||
64 | dbmfetch01.at\ | 64 | dbmfetch01.at\ |
65 | dbmfetch02.at\ | 65 | dbmfetch02.at\ |
66 | dbmfetch03.at\ | 66 | dbmfetch03.at\ |
67 | dump00.at\ | ||
68 | dump01.at\ | ||
69 | dump02.at\ | ||
67 | create00.at\ | 70 | create00.at\ |
68 | delete00.at\ | 71 | delete00.at\ |
69 | delete01.at\ | 72 | 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 | |||
18 | 18 | ||
19 | @COMPAT_OPT_TRUE@COMPAT=1 | 19 | @COMPAT_OPT_TRUE@COMPAT=1 |
20 | @COMPAT_OPT_FALSE@COMPAT=0 | 20 | @COMPAT_OPT_FALSE@COMPAT=0 |
21 | 21 | GZIP_BIN=@GZIP_BIN@ | |
22 | BASE64_BIN=@BASE64_BIN@ | ||
22 | 23 | ||
23 | 24 | ||
24 | 25 | ||
diff --git a/tests/dump00.at b/tests/dump00.at new file mode 100644 index 0000000..740d3c0 --- /dev/null +++ b/tests/dump00.at | |||
@@ -0,0 +1,30 @@ | |||
1 | # This file is part of GDBM. -*- autoconf -*- | ||
2 | # Copyright (C) 2018 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 | |||
17 | AT_SETUP([Invalid bucket address]) | ||
18 | AT_KEYWORDS([dump]) | ||
19 | AT_CHECK([ | ||
20 | AT_UNPACK([t.db],dnl | ||
21 | [H4sICNrE/1oAA2lkOjAwMDAxMCxzaWc6MTEsc3JjOjAwMDAwMCxvcDpoYXZvYyxyZXA6MgDt2b0J | ||
22 | hUAQAOE1NBNswBIswS7szQJsx0qsQOHEH8zkRU8Fv4FjuIk22GyHri2jiNhe7M4P96ubPc8BAAAA | ||
23 | AD+Znh4AwAUVMzMzMzMz3+wxpfSGOfhDzo7vef+v46+kbcl1Xdd1Xdd1Xdd1Xb+zL3sGJWsAMAAA]) | ||
24 | gdbm_dump t.db t | ||
25 | ], | ||
26 | [1], | ||
27 | [], | ||
28 | [gdbm_dump: dump error: File seek error: Invalid argument | ||
29 | ]) | ||
30 | 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 --- /dev/null +++ b/tests/dump01.at | |||
@@ -0,0 +1,38 @@ | |||
1 | # This file is part of GDBM. -*- autoconf -*- | ||
2 | # Copyright (C) 2018 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 | |||
17 | AT_SETUP([Invalid bucket size in header]) | ||
18 | AT_KEYWORDS([dump]) | ||
19 | AT_CHECK([ | ||
20 | AT_UNPACK([t.db],dnl | ||
21 | [H4sICC3M/1oAA2lkOjAwMDAwMCxzaWc6MTEsc3JjOjAwMDAwMCxvcDpoYXZvYyxyZXA6MTI4AO1a | ||
22 | XUrDQBjctUXbgrVYsEVbLdRXwSPkwRMI4gUEvUVzC8EHD+BlvIBo+6AWERSfCtV8bmtj/nbTJPub | ||
23 | tgM67OTbmbGJEBfvb87rqIZQg3xNQbg84YEPZPmNcoK21nSsIuTAvygGr32ApFBLrN2OWLuUcE60 | ||
24 | xpuFMw+eSB7kpr5KFOj9vV5hybCRekdx/ggdP4HVkYeshorxkmUTDDgStzn2hmEL9FKOPY3Zd6l3 | ||
25 | DAsSauQUAPAkx/ld1htgjlDSXWCCKtfu2vwRP2yKpuSPkRXC6P9Bdw3UWRaGnhk9XN4ypEfeeJxk | ||
26 | Dh6l5b8Bp48DgfWVkF4W536DuKwqr6IoZxGZLusstSnXn7yK93V/6HJ43ZAeGbhrSI9GynnthReC | ||
27 | Xw3psWIhDNAD1vVDXn8svq8ONqCCOLbU5/JsnhxMKi3L5AuEEs1FGLv73HOjYyQV5KWJcs7YjOg4 | ||
28 | dp6qg5NunluPn7ml67NDh4CO/31wZD6KNaTiZ6ScIyr4bJ0MPpGmsfOXQa2WradAfZfbh42EPiPI | ||
29 | lJtAP6XpNjDn2frAW+i9X6bp5NuIorfU9CkMEdqX6G+w3nZ1S2luK6L71p0QC84vRfVq3HxQDz+S | ||
30 | ht3PWL1sWJ8kepOhcxiPWQ9eSh9bUJ/86Cqy+jHzn1JymdPXyVxsEW0wQ0/m43xlzV0QvSvKfzug | ||
31 | 133D0wvh8YqoXIIHQT6zf08y5fY8zzr+Ao/nJqluLwAA]) | ||
32 | gdbm_dump t.db t | ||
33 | ], | ||
34 | [1], | ||
35 | [], | ||
36 | [gdbm_dump: gdbm_open failed: Malformed database file header | ||
37 | ]) | ||
38 | AT_CLEANUP | ||
diff --git a/tests/dump02.at b/tests/dump02.at new file mode 100644 index 0000000..da0b62b --- /dev/null +++ b/tests/dump02.at | |||
@@ -0,0 +1,35 @@ | |||
1 | # This file is part of GDBM. -*- autoconf -*- | ||
2 | # Copyright (C) 2018 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 | |||
17 | AT_SETUP([Invalid count of bucket elements in header]) | ||
18 | AT_KEYWORDS([dump]) | ||
19 | AT_CHECK([ | ||
20 | AT_UNPACK([t.db],dnl | ||
21 | [H4sICC3M/1oAA2lkOjAwMDAwMSxzaWc6MTEsc3JjOjAwMDAwMCxvcDpoYXZvYyxyZXA6NjQA7ZpB | ||
22 | asJQEIaf0gjVIpYWBEF4R+i6q9yix9FzuOqq6x6gd+gZ3LlxIQgSkb6mJopKXpNMZjITMj/qT/4X | ||
23 | Zz6S8KJJvhdvT2ZkzPFtEr9P/SOKPUziQzo8d6bdCpwLLhZdrPJFemg4KtWV7rgBmqZJ7R1noDmD | ||
24 | WVtugDZo4B2hPmPsjy9VntZ0pWE/JWjV5QZoswRs/PpPjqrGaff/xBWPLmtjUZHINsRfhHCoM3uf | ||
25 | rP5nkfW6OePqMH/n59g43v5ZboVwVHJbcD31s78K4VAHeqKpEBqb3u3h58D1S52usvAxjZn6UvhI | ||
26 | CEfikSPvQ1wefGhzc6jT+DNP3066eH4s4PTHmki+a9/Y+RdT39bkfx9WEM8ctX50O1ikjvPkCDzX | ||
27 | egDuL3QQzTWvlq9+8Oo/drLznDo9T16Zx3uvJOc7IVVvzWXmEhjk5kNhPOS58+Tl6hR8fhWSZw0A | ||
28 | jvkgK2TZ/qGI/a45Sn5An5Or8YDy2e1gWf5fmUPXK/AvAAA=]) | ||
29 | gdbm_dump t.db t | ||
30 | ], | ||
31 | [1], | ||
32 | [], | ||
33 | [gdbm_dump: gdbm_open failed: Malformed database file header | ||
34 | ]) | ||
35 | 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],[ | |||
27 | test $COMPAT -eq 1 || AT_SKIP_TEST | 27 | test $COMPAT -eq 1 || AT_SKIP_TEST |
28 | ]) | 28 | ]) |
29 | 29 | ||
30 | m4_define([AT_UNPACK],[ | ||
31 | test -n "$GZIP_BIN" && test -n "$BASE64_BIN" || AT_SKIP_TEST | ||
32 | echo "$2" | $BASE64_BIN -d | $GZIP_BIN -d -c > $1]) | ||
33 | |||
30 | dnl # Begin tests | 34 | dnl # Begin tests |
31 | 35 | ||
32 | AT_INIT | 36 | AT_INIT |
@@ -75,4 +79,9 @@ m4_include([cloexec01.at]) | |||
75 | m4_include([cloexec02.at]) | 79 | m4_include([cloexec02.at]) |
76 | m4_include([cloexec03.at]) | 80 | m4_include([cloexec03.at]) |
77 | 81 | ||
82 | AT_BANNER([Handling invalid input]) | ||
83 | m4_include([dump00.at]) | ||
84 | m4_include([dump01.at]) | ||
85 | m4_include([dump02.at]) | ||
86 | |||
78 | # End of testsuite.at | 87 | # End of testsuite.at |