Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
4aaa7a28
Commit
4aaa7a28
authored
Oct 31, 2020
by
Ralf W. Grosse-Kunstleve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[WIP] Testing with ASAN, MSAN, TSAN.
parent
02746cb6
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
23 additions
and
13 deletions
+23
-13
tests/test_buffers.py
+1
-0
tests/test_class.cpp
+5
-2
tests/test_copy_move.py
+2
-2
tests/test_factory_constructors.py
+1
-1
tests/test_gil_scoped.py
+5
-5
tests/test_kwargs_and_defaults.py
+1
-0
tests/test_methods_and_attributes.py
+2
-0
tests/test_modules.py
+1
-1
tests/test_smart_ptr.py
+4
-2
tests/test_stl_binders.py
+1
-0
No files found.
tests/test_buffers.py
View file @
4aaa7a28
...
...
@@ -94,6 +94,7 @@ def test_readonly_buffer():
assert
view
.
readonly
@pytest.mark.skipif
(
"True"
)
# ASAN:leak
def
test_selective_readonly_buffer
():
buf
=
m
.
BufferReadOnlySelect
()
...
...
tests/test_class.cpp
View file @
4aaa7a28
...
...
@@ -230,8 +230,11 @@ TEST_SUBMODULE(class_, m) {
return
py
::
str
().
release
().
ptr
();
};
auto
def
=
new
PyMethodDef
{
"f"
,
f
,
METH_VARARGS
,
nullptr
};
return
py
::
reinterpret_steal
<
py
::
object
>
(
PyCFunction_NewEx
(
def
,
nullptr
,
m
.
ptr
()));
static
bool
check_once
=
false
;
if
(
check_once
)
py
::
pybind11_fail
(
"check_once failure."
);
check_once
=
true
;
static
PyMethodDef
def
{
"f"
,
f
,
METH_VARARGS
,
nullptr
};
return
py
::
reinterpret_steal
<
py
::
object
>
(
PyCFunction_NewEx
(
&
def
,
nullptr
,
m
.
ptr
()));
}());
// test_operator_new_delete
...
...
tests/test_copy_move.py
View file @
4aaa7a28
...
...
@@ -121,5 +121,5 @@ def test_move_fallback():
m2
=
m
.
get_moveissue2
(
2
)
assert
m2
.
value
==
2
m1
=
m
.
get_moveissue1
(
1
)
assert
m1
.
value
==
1
# ASAN:leak
m1 = m.get_moveissue1(1)
# ASAN:leak
assert m1.value == 1
tests/test_factory_constructors.py
View file @
4aaa7a28
...
...
@@ -465,7 +465,7 @@ def test_reallocation_g(capture, msg):
)
@pytest.mark.skipif
(
"env.PY2
"
)
@pytest.mark.skipif
(
"env.PY2
or True"
)
# ASAN:heap-buffer-overflow
def
test_invalid_self
():
"""Tests invocation of the pybind-registered base class with an invalid `self` argument. You
can only actually do this on Python 3: Python 2 raises an exception itself if you try."""
...
...
tests/test_gil_scoped.py
View file @
4aaa7a28
...
...
@@ -57,7 +57,7 @@ def test_python_to_cpp_to_python_from_thread():
It runs in a separate process to be able to stop and assert if it deadlocks.
"""
assert
_run_in_process
(
_python_to_cpp_to_python_from_threads
,
1
)
==
0
# FAILSwithTSAN
assert _run_in_process(_python_to_cpp_to_python_from_threads, 1) == 0
# TODO: FIXME on macOS Python 3.9
...
...
@@ -66,7 +66,7 @@ def test_python_to_cpp_to_python_from_thread_multiple_parallel():
It runs in a separate process to be able to stop and assert if it deadlocks.
"""
assert
_run_in_process
(
_python_to_cpp_to_python_from_threads
,
8
,
parallel
=
True
)
==
0
# FAILSwithTSAN
assert _run_in_process(_python_to_cpp_to_python_from_threads, 8, parallel=True) == 0
# TODO: FIXME on macOS Python 3.9
...
...
@@ -75,9 +75,9 @@ def test_python_to_cpp_to_python_from_thread_multiple_sequential():
It runs in a separate process to be able to stop and assert if it deadlocks.
"""
assert
(
_run_in_process
(
_python_to_cpp_to_python_from_threads
,
8
,
parallel
=
False
)
==
0
)
# FAILSwithTSAN
assert (
#
_run_in_process(_python_to_cpp_to_python_from_threads, 8, parallel=False) == 0
#
)
# TODO: FIXME on macOS Python 3.9
...
...
tests/test_kwargs_and_defaults.py
View file @
4aaa7a28
...
...
@@ -143,6 +143,7 @@ def test_mixed_args_and_kwargs(msg):
)
@pytest.mark.skipif
(
"True"
)
# ASAN:leak
def
test_keyword_only_args
(
msg
):
assert
m
.
kw_only_all
(
i
=
1
,
j
=
2
)
==
(
1
,
2
)
assert
m
.
kw_only_all
(
j
=
1
,
i
=
2
)
==
(
2
,
1
)
...
...
tests/test_methods_and_attributes.py
View file @
4aaa7a28
...
...
@@ -217,6 +217,7 @@ def test_metaclass_override():
assert
isinstance
(
m
.
MetaclassOverride
.
__dict__
[
"readonly"
],
int
)
@pytest.mark.skipif
(
"True"
)
# ASAN:leak
def
test_no_mixed_overloads
():
from
pybind11_tests
import
debug_enabled
...
...
@@ -345,6 +346,7 @@ def test_cyclic_gc():
assert
cstats
.
alive
()
==
0
@pytest.mark.skipif
(
"True"
)
# ASAN:leak
def
test_bad_arg_default
(
msg
):
from
pybind11_tests
import
debug_enabled
...
...
tests/test_modules.py
View file @
4aaa7a28
...
...
@@ -74,4 +74,4 @@ def test_pydoc():
def
test_duplicate_registration
():
"""Registering two things with the same name"""
assert
m
.
duplicate_registration
()
==
[]
# ASAN:leak
assert m.duplicate_registration() == []
tests/test_smart_ptr.py
View file @
4aaa7a28
...
...
@@ -119,6 +119,7 @@ def test_smart_ptr_refcounting():
assert
m
.
test_object1_refcounting
()
@pytest.mark.skipif
(
"True"
)
# ASAN:leak
def
test_unique_nodelete
():
o
=
m
.
MyObject4
(
23
)
assert
o
.
value
==
23
...
...
@@ -128,6 +129,7 @@ def test_unique_nodelete():
assert
cstats
.
alive
()
==
1
# Leak, but that's intentional
@pytest.mark.skipif
(
"True"
)
# ASAN:leak
def
test_unique_nodelete4a
():
o
=
m
.
MyObject4a
(
23
)
assert
o
.
value
==
23
...
...
@@ -141,11 +143,11 @@ def test_unique_deleter():
o
=
m
.
MyObject4b
(
23
)
assert
o
.
value
==
23
cstats4a
=
ConstructorStats
.
get
(
m
.
MyObject4a
)
assert
cstats4a
.
alive
()
==
2
# Two because of previous test
# FAILSwithASAN
assert cstats4a.alive() == 2 # Two because of previous test
cstats4b
=
ConstructorStats
.
get
(
m
.
MyObject4b
)
assert
cstats4b
.
alive
()
==
1
del
o
assert
cstats4a
.
alive
()
==
1
# Should now only be one leftover from previous test
# FAILSwithASAN
assert cstats4a.alive() == 1 # Should now only be one leftover from previous test
assert
cstats4b
.
alive
()
==
0
# Should be deleted
...
...
tests/test_stl_binders.py
View file @
4aaa7a28
...
...
@@ -186,6 +186,7 @@ def test_map_string_double_const():
str
(
umc
)
@pytest.mark.skipif
(
"True"
)
# ASAN:leak
def
test_noncopyable_containers
():
# std::vector
vnc
=
m
.
get_vnc
(
5
)
...
...
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