[Libreoffice-commits] core.git: solenv/gbuild

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 24 18:38:42 UTC 2020


 solenv/gbuild/CppunitTest.mk |    7 +++++++
 solenv/gbuild/PythonTest.mk  |    6 ++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

New commits:
commit 5d67dcc922f831d91424cae8d8758f067a6781b0
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Sep 24 17:44:23 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Sep 24 20:37:56 2020 +0200

    PythonTest CPPUNITTRACE='gdb --args' needs to tunnel setting LD_LIBRARY_PATH
    
    ...so that it doesn't affect gdb itself, just like CppunitTest already did.
    Otherwise, e.g.
    
      make PythonTest_sc_python CPPUNITTRACE='gdb --args'
    
    in a Linux ASan and --enable-python=fully-internal build on Fedora 32 would fail
    with
    
    > gdb: symbol lookup error: instdir/program/libpython3.8.so.1.0: undefined symbol: __asan_option_detect_stack_use_after_return
    
    as /usr/bin/gdb would try to use LO's instdir/program/libpython3.8.so.1.0
    instead of /usr/lib64/libpython3.8.so.1.0.
    
    So, at least on Linux, the gb_PythonTest_PRECOMMAND settings are now passed into
    the test process either directly upfront (if gb_PythonTest_GDBTRACE is not set)
    or tunneled past gdb via gb_PythonTest_GDBTRACE (if it is set).  At least on
    some platforms, gb_PythonTest_PRECOMMAND has a different value than
    gb_CppunitTest_CPPTESTPRECOMMAND, so gb_CppunitTest_GDBTRACE would reflect the
    settings from gb_CppunitTest_CPPTESTPRECOMMAND but not from
    gb_PythonTest_PRECOMMAND, so introduce a new gb_PythonTest_GDBTRACE (which is to
    gb_PythonTest_PRECOMMAND what gb_CppunitTest_GDBTRACE is to
    gb_CppunitTest_CPPTESTPRECOMMAND).
    
    macOS with its split gb_CppunitTest_{,PRE,POST}GDBTRACE variables will likely
    need some work to adopt that to PythonTest, but which is rather orthogonal to
    this change, so just note that as a TODO for now.
    
    Change-Id: I7e6681de638095cb58b44de381248ae7326ce412
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103345
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 356b4317ab4f..cd28e578cc1e 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -28,14 +28,21 @@ ifneq ($(filter gdb,$(CPPUNITTRACE)),)
 gb_CppunitTest_GDBTRACE := $(subst gdb,\
 	gdb -return-child-result -ex "add-auto-load-safe-path $(INSTDIR)" -ex "set environment $(subst =, ,$(gb_CppunitTest_CPPTESTPRECOMMAND))" $(gb_CppunitTest_malloc_check) $(gb_CppunitTest_DEBUGCPPUNIT),\
 	$(CPPUNITTRACE))
+gb_PythonTest_GDBTRACE := $(subst gdb,\
+	gdb -return-child-result -ex "add-auto-load-safe-path $(INSTDIR)" -ex "set environment $(subst =, ,$(gb_PythonTest_PRECOMMAND))" $(gb_CppunitTest_malloc_check) $(gb_CppunitTest_DEBUGCPPUNIT),\
+	$(CPPUNITTRACE))
 else ifneq ($(filter lldb,$(CPPUNITTRACE)),)
 gb_CppunitTest_PREGDBTRACE := lo_dyldpathfile=$(call var2file,$(shell $(gb_MKTEMP)),500,settings set target.env-vars $(gb_CppunitTest_CPPTESTPRECOMMAND))
 gb_CppunitTest_GDBTRACE := $(subst lldb,\
 	lldb -s $$lo_dyldpathfile $(gb_CppunitTest_malloc_check),\
 	$(CPPUNITTRACE))
 gb_CppunitTest_POSTGDBTRACE := rm $$lo_dyldpathfile
+#TODO: PythonTest.mk probably needs to handle gb_CppunitTest_PREGDBTRACE and
+# gb_CppunitTest_POSTGDBTRACE in addition to gb_PythonTest_GDBTRACE (aka gb_CppunitTest_GDBTRACE):
+gb_PythonTest_GDBTRACE := $(gb_CppunitTest_GDBTRACE)
 else
 gb_CppunitTest_GDBTRACE := $(CPPUNITTRACE)
+gb_PythonTest_GDBTRACE := $(gb_CppunitTest_GDBTRACE)
 endif
 ifneq ($(strip $(DEBUGCPPUNIT)),TRUE)
 gb_CppunitTest__interactive := $(true)
diff --git a/solenv/gbuild/PythonTest.mk b/solenv/gbuild/PythonTest.mk
index 52ecbffe7f1c..998df0767d2c 100644
--- a/solenv/gbuild/PythonTest.mk
+++ b/solenv/gbuild/PythonTest.mk
@@ -9,6 +9,8 @@
 
 # PythonTest class
 
+# (gb_PythonTest_GDBTRACE is defined alongside gb_CppunitTest_GDBTRACE in CppunitTest.mk)
+
 gb_PythonTest_UNITTESTFAILED ?= $(GBUILDDIR)/platform/unittest-failed-default.sh
 
 ifeq ($(SYSTEM_PYTHON),)
@@ -46,7 +48,7 @@ else
 		$(if $(gb_CppunitTest__interactive),, \
 			$(if $(value gb_CppunitTest_postprocess), \
 				rm -fr $@.core && mkdir $@.core && cd $@.core &&)) \
-		($(gb_PythonTest_PRECOMMAND) \
+		($(if $(filter gdb,$(gb_PythonTest_GDBTRACE)),,$(gb_PythonTest_PRECOMMAND)) \
 		$(if $(G_SLICE),G_SLICE=$(G_SLICE)) \
 		$(if $(GLIBCXX_FORCE_NEW),GLIBCXX_FORCE_NEW=$(GLIBCXX_FORCE_NEW)) \
 		$(DEFS) \
@@ -57,7 +59,7 @@ else
 		TestUserDir="$(call gb_Helper_make_url,$(dir $(call gb_PythonTest_get_target,$*)))" \
 		PYTHONDONTWRITEBYTECODE=1 \
 		$(gb_TEST_ENV_VARS) \
-		$(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_RR) \
+		$(ICECREAM_RUN) $(gb_PythonTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_RR) \
 			$(gb_PythonTest_COMMAND) \
 			$(if $(PYTHON_TEST_NAME),$(PYTHON_TEST_NAME),$(MODULES)) \
 		$(if $(gb_CppunitTest__interactive),, \


More information about the Libreoffice-commits mailing list