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

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Tue Nov 17 01:35:34 PST 2015


 solenv/bin/unittest-failed.sh                     |   51 ----------------------
 solenv/gbuild/CppunitTest.mk                      |   15 ++----
 solenv/gbuild/PythonTest.mk                       |   11 +---
 solenv/gbuild/platform/com_MSC_class.mk           |    3 +
 solenv/gbuild/platform/macosx.mk                  |    3 +
 solenv/gbuild/platform/unittest-failed-MACOSX.sh  |   29 ++++++++++++
 solenv/gbuild/platform/unittest-failed-WNT.sh     |   29 ++++++++++++
 solenv/gbuild/platform/unittest-failed-default.sh |   30 ++++++++++++
 8 files changed, 103 insertions(+), 68 deletions(-)

New commits:
commit 474f5eebb8d86df3384ddecac1452c85524b0c28
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Sat Nov 14 02:21:27 2015 +0100

    refactor unittest help message
    
    - get platform switch logic out of shell script
    - platform specific stuff should be in $(GBUILDDIR)/platform, if
      possible
    - do not suggest shell-polluting exports, which might lead to confusion
      later, suggest setting the var as a one-off addition to the make
      command
    - move exception caching down, as it is assumed to be used rather
      rarely
    
    Change-Id: I01db3ca07582a6c6213ebac86fddabb28c925d50
    Reviewed-on: https://gerrit.libreoffice.org/19976
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: jan iversen <jani at documentfoundation.org>
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 15b5f8a22..93aa1a3 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -19,6 +19,9 @@
 
 # CppunitTest class
 
+gb_CppunitTest_UNITTESTFAILED ?= $(GBUILDDIR)/platform/unittest-failed-default.sh
+gb_CppunitTest_PYTHONDEPS ?= $(call gb_Library_get_target,pyuno_wrapper) $(if $(SYSTEM_PYTHON),,$(call gb_Package_get_target,python3))
+
 ifeq ($(strip $(DEBUGCPPUNIT)),TRUE)
 gb_CppunitTest_GDBTRACE := gdb -nx -ex "add-auto-load-safe-path $(INSTDIR)" --batch --command=$(SRCDIR)/solenv/bin/gdbtrycatchtrace-stdout -return-child-result --args
 else ifneq ($(strip $(CPPUNITTRACE)),)
@@ -108,7 +111,7 @@ $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_RUNTIMEDEPS)
 			|| ($(if $(value gb_CppunitTest_postprocess), \
 					RET=$$?; \
 					$(call gb_CppunitTest_postprocess,$(gb_CppunitTest_CPPTESTCOMMAND),$@.core,$$RET) >> $@.log 2>&1;) \
-				cat $@.log; $(SRCDIR)/solenv/bin/unittest-failed.sh Cppunit $* $(OS)))))
+				cat $@.log; $(gb_CppunitTest_UNITTESTFAILED) Cppunit $*))))
 
 define gb_CppunitTest_CppunitTest
 $(call gb_CppunitTest__CppunitTest_impl,$(1),$(call gb_CppunitTest_get_linktarget,$(1)))
@@ -336,15 +339,7 @@ $(call gb_CppunitTest_get_target,$(1)) : PYTHON_URE := $(true)
 $(call gb_CppunitTest_get_target,$(1)) :\
 	$(call gb_Library_get_target,pythonloader) \
 	$(call gb_Library_get_target,pyuno) \
-	$(if $(filter-out WNT,$(OS)),\
-		$(call gb_Library_get_target,pyuno_wrapper) \
-	) \
-	$(if $(SYSTEM_PYTHON),, \
-		$(if $(filter MACOSX,$(OS)),\
-			$(call gb_GeneratedPackage_get_target,python3),\
-			$(call gb_Package_get_target,python3) \
-		) \
-	) \
+	$(gb_CppunitTest_PYTHONDEPS) \
 	$(call gb_Package_get_target,pyuno_python_scripts)
 
 endef
diff --git a/solenv/gbuild/PythonTest.mk b/solenv/gbuild/PythonTest.mk
index 561ea64..eeff6a0 100644
--- a/solenv/gbuild/PythonTest.mk
+++ b/solenv/gbuild/PythonTest.mk
@@ -9,15 +9,12 @@
 
 # PythonTest class
 
