mirror of
https://github.com/pybind/pybind11.git
synced 2025-01-19 17:32:37 +00:00
Trying a new direction: show compiler info & std for UNEXPECTED: type_caster_odr_violation_detected_count() == 0
This commit is contained in:
parent
0c0f322e23
commit
0d2bf264c8
@ -546,7 +546,6 @@ add_custom_target(
|
|||||||
--suppressions="${CMAKE_CURRENT_SOURCE_DIR}/valgrind-python.supp"
|
--suppressions="${CMAKE_CURRENT_SOURCE_DIR}/valgrind-python.supp"
|
||||||
--suppressions="${CMAKE_CURRENT_SOURCE_DIR}/valgrind-numpy-scipy.supp"
|
--suppressions="${CMAKE_CURRENT_SOURCE_DIR}/valgrind-numpy-scipy.supp"
|
||||||
--gen-suppressions=all
|
--gen-suppressions=all
|
||||||
env PYBIND11_TESTING_WITH_VALGRIND=1
|
|
||||||
${PYTHON_EXECUTABLE} -m pytest ${PYBIND11_ABS_PYTEST_FILES}
|
${PYTHON_EXECUTABLE} -m pytest ${PYBIND11_ABS_PYTEST_FILES}
|
||||||
DEPENDS ${test_targets}
|
DEPENDS ${test_targets}
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
|
||||||
|
@ -197,9 +197,10 @@ def gc_collect():
|
|||||||
|
|
||||||
def pytest_configure():
|
def pytest_configure():
|
||||||
print(
|
print(
|
||||||
"PYBIND11_INTERNALS_ID & C++ Version:",
|
"C++ Info:",
|
||||||
|
pybind11_tests.compiler_info,
|
||||||
|
pybind11_tests.cpp_std,
|
||||||
pybind11_tests.PYBIND11_INTERNALS_ID,
|
pybind11_tests.PYBIND11_INTERNALS_ID,
|
||||||
pybind11_tests.cpp_version_in_use,
|
|
||||||
flush=True,
|
flush=True,
|
||||||
)
|
)
|
||||||
pytest.suppress = suppress
|
pytest.suppress = suppress
|
||||||
|
@ -62,7 +62,7 @@ void bind_ConstructorStats(py::module_ &m) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *cpp_version_in_use() {
|
const char *cpp_std() {
|
||||||
return
|
return
|
||||||
#if defined(PYBIND11_CPP20)
|
#if defined(PYBIND11_CPP20)
|
||||||
"C++20";
|
"C++20";
|
||||||
@ -78,7 +78,14 @@ const char *cpp_version_in_use() {
|
|||||||
PYBIND11_MODULE(pybind11_tests, m) {
|
PYBIND11_MODULE(pybind11_tests, m) {
|
||||||
m.doc() = "pybind11 test module";
|
m.doc() = "pybind11 test module";
|
||||||
|
|
||||||
m.attr("cpp_version_in_use") = cpp_version_in_use();
|
#if defined(_MSC_FULL_VER)
|
||||||
|
m.attr("compiler_info") = "MSVC " _MSC_FULL_VER;
|
||||||
|
#elif defined(__VERSION__)
|
||||||
|
m.attr("compiler_info") = __VERSION__;
|
||||||
|
#else
|
||||||
|
m.attr("compiler_info") = py::none();
|
||||||
|
#endif
|
||||||
|
m.attr("cpp_std") = cpp_std();
|
||||||
m.attr("PYBIND11_INTERNALS_ID") = PYBIND11_INTERNALS_ID;
|
m.attr("PYBIND11_INTERNALS_ID") = PYBIND11_INTERNALS_ID;
|
||||||
|
|
||||||
bind_ConstructorStats(m);
|
bind_ConstructorStats(m);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
import pybind11_tests
|
||||||
import pybind11_tests.type_caster_odr_guard_1 as m
|
import pybind11_tests.type_caster_odr_guard_1 as m
|
||||||
|
|
||||||
|
|
||||||
@ -37,12 +36,10 @@ def test_type_caster_odr_violation_detected_counter():
|
|||||||
num_violations = m.type_caster_odr_violation_detected_count()
|
num_violations = m.type_caster_odr_violation_detected_count()
|
||||||
if num_violations is None:
|
if num_violations is None:
|
||||||
pytest.skip("type_caster_odr_violation_detected_count() is None")
|
pytest.skip("type_caster_odr_violation_detected_count() is None")
|
||||||
elif (
|
elif num_violations == 0:
|
||||||
os.environ.get("PYBIND11_TESTING_WITH_VALGRIND") is not None
|
|
||||||
and num_violations == 0
|
|
||||||
):
|
|
||||||
pytest.skip(
|
pytest.skip(
|
||||||
"UNEXPECTED: type_caster_odr_violation_detected_count() == 0 (valgrind)"
|
"UNEXPECTED: type_caster_odr_violation_detected_count() == 0 (%s %s)"
|
||||||
|
% (pybind11_tests.compiler_info, pybind11_tests.cpp_std)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
assert num_violations == 1
|
assert num_violations == 1
|
||||||
|
Loading…
Reference in New Issue
Block a user