diff --git a/cpp/src/arrow/config.cc b/cpp/src/arrow/config.cc index b93f207161d..93df10b097c 100644 --- a/cpp/src/arrow/config.cc +++ b/cpp/src/arrow/config.cc @@ -43,6 +43,7 @@ const BuildInfo kBuildInfo = { ARROW_GIT_ID, ARROW_GIT_DESCRIPTION, ARROW_PACKAGE_KIND, + ARROW_BUILD_TYPE, // clang-format on }; diff --git a/cpp/src/arrow/config.h b/cpp/src/arrow/config.h index 5ae7e223164..a485b91a4a5 100644 --- a/cpp/src/arrow/config.h +++ b/cpp/src/arrow/config.h @@ -37,12 +37,20 @@ struct BuildInfo { std::string version_string; std::string so_version; std::string full_so_version; + + /// The CMake compiler identifier, e.g. "GNU" std::string compiler_id; std::string compiler_version; std::string compiler_flags; + + /// The git changeset id, if available std::string git_id; + /// The git changeset description, if available std::string git_description; std::string package_kind; + + /// The uppercase build type, e.g. "DEBUG" or "RELEASE" + std::string build_type; }; struct RuntimeInfo { diff --git a/cpp/src/arrow/util/config.h.cmake b/cpp/src/arrow/util/config.h.cmake index d8d7e6e6d80..3246eb134ae 100644 --- a/cpp/src/arrow/util/config.h.cmake +++ b/cpp/src/arrow/util/config.h.cmake @@ -29,6 +29,8 @@ #define ARROW_CXX_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@" #define ARROW_CXX_COMPILER_FLAGS "@CMAKE_CXX_FLAGS@" +#define ARROW_BUILD_TYPE "@UPPERCASE_BUILD_TYPE@" + #define ARROW_GIT_ID "@ARROW_GIT_ID@" #define ARROW_GIT_DESCRIPTION "@ARROW_GIT_DESCRIPTION@" diff --git a/dev/release/verify-release-candidate.sh b/dev/release/verify-release-candidate.sh index cf6f2ab010d..b554e59e9e1 100755 --- a/dev/release/verify-release-candidate.sh +++ b/dev/release/verify-release-candidate.sh @@ -389,6 +389,8 @@ test_csharp() { test_python() { pushd python + export PYARROW_PARALLEL=$NPROC + export PYARROW_WITH_DATASET=1 export PYARROW_WITH_PARQUET=1 export PYARROW_WITH_PLASMA=1 @@ -567,6 +569,7 @@ ensure_source_directory() { export ARROW_DIR=$PWD export ARROW_TEST_DATA=$PWD/testing/data export PARQUET_TEST_DATA=$PWD/cpp/submodules/parquet-testing/data + export ARROW_GDB_SCRIPT=$PWD/cpp/gdb_arrow.py popd } diff --git a/dev/tasks/python-wheels/github.osx.arm64.yml b/dev/tasks/python-wheels/github.osx.arm64.yml index e5763f46980..efcd55bbdba 100644 --- a/dev/tasks/python-wheels/github.osx.arm64.yml +++ b/dev/tasks/python-wheels/github.osx.arm64.yml @@ -32,7 +32,6 @@ env: CXX: "clang++" MACOSX_DEPLOYMENT_TARGET: "{{ macos_deployment_target }}" PYARROW_BUILD_VERBOSE: 1 - PYARROW_TEST_GDB: "OFF" PYARROW_VERSION: "{{ arrow.no_rc_version }}" PYTHON_VERSION: "{{ python_version }}" PYTHON: "/Library/Frameworks/Python.framework/Versions/{{ python_version }}/bin/python{{ python_version }}" diff --git a/python/pyarrow/__init__.py b/python/pyarrow/__init__.py index 98604199e4f..244c82e1e42 100644 --- a/python/pyarrow/__init__.py +++ b/python/pyarrow/__init__.py @@ -90,6 +90,7 @@ def print_entry(label, value): print_entry("Arrow C++ compiler flags", cpp_build_info.compiler_flags) print_entry("Arrow C++ git revision", cpp_build_info.git_id) print_entry("Arrow C++ git description", cpp_build_info.git_description) + print_entry("Arrow C++ build type", cpp_build_info.build_type) def _module_is_available(module): diff --git a/python/pyarrow/config.pxi b/python/pyarrow/config.pxi index fc88c28d6ef..fb9526ba897 100644 --- a/python/pyarrow/config.pxi +++ b/python/pyarrow/config.pxi @@ -26,7 +26,7 @@ BuildInfo = namedtuple( 'BuildInfo', ('version', 'version_info', 'so_version', 'full_so_version', 'compiler_id', 'compiler_version', 'compiler_flags', - 'git_id', 'git_description', 'package_kind')) + 'git_id', 'git_description', 'package_kind', 'build_type')) RuntimeInfo = namedtuple('RuntimeInfo', ('simd_level', 'detected_simd_level')) @@ -48,7 +48,9 @@ cdef _build_info(): compiler_flags=frombytes(c_info.compiler_flags), git_id=frombytes(c_info.git_id), git_description=frombytes(c_info.git_description), - package_kind=frombytes(c_info.package_kind)) + package_kind=frombytes(c_info.package_kind), + build_type=frombytes(c_info.build_type).lower(), + ) cpp_build_info = _build_info() diff --git a/python/pyarrow/includes/libarrow.pxd b/python/pyarrow/includes/libarrow.pxd index 514aaef3e06..525ee88d0d2 100644 --- a/python/pyarrow/includes/libarrow.pxd +++ b/python/pyarrow/includes/libarrow.pxd @@ -69,6 +69,7 @@ cdef extern from "arrow/config.h" namespace "arrow" nogil: c_string git_id c_string git_description c_string package_kind + c_string build_type const CBuildInfo& GetBuildInfo() diff --git a/python/pyarrow/tests/test_gdb.py b/python/pyarrow/tests/test_gdb.py index 273464f363c..f2933369f63 100644 --- a/python/pyarrow/tests/test_gdb.py +++ b/python/pyarrow/tests/test_gdb.py @@ -24,6 +24,8 @@ import pytest +import pyarrow as pa + pytestmark = pytest.mark.gdb @@ -40,8 +42,11 @@ @lru_cache() def is_gdb_available(): try: + # Try to use the same arguments as in GdbSession so that the + # same error return gets propagated. proc = subprocess.run(gdb_command + ["--version"], - stdin=subprocess.DEVNULL, + env={}, bufsize=0, + stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) except FileNotFoundError: @@ -176,8 +181,19 @@ def gdb(): @pytest.fixture(scope='session') def gdb_arrow(gdb): + if 'deb' not in pa.cpp_build_info.build_type: + pytest.skip("Arrow C++ debug symbols not available") + skip_if_gdb_script_unavailable() gdb.run_command(f"source {gdb_script}") + + lib_path_var = 'PATH' if sys.platform == 'win32' else 'LD_LIBRARY_PATH' + lib_path = os.environ.get(lib_path_var) + if lib_path: + # GDB starts the inferior process in a pristine shell, need + # to propagate the library search path to find the Arrow DLL + gdb.run_command(f"set env {lib_path_var} {lib_path}") + code = "from pyarrow.lib import _gdb_test_session; _gdb_test_session()" out = gdb.run_command(f"run -c '{code}'") assert ("Trace/breakpoint trap" in out or diff --git a/python/pyarrow/tests/test_misc.py b/python/pyarrow/tests/test_misc.py index 012f15e16be..f3409828763 100644 --- a/python/pyarrow/tests/test_misc.py +++ b/python/pyarrow/tests/test_misc.py @@ -62,6 +62,9 @@ def test_build_info(): assert isinstance(pa.__version__, str) assert pa.cpp_build_info.version_info == pa.cpp_version_info + assert pa.cpp_build_info.build_type in ( + 'debug', 'release', 'minsizerel', 'relwithdebinfo') + # assert pa.version == pa.__version__ # XXX currently false