]> git.proxmox.com Git - libgit2.git/commitdiff
tests: handle life without threads
authorEdward Thomson <ethomson@github.com>
Fri, 18 Nov 2016 18:30:20 +0000 (18:30 +0000)
committerEdward Thomson <ethomson@github.com>
Fri, 18 Nov 2016 19:00:14 +0000 (19:00 +0000)
tests/clar_libgit2.h
tests/threads/basic.c

index 1d8d4a50b5d981fa622aaffd4f2b196452539bd5..663d1362ace4a1a0d10dcde1229ab7ad2c10386b 100644 (file)
@@ -59,7 +59,11 @@ typedef struct {
        char error_msg[4096];
 } cl_git_thread_err;
 
-#define cl_git_thread_pass(threaderr, expr) cl_git_thread_pass_(threaderr, (expr), __FILE__, __LINE__)
+#ifdef GIT_THREADS
+# define cl_git_thread_pass(threaderr, expr) cl_git_thread_pass_(threaderr, (expr), __FILE__, __LINE__)
+#else
+# define cl_git_thread_pass(threaderr, expr) cl_git_pass(expr)
+#endif
 
 #define cl_git_thread_pass_(__threaderr, __expr, __file, __line) do { \
        giterr_clear(); \
index 685452d446916dacaea0a4923c45e0a0a1f87c56..a9310bbd4952d911a0c40eafb1022bcfaa4ea27d 100644 (file)
@@ -49,6 +49,7 @@ void test_threads_basic__set_error(void)
        run_in_parallel(1, 4, set_error, NULL, NULL);
 }
 
+#ifdef GIT_THREADS
 static void *return_normally(void *param)
 {
        return param;
@@ -59,9 +60,13 @@ static void *exit_abruptly(void *param)
        git_thread_exit(param);
        return NULL;
 }
+#endif
 
 void test_threads_basic__exit(void)
 {
+#ifndef GIT_THREADS
+       clar__skip();
+#else
        git_thread thread;
        void *result;
 
@@ -74,4 +79,5 @@ void test_threads_basic__exit(void)
        cl_git_pass(git_thread_create(&thread, return_normally, (void *)232323));
        cl_git_pass(git_thread_join(&thread, &result));
        cl_assert_equal_sz(232323, (size_t)result);
-}
\ No newline at end of file
+#endif
+}