summaryrefslogtreecommitdiff
path: root/tests/test_main.c
Commit message (Collapse)AuthorAgeFilesLines
* Moved testing resources to clar, and removed old tests directory.Ben Straub2012-03-311-93/+0
| | | | Removed the BUILD_CLAR CMake flag, and updated the readme.
* Clean up GIT_UNUSED macros on all platformsRussell Belfer2012-03-021-3/+3
| | | | | | | | | | | | | | | | | | | It turns out that commit 31e9cfc4cbcaf1b38cdd3dbe3282a8f57e5366a5 did not fix the GIT_USUSED behavior on all platforms. This commit walks through and really cleans things up more thoroughly, getting rid of the unnecessary stuff. To remove the use of some GIT_UNUSED, I ended up adding a couple of new iterators for hashtables that allow you to iterator just over keys or just over values. In making this change, I found a bug in the clar tests (where we were doing *count++ but meant to do (*count)++ to increment the value). I fixed that but then found the test failing because it was not really using an empty repo. So, I took some of the code that I wrote for iterator testing and moved it to clar_helpers.c, then made use of that to make it easier to open fixtures on a per test basis even within a single test file.
* threads: Make the old test suite TLS awarenulltoken2012-01-291-0/+4
|
* repository: Change ownership semanticsVicent Marti2011-11-261-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fileops/repository: create (most) directories with 0777 permissionsBrodie Rao2011-10-141-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Force the test's main function to use cdecl under WindowsCarlos Martín Nieto2011-08-061-1/+6
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* status: get blob object id of file on diskJason Penny2011-07-091-0/+2
| | | | | | 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'.
* odb: Direct writes are backVicent Marti2011-07-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | 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.
* Add a test for remote parsingCarlos Martín Nieto2011-06-261-0/+2
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Remove custom backendsVicent Marti2011-06-141-4/+0
| | | | | All the custom backend code will be moved to a separate project, together with the new MySQL backend.
* Merge upstream/developmentCarlos Martín Nieto2011-04-111-0/+2
|\
| * redis backendDmitry Kovega2011-04-081-0/+2
| |
* | config: add testsCarlos Martín Nieto2011-04-041-0/+2
|/ | | | | | | These tests are basic, but they should tell us when we've broken something. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
* Thread safe cacheVicent Marti2011-03-201-0/+2
|
* Cleanup the testing toolkitVicent Marti2011-03-031-59/+27
| | | | | | | | | | | | | | | | | | | 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>
* Internal changes on the backend systemVicent Marti2011-02-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add support for SQLite backendsVicent Marti2011-02-051-1/+3
| | | | | | | | | | | | 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>
* Make the test return an error code on failureVicent Marti2011-02-021-3/+5
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Rewrite the unit testing suiteVicent Marti2011-02-021-56/+65
| | | | | | | | | | | 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>
* Minor modifications for MinGW/Cygwin compatibility.Peter Drahos2010-12-121-2/+2
|
* Fix segfault handler in Mac OS XVicent Marti2010-12-021-39/+9
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Add stack trace to the tests when building with GCCVicent Marti2010-12-021-0/+60
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Makefile: Add CFLAGS to the "test_main.c" compile targetRamsay Jones2009-06-051-0/+1
| | | | | | | | 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>
* Change test_main to run a single test case out of the suiteShawn O. Pearce2008-11-031-4/+29
| | | | | | | | | | 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>
* Fix Makefile to correctly handle 'make -j4 test'Shawn O. Pearce2008-11-031-2/+2
| | | | | | | | 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>
* Create a basic test suite for the library and test oid functionsShawn O. Pearce2008-11-011-0/+39
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>