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

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