aboutsummaryrefslogtreecommitdiff
path: root/tests
AgeCommit message (Collapse)AuthorFiles
2018-07-01Change return value of gdbm_close and gdbm_syncSergey Poznyakoff10
* src/gdbm.h.in (gdbm_close, gdbm_sync): Return int (GDBM_FILE_CLOSE_ERROR, GDBM_FILE_SYNC_ERROR): New error codes. * src/gdbmclose.c (gdbm_close): Return 0 on success, -1 on failure. Set gdbm_errno and errno. * src/gdbmsync.c (gdbm_sync): Likewise. * src/gdbmerrno.c: Handle new error codes. * src/mmap.c (_gdbm_mapped_sync): Set gdbm_errno. * src/proto.h (gdbm_file_sync): Set gdbm_errno. * doc/gdbm.3: Document changes. * doc/gdbm.texi: Document changes. * NEWS: Document changes. * configure.ac: Set patchlevel. * tests/Makefile.am: Add new test. * tests/testsuite.at: Add new test. * tests/closerr.at: New test case. * tests/closerr.c: New test program. * tests/gtdel.c: Check gdbm_close return. * tests/gtdump.c: Likewise. * tests/gtfetch.c: Likewise. * tests/gtload.c: Likewise. * tests/gtopt.c: Likewise. * tests/gtrecover.c: Likewise.
2018-05-30Drop debugging hooksSergey Poznyakoff1
The hooks were introduced as a temporary tool in de7834e9. They did their job and are not necessary any more.
2018-05-29Minor changesSergey Poznyakoff1
* src/gdbmtool.c: Reduce memory consuption in -random mode. Some minor bugfixes as well.
2018-05-28Improve num2wordSergey Poznyakoff1
* tests/num2word.c: New options: -revert and -random
2018-05-27Additional validation of avail_table.Sergey Poznyakoff1
Verify that avail_table is sorted by size and that each element's size falls within allowed range. * src/bucket.c (gdbm_get_bucket): Fix bucket validation. Validate bucket_avail. (_gdbm_split_bucket): Check return from _gdbm_free. * src/falloc.c (adjust_bucket_avail,_gdbm_free): Return error code. All uses updated. (pop_avail_block): Fix eventual memory leak. Use gdbm_avail_block_validate. * src/gdbmdefs.h (gdbm_avail_table_valid_p): Change signature. * src/gdbmopen.c (gdbm_avail_table_valid_p): Traverse the array verifying address and size of each element. (gdbm_avail_block_validate) (gdbm_bucket_avail_table_validate): New functions. (validate_header): Remove call to gdbm_avail_block_valid_p. Avail_block is validated later, after it's been loaded. Bail out if header->next_block does not equal the file size. (gdbm_fd_open): Validate avail_block. * src/gdbmstore.c (_gdbm_store): Check return from _gdbm_free. Avoid endless loop in case of inconsistent h_table. * src/gdbmtool.c (_gdbm_print_avail_list): Use gdbm_avail_block_validate. * src/proto.h: Update. * tests/gtload.c: Improve error diagnostics.
2018-05-24Various fixesSergey Poznyakoff6
* src/input-std.c: Bugfix * doc/gdbm.texi: Document changes. * README: Update. * configure.ac: New option --enable-gdbmtool-debug. * src/Makefile.am: Conditionally augment AM_YFLAGS and AM_LFLAGS with options that enable debugging. * src/gdbmtool.c: Conditionally enable --lex-trace and --gram-trace options. * src/gram.y: Likewise. * src/lex.l: Likewise. * tests/Makefile.am: Remove architecure-dependent tests. * tests/testsuite.at: Likewise.
2018-05-24BugfixSergey Poznyakoff1
* tests/Makefile.am (EXTRA_DIST): Add missing file.
2018-05-24Add new testSergey Poznyakoff4
2018-05-23gdbmtool: accept commands from command line as well as from fileSergey Poznyakoff8
Commands can be supplied to gdbmtool in three ways: 1. From a file, using the --file (-f) option: gdbmtool -f comfile 2. From the command line, if first argument is the database name: gdbmtool test.db count \; fetch mykey \; avail Note the use of semicolon to delimit commands. 3. From the interactive shell, if neither of the above is used. * src/Makefile.am: Add new sources. * src/gdbmtool.c: Use new stream functions for input. * src/gdbmtool.h (setsource): Remove proto. (instream_t): New data type. (instream_name, instream_read) (instream_close, instream_interactive) (instream_eq): New functions. (instream_stdin_create) (instream_argv_create) (instream_file_create) (interactive, input_context_push): New protos. * src/gram.y: Accept ; in place of newline. * src/input-argv.c: New file. * src/input-file.c: New file. * src/input-rl.c: Rewrite to provide instream_t API. * src/input-std.c: Likewise. * src/lex.l: Rewrite. * tests/.gitignore: Update. * tests/Makefile.am: Add new tests. Incorporate DejaGNU tests. * tests/config/default.exp: New file. * tests/gdbmtool/base.exp: New file. * tests/gdbmtool00.at: New file. * tests/gdbmtool01.at: New file. * tests/gdbmtool02.at: New file. * tests/testsuite.at: Include new tests.
2018-05-19Catch more errorsSergey Poznyakoff4
* src/gdbmdump.c (_gdbm_dump_ascii): Break on errors * src/gdbmopen.c (compute_directory_size): Remove unused argument. (validate_header): Catch dir_size and dir_bits mismatches. * src/mmap.c (_gdbm_mapped_lseek): Bail out on negative offsets. * tests/dump03.at: New test. * tests/dump04.at: New test. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Add new tests.
2018-05-19Add new testsSergey Poznyakoff6
* 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.
2018-01-01Happy GNU YearSergey Poznyakoff45
2017-01-02Happy GNU YearSergey Poznyakoff45
2016-07-25Add debug info.Sergey Poznyakoff2
* configure.ac: Fix description wording. * src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Don't define GDBM_DEBUG_ENABLE. * tests/Makefile.am: Likewise. * src/debug.c (gdbm_debug_printer) (gdbm_debug_flags): New globals. (gdbm_debug_token, gdbm_debug_parse_state) (gdbm_debug_datum): New functions. * src/gdbm.h.in [@GDBM_DEBUG_ENABLE@]: Define GDBM_DEBUG_ENABLE. (gdbm_debug_printer_t): New typedef. (gdbm_debug_printer, gdbm_debug_flags): New externs. (GDBM_DEBUG_ERR,GDBM_DEBUG_OPEN) (GDBM_DEBUG_READ,GDBM_DEBUG_STORE) (GDBM_DEBUG_LOOKUP,GDBM_DEBUG_ALL): New defines. (gdbm_debug_token,gdbm_debug_parse_state) (gdbm_debug_datum): New protos. * src/gdbmdefs.h (GDBM_DEBUG,GDBM_DEBUG_DATUM): New macros. * src/findkey.c: Add debugging info. * src/gdbmfetch.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmseq.c: Likewise. * src/gdbmstore.c: Likewise. * src/gdbmtool.c (open_handler): Allow the use of ~/ (command) <repeat,variadic>: New members. (run_command): Handle variadic functions. (run_last_command): New command. In interactive mode, repeats the last command if it was marked with repeat=1 (currently, only "next"). New command: "debug". (all functions): Use terror instead of fprintf(stderr,...); * src/gdbmtool.h (handler_param) <vararg>: New member. (run_last_command): New proto. * src/gram.y: Call run_last_command) on empty input. * tests/gtload.c: New option: -debug=
2016-07-20Introduce debug hooks.Sergey Poznyakoff2
* configure.ac: New option --enable-debug Print feature summary at the end of the run. * src/debug.c: New file. * src/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Build debug.o Define GDBM_DEBUG_ENABLE. * src/gdbmdefs.h [GDBM_DEBUG_ENABLE] (_gdbm_debug_hook_install) (_gdbm_debug_hook_remove,_gdbm_debug_hook_check) (_gdbm_debug_hook_val): New protos. (GDBM_DEBUG_HOOK, GDBM_DEBUG_OVERRIDE) (GDBM_DEBUG_ALLOC): New defines. * src/gdbm.h.in (GDBM_RCVR_FORCE): New flag. * src/recover.c (gdbm_recover): Check database before attempting recovery, unless GDBM_RCVR_FORCE flag is set. * doc/gdbm.texi: Document GDBM_RCVR_FORCE * src/gdbmreorg.c (gdbm_reorganize): Use GDBM_RCVR_FORCE. * src/gdbmtool.c (main): Always allocate file_name. * src/bucket.c: Put GDBM_DEBUG_OVERRIDE and GDBM_DEBUG_ALLOC in critical places. * src/falloc.c: Likewise. * src/findkey.c: Likewise. * src/gdbmopen.c: Likewise. * src/gdbmstore.c: Likewise. * src/update.c: Likewise. * tests/Makefile.am [GDBM_COND_DEBUG_ENABLE]: Define GDBM_DEBUG_ENABLE. * tests/gtload.c: New options -hook, -recover, -verbose, -backup, -max-failures, -max-failed-keys, and -max-failed-buckets. Attempt recovery after errors.
2016-07-19Implement gdbm_recover functionSergey Poznyakoff3
* configure.ac: Don't check for rename. * src/Makefile.am (libgdbm_la_SOURCES): Add recover.c * src/recover.c: New file. * src/bucket.c (_gdbm_get_bucket): Remove extra space before [ * src/err.c (prerror): Take additional argument (gdbm_perror): Print system errno if necessary. * src/gdbm.h.in (GDBM_CLOERROR): New flag. (gdbm_fd_open, gdbm_copy_meta): New proto. (gdbm_last_syserr,gdbm_db_strerror,gdbm_recover): New proto. (gdbm_syserr): New extern. (gdbm_recovery): New struct. (GDBM_RCVR_DEFAULT,GDBM_RCVR_ERRFUN) (GDBM_RCVR_MAX_FAILED_KEYS) (GDBM_RCVR_MAX_FAILED_BUCKETS) (GDBM_RCVR_MAX_FAILURES) (GDBM_RCVR_BACKUP): New flags. (GDBM_BACKUP_FAILED): New error code. * src/gdbmclose.c (gdbm_close): Work correctly if dbf->desc == -1. * src/gdbmcount.c (gdbm_count): Remove spurious sorting. Use _gdbm_next_bucket_dir for iterating over the buckets. * src/gdbmdefs.h (struct gdbm_file_info)<last_syserror> <last_errstr>: New members. * src/gdbmerrno.c (gdbm_set_errno): Set last_syserror as well. (gdbm_clear_error): Reset last_syserror. (gdbm_last_syserr): New function. (gdbm_errlist): New entry for GDBM_BACKUP_FAILED. (gdbm_db_strerror): New function. (gdbm_syserr): New global. * src/gdbmload.c (get_parms): Buffer can be NULL. * src/gdbmopen.c (gdbm_fd_open): New function. (gdbm_open): Rewrite as a wrapper over gdbm_fd_open. * src/gdbmreorg.c (gdbm_reorganize): Rewrite as a wrapper over gdbm_recover. * src/proto.h (_gdbm_next_bucket_dir): New proto. * src/gdbmtool.c: New command: recover. * tests/.gitignore: Add gtrecover * tests/gtrecover.c: New test program. * tests/Makefile.am: Build gtrecover
2016-07-15New gdbm_setopt option to get the actual block size valueSergey Poznyakoff6
* src/gdbm.h.in (GDBM_GETBLOCKSIZE): New option. * src/gdbmcount.c (gdbm_count): Fix memory leak on error. * src/gdbmsetopt.c (gdbm_setopt): Rewrite. Handle GDBM_GETBLOCKSIZE. * NEWS: Document GDBM_GETBLOCKSIZE * doc/gdbm.texi: Likewise. * tests/gtload.c: New options -bsexact and -verbose. * tests/Makefile.am: Add new testcases. * tests/testsuite.at: Likewise. * tests/blocksize00.at: New testcase. * tests/blocksize01.at: Likewise. * tests/blocksize02.at: Likewise.
2016-07-08Fix error handling in gdbm_fetch, gdbm_firstkey, and gdbm_nextkey.Sergey Poznyakoff2
* src/gdbmfetch.c: Hanlde out of memory error. * src/findkey.c: Set gdbm_errno to GDBM_ITEM_NOT_FOUND if nothing was found. * src/gdbmdelete.c: Don't set gdbm_errno after _gdbm_findkey returns -1. It's been done already. * src/gdbmexp.c (gdbm_export_to_file): Return -1 if gdbm_fetch fails. * src/gdbmseq.c (get_next_key): Set gdbm_errno to GDBM_ITEM_NOT_FOUND if there's no next key. Don't call _gdbm_fatal on out of memory condition. (gdbm_nextkey): Set gdbm_errno to GDBM_ITEM_NOT_FOUND if there's no next key. * src/gdbmtool.c (fetch_handler) (firstkey_handler,nextkey_handler): Check gdbm_errno. * src/gdbmstore.c: Handle error return from _gdbm_findkey. * tests/gtdump.c: Likewise. * tests/gtfetch.c: Likewise. * doc/gdbm.texi: Document changes. * doc/gdbm.3: Likewise. * configure.ac: Version 1.12.90 * NEWS: Update. * .gitignore: Update.
2016-07-07Switch to Git repositorySergey Poznyakoff1
2014-05-23Compatibility bugfixesSergey Poznyakoff4
* THANKS: Add Thomas Klausner. * src/gdbmtool.h: Rename ARG_ constants to GDBM_ARG_ * src/gdbmtool.c: Likewise. * tests/create00.at: Use modern sort -k syntax. * tests/dbmcreate00.at: Likewise. * tests/dbmdel00.at: Likewise. * tests/delete00.at: Likewise.
2013-05-13Handle structured key and content data in gdbmtool.Sergey Poznyakoff2
* src/datconv.c: New file. * src/Makefile.am (gdbmtool_SOURCES): Add datconv.c. * src/gdbmtool.h (slist, kvpair): New structures. (gdbmarg): Keep various types of data depending on the value of the type member. (slist_new, slist_free) (kvpair_string, kvpair_list): New protos. (gdbmarg_new): Remove. (gdbmarg_string, gdbmarg_datum) (gdbmarg_kvpair, gdbmarg_free) (gdbmarg_destroy): New protos. (xd_expand, xd_store, datadef_locate): New protos. (field, dsegm): New structs. (dsegm_new, dsegm_new_field, dsegm_free_list): New protos. * src/gdbmtool.c: Rewrite. * src/gram.y: Change grammar to allow for defining key and content structure and for supplying structured data as arguments to fetch, store and similar functions. * src/lex.l: Handle new token types. * tests/dtload.c (main): Fix parser. * tests/gtload.c: Likewise.
2013-05-09Use AM_CPPFLAGS instead of INCLUDES in MakefilesSergey Poznyakoff1
2012-03-21Bugfixes in test suiteSergey Poznyakoff2
* tests/create00.at: Use cmp -s || diff -u instead of plain diff, because the latter produces extra output on some systems (notably Solaris). * tests/dbmcreate00.at: Likewise. * THANKS: Add Bill Jones
2011-11-11Implement cloexec in gdbm_reorganize. Add test cases.Sergey Poznyakoff11
* compat/dbmopen.c: Apply O_CLOEXEC for newly created dir file, if requested. * src/gdbmdefs.h (gdbm_file_info) <cloexec>: New member. * src/gdbmopen.c (gdbm_open): Initialize cloexec member. * src/gdbmreorg.c (gdbm_reorganize): Propagate cloexec bit to the new database. * tests/.cvsignore: Update. * tests/cloexec00.at: New test case. * tests/cloexec01.at: Likewise. * tests/cloexec02.at: Likewise. * tests/cloexec03.at: Likewise. * fdop.c: New auxiliary program. * g_open_ce: New test program. * g_reorg_ce: New test program. * d_creat_ce: New test program. * tests/Makefile.am: Add new test cases and test programs. * tests/testsuite.at: Include new test cases. * doc/gdbm.texinfo: Minor change.
2011-11-10Fix handling of NDBM databases in read-only mode.Sergey Poznyakoff5
* 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.
2011-08-12Bugfixes (pointed out by Matthew Burgess).Sergey Poznyakoff1
* src/gdbmopen.c: Fix a typo. * tests/Makefile.am ($(srcdir)/package.m4): Fix improper dependency.
2011-08-11Add testcases for gdbm_setopt.Sergey Poznyakoff6
* tests/gtopt.c: New file * tests/.cvsignore: Update. * tests/setopt00.at: New testcase. * tests/setopt01.at: New testcase. * tests/Makefile.am: Build gtopt. Add setopt00.at and setopt01.at. * tests/testsuite.at: Include setopt00.at and setopt01.at.
2011-08-10Improve memory mapping support.Sergey Poznyakoff1
The new code is more flexible and performs better when lots of inserts are being made (e.g. when populating the database with new data). * src/gdbm.h.in (GDBM_SETMAXMAPSIZE): New constant. * src/gdbmconst.h (SIZE_T_MAX): New define. * src/gdbmdefs.h (gdbm_file_info) <cache_size>: Change type to size_t. <mmap_inited,mapped_size_max>: New member. <mapped_remap>: Remove. * src/gdbmopen.c: Fix a typo. (gdbm_open): Initialize new members. (_gdbm_init_cache): Second argument is size_t. * src/gdbmsetopt.c (gdbm_setopt): Optval argument is void*. Handle GDBM_SETMAXMAPSIZE. Improve error checking. * src/mmap.c (_GDBM_IN_MAPPED_REGION_P): Fix comparison with the lower bound. (_GDBM_NEED_REMAP): Return true if mapped_region is NULL. (SUM_FILE_SIZE): Rewrite. (_gdbm_mapped_unmap): Don't call msync. (_gdbm_internal_remap): Take 2 arguments, the second one giving the new mapped size. Unmap the region prior to remapping it. Always pass NULL as the argument to mmap. (_gdbm_mapped_remap): Rewrite the logic. Change semantics of the third argument. All uses updated. (_gdbm_mapped_init): Reflect the above changes. (_gdbm_mapped_read,_gdbm_mapped_write): Use mmap_inited to decide whether to use mmap, because mapped_region can be reset to zero by another functions (namely, _gdbm_mapped_lseek). Reset mmap_inited to FALSE, if _gdbm_mapped_remap fails. (_gdbm_mapped_lseek): Rewrite offset computations. Invalidate the mapped region. * src/proto.h (_gdbm_init_cache): Change prototype. * src/update.c (write_header, _gdbm_end_update): Remove checks for dbf->mapped_region. * tests/gtload.c: Implement the -maxmap option (set maximal mapped memory size). * doc/gdbm.texinfo: Document GDBM_SETMAXMAPSIZE.
2011-08-08Provide test group descriptors in the testsuite.Sergey Poznyakoff9
* tests/atlocal.in (XFAILFILE): Remove. * tests/version.at: Don't create XFAILFILE. * tests/testsuite.at: Add test group banners * tests/dbmcreate00.at (AT_SETUP): Change description. * tests/dbmdel00.at: Likewise. * tests/dbmdel01.at: Likewise. * tests/dbmdel02.at: Likewise. * tests/dbmfetch00.at: Likewise. * tests/dbmfetch01.at: Likewise.
2011-08-05Define AT_PACKAGE_VERSION_MAJOR,Sergey Poznyakoff1
AT_PACKAGE_VERSION_MINOR, and AT_PACKAGE_VERSION_PATCH.
2011-08-05UpdateSergey Poznyakoff1
2011-08-05New file.Sergey Poznyakoff1
2011-08-05New files.Sergey Poznyakoff2
2011-08-05New files.Sergey Poznyakoff9
2011-08-05(AT_COMPAT_PREREQ): New macro.Sergey Poznyakoff1
Add compat test cases.
2011-08-05Include progname.h instead of declaring canonical_progname.Sergey Poznyakoff5
2011-08-05Update keywords.Sergey Poznyakoff6
2011-08-05Conditionally define COMPAT.Sergey Poznyakoff1
2011-08-05Add new files.Sergey Poznyakoff1
2011-08-03Use gtver instead of testgdbm.Sergey Poznyakoff1
2011-08-03Add gtverSergey Poznyakoff1
2011-08-03(check_PROGRAMS): Add gtver.Sergey Poznyakoff1
2011-08-03New file.Sergey Poznyakoff1
2011-08-02Add delete tests.Sergey Poznyakoff9
2011-08-02Update cvsignore files.Sergey Poznyakoff1
2011-08-02UpdateSergey Poznyakoff1
2011-08-02Add tests.Sergey Poznyakoff11

Return to:

Send suggestions and report system problems to the System administrator.