Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
6367c58c
Commit
6367c58c
authored
Nov 18, 2016
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: handle life without threads
parent
6a05c7a0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
tests/clar_libgit2.h
+5
-1
tests/threads/basic.c
+6
-0
No files found.
tests/clar_libgit2.h
View file @
6367c58c
...
@@ -59,7 +59,11 @@ typedef struct {
...
@@ -59,7 +59,11 @@ typedef struct {
char
error_msg
[
4096
];
char
error_msg
[
4096
];
}
cl_git_thread_err
;
}
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 { \
#define cl_git_thread_pass_(__threaderr, __expr, __file, __line) do { \
giterr_clear(); \
giterr_clear(); \
...
...
tests/threads/basic.c
View file @
6367c58c
...
@@ -49,6 +49,7 @@ void test_threads_basic__set_error(void)
...
@@ -49,6 +49,7 @@ void test_threads_basic__set_error(void)
run_in_parallel
(
1
,
4
,
set_error
,
NULL
,
NULL
);
run_in_parallel
(
1
,
4
,
set_error
,
NULL
,
NULL
);
}
}
#ifdef GIT_THREADS
static
void
*
return_normally
(
void
*
param
)
static
void
*
return_normally
(
void
*
param
)
{
{
return
param
;
return
param
;
...
@@ -59,9 +60,13 @@ static void *exit_abruptly(void *param)
...
@@ -59,9 +60,13 @@ static void *exit_abruptly(void *param)
git_thread_exit
(
param
);
git_thread_exit
(
param
);
return
NULL
;
return
NULL
;
}
}
#endif
void
test_threads_basic__exit
(
void
)
void
test_threads_basic__exit
(
void
)
{
{
#ifndef GIT_THREADS
clar__skip
();
#else
git_thread
thread
;
git_thread
thread
;
void
*
result
;
void
*
result
;
...
@@ -74,4 +79,5 @@ void test_threads_basic__exit(void)
...
@@ -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_create
(
&
thread
,
return_normally
,
(
void
*
)
232323
));
cl_git_pass
(
git_thread_join
(
&
thread
,
&
result
));
cl_git_pass
(
git_thread_join
(
&
thread
,
&
result
));
cl_assert_equal_sz
(
232323
,
(
size_t
)
result
);
cl_assert_equal_sz
(
232323
,
(
size_t
)
result
);
#endif
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment