Skip to content

Commit 6367c58

Browse files
author
Edward Thomson
committed
tests: handle life without threads
1 parent 6a05c7a commit 6367c58

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

tests/clar_libgit2.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,11 @@ typedef struct {
5959
char error_msg[4096];
6060
} cl_git_thread_err;
6161

62-
#define cl_git_thread_pass(threaderr, expr) cl_git_thread_pass_(threaderr, (expr), __FILE__, __LINE__)
62+
#ifdef GIT_THREADS
63+
# define cl_git_thread_pass(threaderr, expr) cl_git_thread_pass_(threaderr, (expr), __FILE__, __LINE__)
64+
#else
65+
# define cl_git_thread_pass(threaderr, expr) cl_git_pass(expr)
66+
#endif
6367

6468
#define cl_git_thread_pass_(__threaderr, __expr, __file, __line) do { \
6569
giterr_clear(); \

tests/threads/basic.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void test_threads_basic__set_error(void)
4949
run_in_parallel(1, 4, set_error, NULL, NULL);
5050
}
5151

52+
#ifdef GIT_THREADS
5253
static void *return_normally(void *param)
5354
{
5455
return param;
@@ -59,9 +60,13 @@ static void *exit_abruptly(void *param)
5960
git_thread_exit(param);
6061
return NULL;
6162
}
63+
#endif
6264

6365
void test_threads_basic__exit(void)
6466
{
67+
#ifndef GIT_THREADS
68+
clar__skip();
69+
#else
6570
git_thread thread;
6671
void *result;
6772

@@ -74,4 +79,5 @@ void test_threads_basic__exit(void)
7479
cl_git_pass(git_thread_create(&thread, return_normally, (void *)232323));
7580
cl_git_pass(git_thread_join(&thread, &result));
7681
cl_assert_equal_sz(232323, (size_t)result);
77-
}
82+
#endif
83+
}

0 commit comments

Comments
 (0)