+gb_PythonTest_UNITTESTFAILED ?= $(GBUILDDIR)/platform/unittest-failed-default.sh
+
 ifeq ($(SYSTEM_PYTHON),)
 gb_PythonTest_EXECUTABLE := $(gb_Python_INSTALLED_EXECUTABLE)
 gb_PythonTest_EXECUTABLE_GDB := $(gb_Python_INSTALLED_EXECUTABLE_GDB)
-ifeq ($(OS),MACOSX)
-gb_PythonTest_DEPS := $(call gb_GeneratedPackage_get_target,python3)
-else
-gb_PythonTest_DEPS := $(call gb_Package_get_target,python3)
-endif
-gb_PythonTest_DEPS += $(if $(filter-out WNT,$(OS)),$(call gb_Package_get_target,python_shell))
+gb_PythonTest_DEPS ?= $(call gb_Package_get_target,python3) $(call gb_Package_get_target,python_shell)
 else
 gb_PythonTest_EXECUTABLE := $(PYTHON_FOR_BUILD)
 gb_PythonTest_EXECUTABLE_GDB := $(PYTHON_FOR_BUILD)
@@ -63,7 +60,7 @@ $(call gb_PythonTest_get_target,%) :| $(gb_PythonTest_DEPS)
 			|| ($(if $(value gb_CppunitTest_postprocess), \
 					RET=$$?; \
 					$(call gb_CppunitTest_postprocess,$(gb_PythonTest_EXECUTABLE_GDB),$@.core,$$RET) >> $@.log 2>&1;) \
-				cat $@.log; $(SRCDIR)/solenv/bin/unittest-failed.sh Python $*))))
+				cat $@.log; $(gb_PythonTest_UNITTESTFAILED) Python $*))))
 
 # always use udkapi and URE services
 define gb_PythonTest_PythonTest
diff --git a/solenv/gbuild/platform/com_MSC_class.mk b/solenv/gbuild/platform/com_MSC_class.mk
index 14febde..41bab51 100644
--- a/solenv/gbuild/platform/com_MSC_class.mk
+++ b/solenv/gbuild/platform/com_MSC_class.mk
@@ -370,6 +370,8 @@ endef
 
 # CppunitTest class
 
