tests/test_main.c


Log

Author Commit Date CI Message
Vicent Marti 9462c471 2011-11-25T08:16:26 repository: Change ownership semantics The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.
Brodie Rao ce8cd006 2011-09-07T15:32:44 fileops/repository: create (most) directories with 0777 permissions To further match how Git behaves, this change makes most of the directories libgit2 creates in a git repo have a file mode of 0777. Specifically: - Intermediate directories created with git_futils_mkpath2file() have 0777 permissions. This affects odb_loose, reflog, and refs. - The top level folder for bare repos is created with 0777 permissions. - The top level folder for non-bare repos is created with 0755 permissions. - /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are created with 0777 permissions. Additionally, the following changes have been made: - fileops functions that create intermediate directories have grown a new dirmode parameter. The only exception to this is filebuf's lock_file(), which unconditionally creates intermediate directories with 0777 permissions when GIT_FILEBUF_FORCE is set. - The test runner now sets the umask to 0 before running any tests. This ensurses all file mode checks are consistent across systems. - t09-tree.c now does a directory permissions check. I've avoided adding this check to other tests that might reuse existing directories from the prefabricated test repos. Because they're checked into the repo, they have 0755 permissions. - Other assorted directories created by tests have 0777 permissions.
Carlos Martín Nieto 6e6ec54b 2011-08-06T11:26:59 Force the test's main function to use cdecl under Windows Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Jason Penny 205166d2 2011-06-22T18:19:46 status: get blob object id of file on disk Add git_status_hashfile() to get blob's object id for a file without adding it to the object database or needing a repository at all. This functionality is similar to `git hash-object` without '-w'.
Vicent Marti afeecf4f 2011-07-09T02:10:46 odb: Direct writes are back DIRECT WRITES ARE BACK AND FASTER THAN EVER. The streaming writer to the ODB was an overkill for the smaller objects like Commit and Tags; most of the streaming logic was taking too long. This commit makes Commits, Tags and Trees to be built-up in memory, and then written to disk in 2 pushes (header + data), instead of streaming everything. This is *always* faster, even for big files (since the git_filebuf class still does streaming writes when the memory cache overflows). This is also a gazillion lines of code smaller, because we don't have to precompute the final size of the object before starting the stream (this was kind of defeating the point of streaming, anyway). Blobs are still written with full streaming instead of loading them in memory, since this is still the fastest way. A new `git_buf` class has been added. It's missing some features, but it'll get there.
Carlos Martín Nieto a030ae50 2011-06-20T20:21:20 Add a test for remote parsing Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Marti b0233216 2011-06-12T11:40:14 Remove custom backends All the custom backend code will be moved to a separate project, together with the new MySQL backend.
Carlos Martín Nieto 55c197cd 2011-04-11T17:41:21 Merge upstream/development
Dmitry Kovega 8a64bc29 2011-04-03T21:43:51 redis backend
Carlos Martín Nieto 0bf8ca88 2011-04-04T16:44:23 config: add tests These tests are basic, but they should tell us when we've broken something. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti bb3de0c4 2011-03-16T21:35:51 Thread safe cache
Vicent Marti 3dccfed1 2011-03-03T18:19:05 Cleanup the testing toolkit Tests are now declared with detailed descriptions and a short test name: BEGIN_TEST(the_test0, "this is an example test that does something") ... END_TEST Modules are declared through a simple macro interface: BEGIN_MODULE(mod_name) ADD_TEST(the_test0); ... END_MODULE Error messages when tests fail have been greatly improved. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti d4b5a4e2 2011-02-09T19:49:02 Internal changes on the backend system The priority value for different backends has been removed from the public `git_odb_backend` struct. We handle that internally. The priority value is specified on the `git_odb_add_alternate`. This is convenient because it allows us to poll a backend twice with different priorities without having to instantiate it twice. We also differentiate between main backends and alternates; alternates have lower priority and cannot be written to. These changes come with some unit tests to make sure that the backend sorting is consistent. The libgit2 version has been bumped to 0.4.0. This commit changes the external API: CHANGED: struct git_odb_backend No longer has a `priority` attribute; priority for the backend in managed internally by the library. git_odb_add_backend(git_odb *odb, git_odb_backend *backend, int priority) Now takes an additional priority parameter, the priority that will be given to the backend. ADDED: git_odb_add_alternate(git_odb *odb, git_odb_backend *backend, int priority) Add a backend as an alternate. Alternate backends have always lower priority than main backends, and writing is disabled on them. Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti c041af95 2011-02-05T19:45:57 Add support for SQLite backends Configure again the build system to look for SQLite3. If the library is found, the SQLite backend will be automatically compiled. Enjoy *very* fast reads and writes. MASTER PROTIP: Initialize the backend with ":memory" as the path to the SQLite database for fully-hosted in-memory repositories. Rejoice. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 87d82994 2011-02-02T02:32:21 Make the test return an error code on failure Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 2a1732b4 2011-02-02T02:15:25 Rewrite the unit testing suite NIH Enterprises presents: a new testing system based on CuTesT, which is faster than our previous one and fortunately uses no preprocessing on the source files, which means we can run that from CMake. The test suites have been gathered together into bigger files (one file per suite, testing each of the different submodules of the library). Signed-off-by: Vicent Marti <tanoku@gmail.com>
Peter Drahos 5b8bb8e7 2010-12-07T00:54:33 Minor modifications for MinGW/Cygwin compatibility.
Vicent Marti 59995558 2010-12-02T21:48:03 Fix segfault handler in Mac OS X Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 1e35f929 2010-12-02T04:19:14 Add stack trace to the tests when building with GCC Signed-off-by: Vicent Marti <tanoku@gmail.com>
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>
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>