tests


Log

Author Commit Date CI Message
Vicent Marti 0cf02ff9 2010-05-26T21:23:01 Added t0501-walk (simple test for all revision pool walking modes) Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 655d381a 2010-05-23T16:51:31 Add topological sorting and new insertion methods for commit lists. 'git_commit_list_toposort()' and 'git_commit_list_timesort()' now sort a commit list by topological and time order respectively. Both sorts are stable and in place. 'git_commit_list_append' has been replaced by 'git_commit_list_push_back' and 'git_commit_list_push_front'. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 82b1db3b 2010-05-25T22:00:55 Changed commit time sorting to be descending (from newest to oldest). Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti d047b47a 2010-05-23T04:41:07 Updated t0401 (commit parsing) to reflect the new API changes. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 089c2d93 2010-05-23T04:39:33 Add unit tests for list sorting. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Vicent Marti 42281e00 2010-05-16T01:52:31 Add unit tests for Commit parsing A few initial tests for commit parsing: "parse_buffer_test" tests git_commit__parse_buffer() with several malformed commit messages and a few corner cases which should pass. "parse_oid_test" tests git_commit__parse_oid() with several malformed commit lines containing broken SHA1 OIDs. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 38c513b9 2010-04-28T19:07:14 Add support to enable the library to use OpenSSL SHA1 functions Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 19d13c65 2010-04-27T17:00:30 Makefile(s): Don't include the OpenSSL crypto library in the link Also, fully purge the NO_OPENSSL build variable. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 70aab459 2010-04-26T22:04:10 win32: Remove wsock32 from the list of libraries to link Commit 5dddf7c (Add block-sha1 in favour of the mozilla routines 2010-04-14) introduced the "bswap.h" header file which, for x86 or x86-64 machines, provides a "sane" implementation of ntohl() and htonl(). The wsock32 library, on the msvc and MinGW build, is only included in the link to supply the ntohl()/htonl() routines. Since we now have a built-in implementation, we can remove the wsock32 library from the link. [This will break a Windows build on a non-intel machine] Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 56931d1a 2010-02-19T20:07:03 Makefile: Add support for custom build options in config.mak file Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 1e5dd572 2010-02-12T16:50:33 Fix some coding style issues Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 74eff33f 2010-02-01T10:39:10 Makefile: Add support for building with MSVC Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 73dcf287 2010-01-12T16:39:25 msvc: Fix some "unreferenced formal parameter" warnings Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e8a95256 2010-01-04T18:57:13 msvc: Fix some -W4 warnings Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 1a7bae4d 2010-01-11T22:51:42 Fix some "unused parameter" warnings with -Wextra Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 1cfb0ff4 2009-12-30T19:12:35 Makefile: Add some missing $(GIT_LIB) dependencies Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones a1c0728d 2009-12-21T15:54:50 Add support for the MinGW platform Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones cfe3a027 2010-01-15T22:07:44 Use a 64 bit off_t throughout the library and tests on POSIX Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 960ca1d7 2009-08-28T21:22:46 Add the git_oid_to_string() utility function Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e4553584 2009-08-19T17:06:39 Add test-suite coverage testing using gcov Add a new "coverage" Makefile target that re-builds the library and tests using the gcc compiler/linker flags required by gcov, runs the test suite to capture the runtime data, then compiles a coverage report. The report, which is saved in a file named "untested", consists of a list of untested files, followed by a list of untested functions. More detailed execution statistics are given in the gcov log files which are saved in the top-level directory (named like src#hash.c.gcov). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones d2ef83fc 2009-08-28T20:22:03 t0101-oid.c: Fix a memory leak reported by valgrind Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones cac5d927 2009-08-27T16:11:07 Add support for running the tests via valgrind Add some makefile targets, which use valgrind's memcheck tool to run the tests, in order to help diagnose memory problems in the library. In addition, we enable the '--leak-check' option to report on any memory leaks. However, unlike the other memory problems reported by memcheck, memory leak reports do not result in an error exit from valgrind. (So memory leaks are reported on stderr, but don't halt the test run.) A suppressions file (tests.supp) is included since libz triggers some false positives. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Julio Espinoza-Sokal 73c4dd92 2009-06-15T21:26:02 Add noreturn declaration compatible with the MSVC compiler. MSVC provides a compiler declaration to declare that a function never returns. This declaration is required in front of the function definition rather than at the end, but fortunately gcc is compatible with this location as well. Explicit returns are no longer required after calls to test_die. Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones c8d42b9b 2009-06-04T17:12:00 t0020-dirent.c: Add explicit returns to the callback functions In particular, the one_entry() and dont_call_me() callback functions require explicit returns, in order to suppress some "control path" compiler warnings (from MS Visual C/C++). Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones aee8b26e 2009-06-04T17:11:06 Makefile: move test related targets to a new tests/Makefile Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones cf33ac7a 2009-06-04T17:10:17 Makefile: Add CFLAGS to the "test_main.c" compile target Also, add the <string.h> include to test_main.c, in order to suppress the resulting "implicit declaration of strcmp()" warning. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones e17a3f56 2009-06-04T16:47:59 Implement git_odb_write() Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones fd0ec033 2009-03-23T18:52:00 Fix comments in renamed t020?-readloose tests Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 498bc090 2009-03-23T18:47:18 t0020-dirent.c: allow test to be run standalone This test assumed that it was invoked in an empty directory, which is true when run from the Makefile, and so would fail if run standalone. In order to allow the test to work when run from any directory, create a sub directory "dir-walk" and chdir() into this directory while running the tests. Also, add some additional tests. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Julio Espinoza-Sokal 0f39781c 2009-03-12T22:10:32 Add a test to check existence of loose objects. Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Julio Espinoza-Sokal 491442f9 2009-03-12T22:10:22 Factor out test helper methods for creating/deleting loose objects Signed-off-by: Julio Espinoza-Sokal <julioes@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 04c9c16e 2009-02-03T18:16:11 Correct some comments in readloose tests Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 4730b722 2009-01-12T19:51:17 Tidy up the readloose tests Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones ced645ea 2009-01-12T19:42:13 Add git__dirname and git__basename utility routines These routines are intended to extract the directory and base name from a path string. Note that these routines do not interact with any filesystem and work only on the text of the path. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 5690f02e 2008-12-31T15:35:36 Rewrite git_foreach_dirent into gitfo_dirent Our fileops API is currently private. We aren't planning on supplying a cross-platform file API to applications that link to us. If we did, we'd probably whole-sale publish fileops, not just the dirent code. By moving it to be private we can also change the call signature to permit the buffer to be passed down through the call chain. This is very helpful when we are doing a recursive scan as we can reuse just one buffer in all stack frames, reducing the impact the recursion has on the stack frames in the data cache. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 9eb79764 2008-12-31T14:35:39 Add string utility functions for prefix and suffix compares Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 028ef0de 2008-12-31T13:20:21 Add a mutex and atomic counter abstraction and implementations These abstractions can be used to implement an efficient resource reference counter and simple mutual exclusion. On pthreads we use pthread_mutex_t, except when we are also on glibc and can directly use its asm/atomic.h definitions. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 4260699b 2008-12-31T11:16:41 Rename the test cases to run in specific orders This way we can be fairly certain we run tests of lower-level parts of the library before we run tests of higher-level more complex parts. If there is any problem in a lower-level part of the library, the earlier test will identify it and stop, making it easire to troubleshoot the failure. A rough naming guide has been added for the test suite to explain the current category structure. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce a1d34bc0 2008-12-30T21:49:38 Support building on Mac OS X by using pthread_getspecific for TLS The Mach-O format does not permit gcc to implement the __thread TLS specification, so we must instead emulate it using a single int cell allocated from memory and stored inside of the thread specific data associated with the current pthread. What makes this tricky is git_errno must be a valid lvalue, so we really need to return a pointer to the caller and deference it as part of the git_errno macro. The GCC-specific __attribute__((constructor)) extension is used to ensure the pthread_key_t is allocated before any Git functions are executed in the library, as this is necessary to access our thread specific storage. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones c960d6a3 2008-12-27T18:59:43 Add a routine to determine a git_oid given an git_obj Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 007e0753 2008-12-27T18:58:25 Add some routines for SHA1 hash computation [sp: Changed signature for output to use git_oid, and added a test case to verify an allocated git_hash_ctx can be reinitialized and reused.] Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 3d3552e8 2008-12-18T22:58:10 Implement git_odb__read_loose() Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 7b6e8067 2008-12-10T18:31:28 Add some git_otype string conversion and testing routines Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce af795e49 2008-12-02T09:56:23 Add routines to convert git_oid to hex strings [sp: Credit for some of this implementation goes to Pieter, I started off a patch he proposed for libgit2 but reworked enough of it that I don't want to blame him for any bugs.] Suggested-by: Pieter de Bie <pdebie@ai.rug.nl> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce b7c891c6 2008-11-03T17:31:16 Add git_oid_cpy, git_oid_cmp as inline functions These are easily built off the standard C library functions memcpy and memcmp. By marking these inline we stand a good chance of the C compiler replacing the entire thing with tight machine code, because many compilers will actually inline a memcmp or memcpy when the 3rd argument (the size) is a constant value. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 367ab010 2008-11-03T18:19:02 Add an extra oid test to verify control characters aren't read We only want hex digits to be read, any other character in the 8-bit character set is invalid within an id string. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce fbbfdf9f 2008-11-03T16:29:56 Move GIT_NORETURN into test_lib.h only We should never have a noreturn style function in the library itself, as such a function would prevent the calling application from handling error conditions the way it wants. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce b81dd80e 2008-11-03T18:38:12 Change test_main to run a single test case out of the suite By passing the name of the test function on the command line we execute exactly that one test, and then exit successfully if the test did not fail. This permits multiple functions in the same .c file, so they could be called from a shell script or debugged independently externally. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce b923f2f9 2008-11-03T17:00:54 Fix Makefile to correctly handle 'make -j4 test' If we have more than one test build running we cannot use the same file for each test case; instead we need to use a per-test path so there aren't any collisions. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 15bffce9 2008-11-01T18:14:22 Create a basic test suite for the library and test oid functions This is a horribly simple test suite that makes it fairly easy to put together some basic function level unit tests on the library. Its patterned somewhat after the test suite in git.git, but also after the "Check" test library. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>