threads::refdb tests: use new threaded clar assert
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
diff --git a/tests/threads/refdb.c b/tests/threads/refdb.c
index 5484b71..e2f7563 100644
--- a/tests/threads/refdb.c
+++ b/tests/threads/refdb.c
@@ -22,6 +22,7 @@ void test_threads_refdb__cleanup(void)
#define NREFS 10
struct th_data {
+ cl_git_thread_err error;
int id;
const char *path;
};
@@ -34,11 +35,11 @@ static void *iterate_refs(void *arg)
int count = 0, error;
git_repository *repo;
- cl_git_pass(git_repository_open(&repo, data->path));
+ cl_git_thread_pass(data, git_repository_open(&repo, data->path));
do {
error = git_reference_iterator_new(&i, repo);
} while (error == GIT_ELOCKED);
- cl_git_pass(error);
+ cl_git_thread_pass(data, error);
for (count = 0; !git_reference_next(&ref, i); ++count) {
cl_assert(ref != NULL);
@@ -64,26 +65,27 @@ static void *create_refs(void *arg)
git_reference *ref[NREFS];
git_repository *repo;
- cl_git_pass(git_repository_open(&repo, data->path));
+ cl_git_thread_pass(data, git_repository_open(&repo, data->path));
do {
error = git_reference_name_to_id(&head, repo, "HEAD");
} while (error == GIT_ELOCKED);
- cl_git_pass(error);
+ cl_git_thread_pass(data, error);
for (i = 0; i < NREFS; ++i) {
p_snprintf(name, sizeof(name), "refs/heads/thread-%03d-%02d", data->id, i);
do {
error = git_reference_create(&ref[i], repo, name, &head, 0, NULL);
} while (error == GIT_ELOCKED);
- cl_git_pass(error);
+ cl_git_thread_pass(data, error);
if (i == NREFS/2) {
git_refdb *refdb;
- cl_git_pass(git_repository_refdb(&refdb, repo));
+ cl_git_thread_pass(data, git_repository_refdb(&refdb, repo));
do {
error = git_refdb_compress(refdb);
} while (error == GIT_ELOCKED);
+ cl_git_thread_pass(data, error);
git_refdb_free(refdb);
}
}
@@ -105,7 +107,7 @@ static void *delete_refs(void *arg)
char name[128];
git_repository *repo;
- cl_git_pass(git_repository_open(&repo, data->path));
+ cl_git_thread_pass(data, git_repository_open(&repo, data->path));
for (i = 0; i < NREFS; ++i) {
p_snprintf(
@@ -119,17 +121,17 @@ static void *delete_refs(void *arg)
if (error == GIT_ENOTFOUND)
error = 0;
- cl_git_pass(error);
+ cl_git_thread_pass(data, error);
git_reference_free(ref);
}
if (i == NREFS/2) {
git_refdb *refdb;
- cl_git_pass(git_repository_refdb(&refdb, repo));
+ cl_git_thread_pass(data, git_repository_refdb(&refdb, repo));
do {
error = git_refdb_compress(refdb);
} while (error == GIT_ELOCKED);
- cl_git_pass(error);
+ cl_git_thread_pass(data, error);
git_refdb_free(refdb);
}
}
@@ -194,6 +196,7 @@ void test_threads_refdb__edit_while_iterate(void)
#ifdef GIT_THREADS
for (t = 0; t < THREADS; ++t) {
cl_git_pass(git_thread_join(&th[t], NULL));
+ cl_git_thread_check(&th_data[t]);
}
memset(th, 0, sizeof(th));
@@ -205,6 +208,7 @@ void test_threads_refdb__edit_while_iterate(void)
for (t = 0; t < THREADS; ++t) {
cl_git_pass(git_thread_join(&th[t], NULL));
+ cl_git_thread_check(&th_data[t]);
}
#endif
}