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
6b2133b4
Commit
6b2133b4
authored
Jun 27, 2017
by
Patrick Steinhardt
Committed by
GitHub
Jun 27, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4235 from pks-t/pks/out-of-tree-builds
Out of tree builds
parents
6f02a4d1
b6ed67c2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
18 deletions
+29
-18
CMakeLists.txt
+4
-3
tests/generate.py
+18
-12
tests/index/tests.c
+5
-1
tests/refs/crashes.c
+2
-2
No files found.
CMakeLists.txt
View file @
6b2133b4
...
@@ -677,15 +677,16 @@ IF (BUILD_CLAR)
...
@@ -677,15 +677,16 @@ IF (BUILD_CLAR)
SET(SRC_CLAR "
${
CLAR_PATH
}
/main.c
" "
${
CLAR_PATH
}
/clar_libgit2.c
" "
${
CLAR_PATH
}
/clar_libgit2_trace.c
" "
${
CLAR_PATH
}
/clar_libgit2_timer.c
" "
${
CLAR_PATH
}
/clar.c
")
SET(SRC_CLAR "
${
CLAR_PATH
}
/main.c
" "
${
CLAR_PATH
}
/clar_libgit2.c
" "
${
CLAR_PATH
}
/clar_libgit2_trace.c
" "
${
CLAR_PATH
}
/clar_libgit2_timer.c
" "
${
CLAR_PATH
}
/clar.c
")
ADD_CUSTOM_COMMAND(
ADD_CUSTOM_COMMAND(
OUTPUT
${
C
LAR_PATH
}
/clar.suite
OUTPUT
${
C
MAKE_CURRENT_BINARY_DIR
}
/clar.suite
COMMAND
${
PYTHON_EXECUTABLE
}
generate.py -f -xonline -xstress .
COMMAND
${
PYTHON_EXECUTABLE
}
generate.py -
o "
${
CMAKE_CURRENT_BINARY_DIR
}
" -
f -xonline -xstress .
DEPENDS
${
SRC_TEST
}
DEPENDS
${
SRC_TEST
}
WORKING_DIRECTORY
${
CLAR_PATH
}
WORKING_DIRECTORY
${
CLAR_PATH
}
)
)
INCLUDE_DIRECTORIES(
${
CMAKE_CURRENT_BINARY_DIR
}
)
SET_SOURCE_FILES_PROPERTIES(
SET_SOURCE_FILES_PROPERTIES(
${
CLAR_PATH
}
/clar.c
${
CLAR_PATH
}
/clar.c
PROPERTIES OBJECT_DEPENDS
${
C
LAR_PATH
}
/clar.suite)
PROPERTIES OBJECT_DEPENDS
${
C
MAKE_CURRENT_BINARY_DIR
}
/clar.suite)
ADD_EXECUTABLE(libgit2_clar
${
SRC_H
}
${
SRC_GIT2
}
${
SRC_OS
}
${
SRC_CLAR
}
${
SRC_TEST
}
${
SRC_ZLIB
}
${
SRC_HTTP
}
${
SRC_REGEX
}
${
SRC_SSH
}
${
SRC_SHA1
}
)
ADD_EXECUTABLE(libgit2_clar
${
SRC_H
}
${
SRC_GIT2
}
${
SRC_OS
}
${
SRC_CLAR
}
${
SRC_TEST
}
${
SRC_ZLIB
}
${
SRC_HTTP
}
${
SRC_REGEX
}
${
SRC_SSH
}
${
SRC_SHA1
}
)
...
...
tests/generate.py
View file @
6b2133b4
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
from
__future__
import
with_statement
from
__future__
import
with_statement
from
string
import
Template
from
string
import
Template
import
re
,
fnmatch
,
os
,
codecs
,
pickle
import
re
,
fnmatch
,
os
,
sys
,
codecs
,
pickle
class
Module
(
object
):
class
Module
(
object
):
class
Template
(
object
):
class
Template
(
object
):
...
@@ -128,8 +128,9 @@ class Module(object):
...
@@ -128,8 +128,9 @@ class Module(object):
class
TestSuite
(
object
):
class
TestSuite
(
object
):
def
__init__
(
self
,
path
):
def
__init__
(
self
,
path
,
output
):
self
.
path
=
path
self
.
path
=
path
self
.
output
=
output
def
should_generate
(
self
,
path
):
def
should_generate
(
self
,
path
):
if
not
os
.
path
.
isfile
(
path
):
if
not
os
.
path
.
isfile
(
path
):
...
@@ -157,7 +158,7 @@ class TestSuite(object):
...
@@ -157,7 +158,7 @@ class TestSuite(object):
return
modules
return
modules
def
load_cache
(
self
):
def
load_cache
(
self
):
path
=
os
.
path
.
join
(
self
.
path
,
'.clarcache'
)
path
=
os
.
path
.
join
(
self
.
output
,
'.clarcache'
)
cache
=
{}
cache
=
{}
try
:
try
:
...
@@ -170,7 +171,7 @@ class TestSuite(object):
...
@@ -170,7 +171,7 @@ class TestSuite(object):
return
cache
return
cache
def
save_cache
(
self
):
def
save_cache
(
self
):
path
=
os
.
path
.
join
(
self
.
path
,
'.clarcache'
)
path
=
os
.
path
.
join
(
self
.
output
,
'.clarcache'
)
with
open
(
path
,
'wb'
)
as
cache
:
with
open
(
path
,
'wb'
)
as
cache
:
pickle
.
dump
(
self
.
modules
,
cache
)
pickle
.
dump
(
self
.
modules
,
cache
)
...
@@ -200,7 +201,7 @@ class TestSuite(object):
...
@@ -200,7 +201,7 @@ class TestSuite(object):
return
sum
(
len
(
module
.
callbacks
)
for
module
in
self
.
modules
.
values
())
return
sum
(
len
(
module
.
callbacks
)
for
module
in
self
.
modules
.
values
())
def
write
(
self
):
def
write
(
self
):
output
=
os
.
path
.
join
(
self
.
path
,
'clar.suite'
)
output
=
os
.
path
.
join
(
self
.
output
,
'clar.suite'
)
if
not
self
.
should_generate
(
output
):
if
not
self
.
should_generate
(
output
):
return
False
return
False
...
@@ -232,13 +233,18 @@ if __name__ == '__main__':
...
@@ -232,13 +233,18 @@ if __name__ == '__main__':
parser
=
OptionParser
()
parser
=
OptionParser
()
parser
.
add_option
(
'-f'
,
'--force'
,
action
=
"store_true"
,
dest
=
'force'
,
default
=
False
)
parser
.
add_option
(
'-f'
,
'--force'
,
action
=
"store_true"
,
dest
=
'force'
,
default
=
False
)
parser
.
add_option
(
'-x'
,
'--exclude'
,
dest
=
'excluded'
,
action
=
'append'
,
default
=
[])
parser
.
add_option
(
'-x'
,
'--exclude'
,
dest
=
'excluded'
,
action
=
'append'
,
default
=
[])
parser
.
add_option
(
'-o'
,
'--output'
,
dest
=
'output'
)
options
,
args
=
parser
.
parse_args
()
options
,
args
=
parser
.
parse_args
()
if
len
(
args
)
>
1
:
for
path
in
args
or
[
'.'
]:
print
(
"More than one path given"
)
suite
=
TestSuite
(
path
)
sys
.
exit
(
1
)
suite
.
load
(
options
.
force
)
suite
.
disable
(
options
.
excluded
)
path
=
args
.
pop
()
if
args
else
'.'
if
suite
.
write
():
output
=
options
.
output
or
path
print
(
"Written `clar.suite` (
%
d tests in
%
d suites)"
%
(
suite
.
callback_count
(),
suite
.
suite_count
()))
suite
=
TestSuite
(
path
,
output
)
suite
.
load
(
options
.
force
)
suite
.
disable
(
options
.
excluded
)
if
suite
.
write
():
print
(
"Written `clar.suite` (
%
d tests in
%
d suites)"
%
(
suite
.
callback_count
(),
suite
.
suite_count
()))
tests/index/tests.c
View file @
6b2133b4
...
@@ -856,11 +856,14 @@ void test_index_tests__change_icase_on_instance(void)
...
@@ -856,11 +856,14 @@ void test_index_tests__change_icase_on_instance(void)
void
test_index_tests__can_lock_index
(
void
)
void
test_index_tests__can_lock_index
(
void
)
{
{
git_repository
*
repo
;
git_index
*
index
;
git_index
*
index
;
git_indexwriter
one
=
GIT_INDEXWRITER_INIT
,
git_indexwriter
one
=
GIT_INDEXWRITER_INIT
,
two
=
GIT_INDEXWRITER_INIT
;
two
=
GIT_INDEXWRITER_INIT
;
cl_git_pass
(
git_index_open
(
&
index
,
TEST_INDEX_PATH
));
repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_git_pass
(
git_repository_index
(
&
index
,
repo
));
cl_git_pass
(
git_indexwriter_init
(
&
one
,
index
));
cl_git_pass
(
git_indexwriter_init
(
&
one
,
index
));
cl_git_fail_with
(
GIT_ELOCKED
,
git_indexwriter_init
(
&
two
,
index
));
cl_git_fail_with
(
GIT_ELOCKED
,
git_indexwriter_init
(
&
two
,
index
));
...
@@ -873,4 +876,5 @@ void test_index_tests__can_lock_index(void)
...
@@ -873,4 +876,5 @@ void test_index_tests__can_lock_index(void)
git_indexwriter_cleanup
(
&
one
);
git_indexwriter_cleanup
(
&
one
);
git_indexwriter_cleanup
(
&
two
);
git_indexwriter_cleanup
(
&
two
);
git_index_free
(
index
);
git_index_free
(
index
);
cl_git_sandbox_cleanup
();
}
}
tests/refs/crashes.c
View file @
6b2133b4
...
@@ -6,7 +6,7 @@ void test_refs_crashes__double_free(void)
...
@@ -6,7 +6,7 @@ void test_refs_crashes__double_free(void)
git_reference
*
ref
,
*
ref2
;
git_reference
*
ref
,
*
ref2
;
const
char
*
REFNAME
=
"refs/heads/xxx"
;
const
char
*
REFNAME
=
"refs/heads/xxx"
;
cl_git_pass
(
git_repository_open
(
&
repo
,
cl_fixture
(
"testrepo.git"
))
);
repo
=
cl_git_sandbox_init
(
"testrepo.git"
);
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
REFNAME
,
"refs/heads/master"
,
0
,
NULL
));
cl_git_pass
(
git_reference_symbolic_create
(
&
ref
,
repo
,
REFNAME
,
"refs/heads/master"
,
0
,
NULL
));
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo
,
REFNAME
));
cl_git_pass
(
git_reference_lookup
(
&
ref2
,
repo
,
REFNAME
));
cl_git_pass
(
git_reference_delete
(
ref
));
cl_git_pass
(
git_reference_delete
(
ref
));
...
@@ -16,5 +16,5 @@ void test_refs_crashes__double_free(void)
...
@@ -16,5 +16,5 @@ void test_refs_crashes__double_free(void)
/* reference is gone from disk, so reloading it will fail */
/* reference is gone from disk, so reloading it will fail */
cl_git_fail
(
git_reference_lookup
(
&
ref2
,
repo
,
REFNAME
));
cl_git_fail
(
git_reference_lookup
(
&
ref2
,
repo
,
REFNAME
));
git_repository_free
(
repo
);
cl_git_sandbox_cleanup
(
);
}
}
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