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
6a05c7a0
Commit
6a05c7a0
authored
Nov 18, 2016
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
threads::refdb tests: use new threaded clar assert
parent
bbf22f82
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
10 deletions
+14
-10
tests/threads/refdb.c
+14
-10
No files found.
tests/threads/refdb.c
View file @
6a05c7a0
...
...
@@ -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
}
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