+gb_CppunitTest_UNITTESTFAILED := $(GBUILDDIR)/platform/unittest-failed-WNT.sh
+gb_CppunitTest_PYTHONDEPS := $(call gb_Package_get_target,python3)
 gb_CppunitTest_DEFS := -D_DLL
 ifeq ($(GNUMAKE_WIN_NATIVE),TRUE)
 gb_CppunitTest_CPPTESTPRECOMMAND := $(call gb_Helper_prepend_ld_path,$(shell cygpath -w $(gb_Library_DLLDIR));$(shell cygpath -w $(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/$(if $(MSVC_USE_DEBUG_RUNTIME),DebugDll,ReleaseDll)))
@@ -435,6 +437,7 @@ endef
 # PythonTest class
 
 gb_PythonTest_PRECOMMAND := $(gb_CppunitTest_CPPTESTPRECOMMAND)
+gb_PythonTest_DEPS := $(call gb_Package_get_target,python3)
 
 # SrsPartTarget class
 
diff --git a/solenv/gbuild/platform/macosx.mk b/solenv/gbuild/platform/macosx.mk
index 0652062..c428527 100644
--- a/solenv/gbuild/platform/macosx.mk
+++ b/solenv/gbuild/platform/macosx.mk
@@ -265,6 +265,8 @@ endef
 
 # CppunitTest class
 
+gb_CppunitTest_UNITTESTFAILED := $(GBUILDDIR)/platform/unittest-failed-MACOSX.mk
+gb_CppunitTest_PYTHONDEPS := $(call gb_Library_get_target,pyuno_wrapper) $(if $(SYSTEM_PYTHON),,$(call gb_GeneratedPackage_get_target,python3))
 gb_CppunitTest_CPPTESTPRECOMMAND := \
 	$(call gb_Helper_extend_ld_path,$(gb_Library_DLLDIR):$(WORKDIR)/UnpackedTarball/cppunit/src/cppunit/.libs)
 gb_CppunitTest_get_filename = libtest_$(1).dylib
@@ -299,6 +301,7 @@ endef
 
 # PythonTest class
 
+gb_PythonTest_UNITTESTFAILED := $(GBUILDDIR)/platform/unittest-failed-MACOSX.mk
 gb_PythonTest_PRECOMMAND := $(gb_Helper_LIBRARY_PATH_VAR)=$${$(gb_Helper_LIBRARY_PATH_VAR):+$$$(gb_Helper_LIBRARY_PATH_VAR):}$(INSTROOT)/$(LIBO_URE_LIB_FOLDER)
 ifneq ($(LIBO_LIB_FOLDER),$(LIBO_URE_LIB_FOLDER))
 gb_PythonTest_PRECOMMAND := $(gb_PythonTest_PRECOMMAND):$(INSTROOT)/$(LIBO_LIB_FOLDER)
diff --git a/solenv/bin/unittest-failed.sh b/solenv/gbuild/platform/unittest-failed-MACOSX.sh
similarity index 55%
rename from solenv/bin/unittest-failed.sh
rename to solenv/gbuild/platform/unittest-failed-MACOSX.sh
index e6cf433..2a0ebab 100755
--- a/solenv/bin/unittest-failed.sh
+++ b/solenv/gbuild/platform/unittest-failed-MACOSX.sh
@@ -16,33 +16,11 @@
 #   License, Version 2.0 (the "License"); you may not use this file
 #   except in compliance with the License. You may obtain a copy of
 #   the License at http://www.apache.org/licenses/LICENSE-2.0 .
-
-DEBUGGING=
-
-if [ "$3" = "WNT" ]; then
-    DEBUGGING='
-export CPPUNITTRACE="'$DEVENV' /debugexe" # for interactive debugging in Visual Studio
-export CPPUNITTRACE="drmemory -free_max_frames 20"            # for memory checking (install Dr.Memory first, and put it to your PATH)
-'
-elif [ "$3" = "MACOSX" ]; then
-    DEBUGGING='
-export CPPUNITTRACE="lldb --"       # for interactive debugging on OS X
-export VALGRIND=memcheck            # for memory checking
-'
-else
-    DEBUGGING='
-export DEBUGCPPUNIT=TRUE            # for exception catching
-export CPPUNITTRACE="gdb --args"    # for interactive debugging on Linux
-export VALGRIND=memcheck            # for memory checking
-'
-fi
-
-# print the actual error message
 cat << EOF
 
 Error: a unit test failed, please do one of:
-$DEBUGGING
-and retry using: make $1Test_$2
+make $1Test_$2 CPPUNITTRACE="lldb --"       # for interactive debugging on OS X
+make $1Test_$2 VALGRIND=memcheck            # for memory checking
 
 EOF
 
diff --git a/solenv/gbuild/platform/unittest-failed-WNT.sh b/solenv/gbuild/platform/unittest-failed-WNT.sh
new file mode 100755
index 0000000..9ac742b
--- /dev/null
+++ b/solenv/gbuild/platform/unittest-failed-WNT.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+# -*- Mode: sh; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements. See the NOTICE file distributed
+#   with this work for additional information regarding copyright
+#   ownership. The ASF licenses this file to you under the Apache
+#   License, Version 2.0 (the "License"); you may not use this file
+#   except in compliance with the License. You may obtain a copy of
+#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+cat << EOF
+
+Error: a unit test failed, please do one of:
+make $1Test_$2 CPPUNITTRACE="'$DEVENV' /debugexe" # for interactive debugging in Visual Studio
+make $1Test_$2 CPPUNITTRACE="drmemory -free_max_frames 20" # for memory checking (install Dr.Memory first, and put it to your PATH)
+
+EOF
+
+exit 1
+
+# vim: set et sw=4:
diff --git a/solenv/gbuild/platform/unittest-failed-default.sh b/solenv/gbuild/platform/unittest-failed-default.sh
new file mode 100755
index 0000000..24718fd9
--- /dev/null
+++ b/solenv/gbuild/platform/unittest-failed-default.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+# -*- Mode: sh; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+# This file incorporates work covered by the following license notice:
+#
+#   Licensed to the Apache Software Foundation (ASF) under one or more
+#   contributor license agreements. See the NOTICE file distributed
+#   with this work for additional information regarding copyright
+#   ownership. The ASF licenses this file to you under the Apache
+#   License, Version 2.0 (the "License"); you may not use this file
+#   except in compliance with the License. You may obtain a copy of
+#   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+cat << EOF
+
+Error: a unit test failed, please do one of:
+make $1Test_$2 CPPUNITTRACE="gdb --args"    # for interactive debugging on Linux
+make $1Test_$2 VALGRIND=memcheck            # for memory checking
+make $1Test_$2 DEBUGCPPUNIT=TRUE            # for exception catching
+
+EOF
+
+exit 1
+
+# vim: set et sw=4:


More information about the Libreoffice-commits mailing list