Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2013-01-03 20:38:00 +0400
committerBen Straub <bs@github.com>2013-01-03 20:38:00 +0400
commitbffbeebbec2878c5329e63b40ecae3715423eac6 (patch)
tree0e07d160f5dfb99d9c83e528e86edd7ce14bb986 /tests-clar/pack
parent6fef1ab344326bbdeb45fd653e3c13c233600a35 (diff)
Cleanup after tests
Diffstat (limited to 'tests-clar/pack')
-rw-r--r--tests-clar/pack/packbuilder.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests-clar/pack/packbuilder.c b/tests-clar/pack/packbuilder.c
index b450be6b6..31823eac1 100644
--- a/tests-clar/pack/packbuilder.c
+++ b/tests-clar/pack/packbuilder.c
@@ -1,6 +1,7 @@
#include "clar_libgit2.h"
#include "iterator.h"
#include "vector.h"
+#include "posix.h"
static git_repository *_repo;
static git_revwalk *_revwalker;
@@ -72,6 +73,21 @@ static void seed_packbuilder(void)
}
}
+static void cleanup_pack(const git_oid *oid)
+{
+ char *hash, path[1024] = {0};
+
+ hash = git_oid_allocfmt(oid);
+
+ sprintf(path, "pack-%s.idx", hash);
+ p_unlink(path);
+
+ sprintf(path, "pack-%s.pack", hash);
+ p_unlink(path);
+
+ git__free(hash);
+}
+
void test_pack_packbuilder__create_pack(void)
{
git_transfer_progress stats;
@@ -82,6 +98,9 @@ void test_pack_packbuilder__create_pack(void)
cl_git_pass(git_indexer_new(&_indexer, "testpack.pack"));
cl_git_pass(git_indexer_run(_indexer, &stats));
cl_git_pass(git_indexer_write(_indexer));
+
+ cl_fixture_cleanup("testpack.pack");
+ cleanup_pack(git_indexer_hash(_indexer));
}
static git_transfer_progress stats;
@@ -97,10 +116,13 @@ static int foreach_cb(void *buf, size_t len, void *payload)
void test_pack_packbuilder__foreach(void)
{
git_indexer_stream *idx;
+ git_oid oid;
seed_packbuilder();
cl_git_pass(git_indexer_stream_new(&idx, ".", NULL, NULL));
cl_git_pass(git_packbuilder_foreach(_packbuilder, foreach_cb, idx));
cl_git_pass(git_indexer_stream_finalize(idx, &stats));
+ git_oid_cpy(&oid, git_indexer_stream_hash(idx));
git_indexer_stream_free(idx);
+ cleanup_pack(&oid);
}