Skip to content

Commit 6a05c7a

Browse files
author
Edward Thomson
committed
threads::refdb tests: use new threaded clar assert
1 parent bbf22f8 commit 6a05c7a

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

tests/threads/refdb.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ void test_threads_refdb__cleanup(void)
2222
#define NREFS 10
2323

2424
struct th_data {
25+
cl_git_thread_err error;
2526
int id;
2627
const char *path;
2728
};
@@ -34,11 +35,11 @@ static void *iterate_refs(void *arg)
3435
int count = 0, error;
3536
git_repository *repo;
3637

37-
cl_git_pass(git_repository_open(&repo, data->path));
38+
cl_git_thread_pass(data, git_repository_open(&repo, data->path));
3839
do {
3940
error = git_reference_iterator_new(&i, repo);
4041
} while (error == GIT_ELOCKED);
41-
cl_git_pass(error);
42+
cl_git_thread_pass(data, error);
4243

4344
for (count = 0; !git_reference_next(&ref, i); ++count) {
4445
cl_assert(ref != NULL);
@@ -64,26 +65,27 @@ static void *create_refs(void *arg)
6465
git_reference *ref[NREFS];
6566
git_repository *repo;
6667

67-
cl_git_pass(git_repository_open(&repo, data->path));
68+
cl_git_thread_pass(data, git_repository_open(&repo, data->path));
6869

6970
do {
7071
error = git_reference_name_to_id(&head, repo, "HEAD");
7172
} while (error == GIT_ELOCKED);
72-
cl_git_pass(error);
73+
cl_git_thread_pass(data, error);
7374

7475
for (i = 0; i < NREFS; ++i) {
7576
p_snprintf(name, sizeof(name), "refs/heads/thread-%03d-%02d", data->id, i);
7677
do {
7778
error = git_reference_create(&ref[i], repo, name, &head, 0, NULL);
7879
} while (error == GIT_ELOCKED);
79-
cl_git_pass(error);
80+
cl_git_thread_pass(data, error);
8081

8182
if (i == NREFS/2) {
8283
git_refdb *refdb;
83-
cl_git_pass(git_repository_refdb(&refdb, repo));
84+
cl_git_thread_pass(data, git_repository_refdb(&refdb, repo));
8485
do {
8586
error = git_refdb_compress(refdb);
8687
} while (error == GIT_ELOCKED);
88+
cl_git_thread_pass(data, error);
8789
git_refdb_free(refdb);
8890
}
8991
}
@@ -105,7 +107,7 @@ static void *delete_refs(void *arg)
105107
char name[128];
106108
git_repository *repo;
107109

108-
cl_git_pass(git_repository_open(&repo, data->path));
110+
cl_git_thread_pass(data, git_repository_open(&repo, data->path));
109111

110112
for (i = 0; i < NREFS; ++i) {
111113
p_snprintf(
@@ -119,17 +121,17 @@ static void *delete_refs(void *arg)
119121
if (error == GIT_ENOTFOUND)
120122
error = 0;
121123

122-
cl_git_pass(error);
124+
cl_git_thread_pass(data, error);
123125
git_reference_free(ref);
124126
}
125127

126128
if (i == NREFS/2) {
127129
git_refdb *refdb;
128-
cl_git_pass(git_repository_refdb(&refdb, repo));
130+
cl_git_thread_pass(data, git_repository_refdb(&refdb, repo));
129131
do {
130132
error = git_refdb_compress(refdb);
131133
} while (error == GIT_ELOCKED);
132-
cl_git_pass(error);
134+
cl_git_thread_pass(data, error);
133135
git_refdb_free(refdb);
134136
}
135137
}
@@ -194,6 +196,7 @@ void test_threads_refdb__edit_while_iterate(void)
194196
#ifdef GIT_THREADS
195197
for (t = 0; t < THREADS; ++t) {
196198
cl_git_pass(git_thread_join(&th[t], NULL));
199+
cl_git_thread_check(&th_data[t]);
197200
}
198201

199202
memset(th, 0, sizeof(th));
@@ -205,6 +208,7 @@ void test_threads_refdb__edit_while_iterate(void)
205208

206209
for (t = 0; t < THREADS; ++t) {
207210
cl_git_pass(git_thread_join(&th[t], NULL));
211+
cl_git_thread_check(&th_data[t]);
208212
}
209213
#endif
210214
}

0 commit comments

Comments
 (0)