Blame SOURCES/0099-sal-don-t-use-target-as-parameter-to-cppunittester.patch

f325b2
From 929bef368a34b4df91ff6595de9cb3304ef02c99 Mon Sep 17 00:00:00 2001
f325b2
From: Michael Stahl <mstahl@redhat.com>
f325b2
Date: Mon, 31 Aug 2015 23:09:16 +0200
f325b2
Subject: [PATCH 099/398] sal: don't use --target as parameter to cppunittester
f325b2
f325b2
CppunitTest_libreofficekit_tiledrendering hangs because the soffice_main
f325b2
exits due to the unrecognized command line arg --target.
f325b2
f325b2
Use a -env:VARIABLE argument instead, which is filtered out by
f325b2
rtl_getAppCommandArg() so does not reach the soffice_main code.
f325b2
f325b2
(regression from 87514b0907dfbb479e2646b5ff951c68babf3417)
f325b2
f325b2
Change-Id: I2c801305398dccfb447e4e5c44726f42bf2a72ef
f325b2
(cherry picked from commit d0ebb6e438dc8f7dcb5467ae6f72068cf40dcb7a)
f325b2
---
f325b2
 sal/cppunittester/cppunittester.cxx | 12 ++++++++----
f325b2
 solenv/gbuild/CppunitTest.mk        |  2 +-
f325b2
 2 files changed, 9 insertions(+), 5 deletions(-)
f325b2
f325b2
diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx
f325b2
index ef9212d6a2fa..f2f36af51134 100644
f325b2
--- a/sal/cppunittester/cppunittester.cxx
f325b2
+++ b/sal/cppunittester/cppunittester.cxx
f325b2
@@ -361,15 +361,19 @@ SAL_IMPLEMENT_MAIN()
f325b2
         std::string args;
f325b2
         std::string testlib;
f325b2
         sal_uInt32 index = 0;
f325b2
-        while (index < rtl_getAppCommandArgCount())
f325b2
+        while (index < osl_getCommandArgCount())
f325b2
         {
f325b2
             rtl::OUString arg = getArgument(index);
f325b2
-            if (arg == "--target")
f325b2
+            if (arg.startsWith("-env:CPPUNITTESTTARGET=", &path))
f325b2
             {
f325b2
-                path = getArgument(++index);
f325b2
                 ++index;
f325b2
                 continue;
f325b2
             }
f325b2
+            if (arg.startsWith("-env:"))
f325b2
+            {
f325b2
+                ++index;
f325b2
+                continue; // ignore it here - will be read later
f325b2
+            }
f325b2
             if ( arg != "--protector" )
f325b2
             {
f325b2
                 if (testlib.empty())
f325b2
@@ -385,7 +389,7 @@ SAL_IMPLEMENT_MAIN()
f325b2
                 ++index;
f325b2
                 continue;
f325b2
             }
f325b2
-            if (rtl_getAppCommandArgCount() - index < 3) {
f325b2
+            if (osl_getCommandArgCount() - index < 3) {
f325b2
                 usageFailure();
f325b2
             }
f325b2
             rtl::OUString lib(getArgument(index + 1));
f325b2
diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
f325b2
index 944a87ab612d..bbd7370b655d 100644
f325b2
--- a/solenv/gbuild/CppunitTest.mk
f325b2
+++ b/solenv/gbuild/CppunitTest.mk
f325b2
@@ -101,7 +101,7 @@ $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_RUNTIMEDEPS)
f325b2
 			PYTHONDONTWRITEBYTECODE=1) \
f325b2
 		$(ICECREAM_RUN) $(gb_CppunitTest_GDBTRACE) $(gb_CppunitTest_VALGRINDTOOL) $(gb_CppunitTest_CPPTESTCOMMAND) \
f325b2
 		$(call gb_LinkTarget_get_target,$(call gb_CppunitTest_get_linktarget,$*)) \
f325b2
-		$(call gb_CppunitTest__make_args) --target $@ \
f325b2
+		$(call gb_CppunitTest__make_args) "-env:CPPUNITTESTTARGET=$@" \
f325b2
 		$(if $(gb_CppunitTest__interactive),, \
f325b2
 			> $@.log 2>&1 \
f325b2
 			|| ($(if $(value gb_CppunitTest_postprocess), \
f325b2
-- 
f325b2
2.12.0
f325b2