[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-10 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376936826
 
 

 ##
 File path: src/test/cpp/net/socketserverstarter.cpp
 ##
 @@ -0,0 +1,108 @@
+/*
+ * 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
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../logunit.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+using namespace log4cxx;
+
+LOGUNIT_CLASS(SocketServerStarter)
+{
+   LOGUNIT_TEST_SUITE(SocketServerStarter);
+  LOGUNIT_TEST(startServer);
+   LOGUNIT_TEST_SUITE_END();
+   
+public:
+   void setUp()
+   {
+   }
+
+   void tearDown()
+   {
+   }
+   
+   void startServer()
+   {
+ helpers::Pool p;
+ apr_pool_t* pool = p.getAPRPool();
+ char* cmd = NULL;
+ apr_status_t stat = apr_env_get(, "SOCKET_SERVER_COMMAND", pool);
+
+ if (cmd && *cmd)
 
 Review comment:
   Changed things myself: 
https://github.com/apache/logging-log4cxx/commit/e8fe4890beee121adbd1a78969f792af4b0ad747


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-10 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376911085
 
 

 ##
 File path: src/test/cpp/net/socketserverstarter.cpp
 ##
 @@ -0,0 +1,108 @@
+/*
+ * 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
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../logunit.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+using namespace log4cxx;
+
+LOGUNIT_CLASS(SocketServerStarter)
+{
+   LOGUNIT_TEST_SUITE(SocketServerStarter);
+  LOGUNIT_TEST(startServer);
+   LOGUNIT_TEST_SUITE_END();
+   
+public:
+   void setUp()
+   {
+   }
+
+   void tearDown()
+   {
+   }
+   
+   void startServer()
+   {
+ helpers::Pool p;
+ apr_pool_t* pool = p.getAPRPool();
+ char* cmd = NULL;
+ apr_status_t stat = apr_env_get(, "SOCKET_SERVER_COMMAND", pool);
+
+ if (cmd && *cmd)
+ {
+  // prepare to launch the server
+  //
+  apr_proc_t server_pid;
+  apr_procattr_t* attr = NULL;
+  stat = apr_procattr_create(, pool);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  stat = apr_procattr_io_set(attr, APR_NO_PIPE, APR_NO_PIPE, 
APR_NO_PIPE);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+
+  //fprintf(stdout, "SOCKET_SERVER_COMMAND=%s\n", cmd);
+#ifdef SHELL_CMD_TYPE_WORKS
+  stat = apr_procattr_cmdtype_set(attr, APR_SHELLCMD);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  stat = apr_proc_create(_pid, cmd, NULL, NULL, attr, pool);
+#else
+  stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  // convert the space separated cmd string to the argument list
+  //
+  char** args = (char**)apr_palloc(pool, 15 * sizeof(*args));
+  char* pcmd = apr_pstrdup(pool, cmd);
+  int i = 0;
+  for (; i < 14 && pcmd && *pcmd; ++i)
+  {
+  args[i] = pcmd;
+  if (NULL != (pcmd = strchr(pcmd, ' ')))
 
 Review comment:
   `SOCKET_SERVER_COMMAND` now works for me using the following line:
   
   set SOCKET_SERVER_COMMAND="C:\Program Files\Java\jdk-8\bin\java.exe" 
-classpath "%SOCKET_SERVER_CLASSPATH%" org.apache.log4j.net.ShortSocketServer 8 
input/socketServer


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376907831
 
 

 ##
 File path: src/test/cpp/net/socketservertestcase.cpp
 ##
 @@ -478,4 +477,4 @@ LOGUNIT_CLASS(SocketServerTestCase)
 const File SocketServerTestCase::TEMP("output/temp");
 const File SocketServerTestCase::FILTERED("output/filtered");
 
-LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(SocketServerTestCase)
+LOGUNIT_TEST_SUITE_REGISTRATION(SocketServerTestCase)
 
 Review comment:
   The point is not about different executables, but that this one test case 
only requires additional Java and is difficult to setup. It has been disabled 
in the past for a long time already:
   
   
https://github.com/apache/logging-log4cxx/commit/b279aa7922fe8cbdc3ab2da524e1d6a9ed3913bb#diff-78b9ec5d590a88f742877f2f096c52a9R51


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376811760
 
 

 ##
 File path: src/site/apt/building/vcpkg.apt
 ##
 @@ -0,0 +1,41 @@
+~~ 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
+~~
+~~ Unless required by applicable law or agreed to in writing, software
+~~ distributed under the License is distributed on an "AS IS" BASIS,
+~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~~ See the License for the specific language governing permissions and
+~~ limitations under the License.
+ --
+ Building Apache log4cxx with vcpkg
+ --
+ --
+ --
+
+Building Apache log4cxx with vcpkg
+
+*Preparation
+
+++
+   > git clone https://github.com/Microsoft/vcpkg.git
+   > cd vcpkg
+
+   PS> .\bootstrap-vcpkg.bat
+   Linux:~/$ ./bootstrap-vcpkg.sh
+   
+   Then, to hook up user-wide integration, run (note: requires admin on first 
use)
+
+   PS> .\vcpkg integrate install
+   Linux:~/$ ./vcpkg integrate install
+++
+
+*Building log4cxx.dll
+
+   PS> .\vcpkg install log4cxx
+   Linux:~/$ ./vcpkg install log4cxx
 
 Review comment:
   These two lines don't seem to render as expected:
   
   
![Clipboard02](https://user-images.githubusercontent.com/6223655/74109127-1990b600-4b81-11ea-86ff-9e4618f4ac34.png)
   
   I suggest simply using `++` like above?
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376811526
 
 

 ##
 File path: src/site/apt/building/cmake.apt
 ##
 @@ -0,0 +1,104 @@
+~~ 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
+~~
+~~ Unless required by applicable law or agreed to in writing, software
+~~ distributed under the License is distributed on an "AS IS" BASIS,
+~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~~ See the License for the specific language governing permissions and
+~~ limitations under the License.
+ --
+ Building Apache log4cxx with CMake
+ --
+ --
+ --
+
+* Quick start:
+
+  Building and testing log4cxx on a Unix platform with packaged APR and 
APR-Util.
+
+  Make sure cmake 3.13+, g++ and make are available, install or
+  build apr 1.x, apr-util 1.x, gzip and zip.
+
+++
+$ apt-get install build-essential libapr1-dev libaprutil1-dev gzip zip
+$ cd apache-log4cxx-x.x.x
+$ mkdir build 
+$ cd build
+$ ccmake ..
+$ make
+$ sudo make install
+++
+
+* ccmake options
+*+-+
 
 Review comment:
   A newline is necessary BEFORE the table or it doesn't render properly and is 
instead interpreted as additional text for the headline `ccmake options` .
   
   
![Clipboard02](https://user-images.githubusercontent.com/6223655/74109084-b9017900-4b80-11ea-8115-4cb9728217a4.png)
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376809913
 
 

 ##
 File path: src/site/apt/building/cmake.apt
 ##
 @@ -0,0 +1,104 @@
+~~ 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
+~~
+~~ Unless required by applicable law or agreed to in writing, software
+~~ distributed under the License is distributed on an "AS IS" BASIS,
+~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~~ See the License for the specific language governing permissions and
+~~ limitations under the License.
+ --
+ Building Apache log4cxx with CMake
+ --
+ --
+ --
+
+* Quick start:
 
 Review comment:
   This seems to fail:
   
   [ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project 
apache-log4cxx: Error during page generation: Error parsing 
   
'C:\Users\tschoening\Documents\Svn\Src\Libs\trunk\C++\Logging\log4cxx\0.11.0-SNAPSHOT\src\src\site\apt\building\cmake.apt':
 line [21] expected SECTION1, found SECTION2 -> [Help 1]
   
   Changing to the following works and that approach is uses in the other files 
AFAICS as well:
   
   --
   Building Apache log4cxx with CMake
   --
   --
   --
   
   Building Apache log4cxx with CMake
   
   * Quick start:
   
   You should be able to easily test yourself using `mvn site` in the root of 
the project, where `pom.xml` lives. Might need Doxygen...


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376805122
 
 

 ##
 File path: src/test/java/CMakeLists.txt
 ##
 @@ -0,0 +1,18 @@
+include(FetchContent)
+FetchContent_Declare(log4j
+  URL https://www-us.apache.org/dist/logging/log4j/1.2.17/log4j-1.2.17.tar.gz
+  URL_HASH MD5=8218714e41ee0c6509dcfeafa2e1f53f
+)
+FetchContent_GetProperties(log4j)
+if(NOT log4j_POPULATED)
+  FetchContent_Populate(log4j)
+endif()
+set(log4j_CLASSPATH "${log4j_SOURCE_DIR}/log4j-1.2.17.jar" )
+set(SOCKET_SERVER_SOURCES org/apache/log4j/net/ShortSocketServer.java)
+add_custom_target(test-classes
+  COMMAND ${Java_JAVAC_EXECUTABLE} -d ${CMAKE_CURRENT_BINARY_DIR}
+  --class-path "${log4j_CLASSPATH}" ${SOCKET_SERVER_SOURCES}
 
 Review comment:
   Is `--class-path` CMAKE-spec? Because in my Windows JDK 8 it's name 
`-classpath` or `-cp` only.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376805933
 
 

 ##
 File path: src/test/cpp/net/socketserverstarter.cpp
 ##
 @@ -0,0 +1,108 @@
+/*
+ * 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
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../logunit.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+using namespace log4cxx;
+
+LOGUNIT_CLASS(SocketServerStarter)
+{
+   LOGUNIT_TEST_SUITE(SocketServerStarter);
+  LOGUNIT_TEST(startServer);
+   LOGUNIT_TEST_SUITE_END();
+   
+public:
+   void setUp()
+   {
+   }
+
+   void tearDown()
+   {
+   }
+   
+   void startServer()
+   {
+ helpers::Pool p;
+ apr_pool_t* pool = p.getAPRPool();
+ char* cmd = NULL;
+ apr_status_t stat = apr_env_get(, "SOCKET_SERVER_COMMAND", pool);
+
+ if (cmd && *cmd)
+ {
+  // prepare to launch the server
+  //
+  apr_proc_t server_pid;
+  apr_procattr_t* attr = NULL;
+  stat = apr_procattr_create(, pool);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  stat = apr_procattr_io_set(attr, APR_NO_PIPE, APR_NO_PIPE, 
APR_NO_PIPE);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+
+  //fprintf(stdout, "SOCKET_SERVER_COMMAND=%s\n", cmd);
+#ifdef SHELL_CMD_TYPE_WORKS
+  stat = apr_procattr_cmdtype_set(attr, APR_SHELLCMD);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  stat = apr_proc_create(_pid, cmd, NULL, NULL, attr, pool);
+#else
+  stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  // convert the space separated cmd string to the argument list
+  //
+  char** args = (char**)apr_palloc(pool, 15 * sizeof(*args));
 
 Review comment:
   What's the hard-coded `15` and `14` in the loop for?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376803532
 
 

 ##
 File path: src/test/cpp/net/socketserverstarter.cpp
 ##
 @@ -0,0 +1,108 @@
+/*
+ * 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
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../logunit.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+using namespace log4cxx;
+
+LOGUNIT_CLASS(SocketServerStarter)
+{
+   LOGUNIT_TEST_SUITE(SocketServerStarter);
+  LOGUNIT_TEST(startServer);
+   LOGUNIT_TEST_SUITE_END();
+   
+public:
+   void setUp()
+   {
+   }
+
+   void tearDown()
+   {
+   }
+   
+   void startServer()
+   {
+ helpers::Pool p;
+ apr_pool_t* pool = p.getAPRPool();
+ char* cmd = NULL;
+ apr_status_t stat = apr_env_get(, "SOCKET_SERVER_COMMAND", pool);
+
+ if (cmd && *cmd)
 
 Review comment:
   I would prefer failing fast here by changing the check and aborting early. 
Makes most of the remaining code in case of success less indented and easier to 
read in my opinion.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376806130
 
 

 ##
 File path: src/test/cpp/net/socketserverstarter.cpp
 ##
 @@ -0,0 +1,108 @@
+/*
+ * 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
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../logunit.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+using namespace log4cxx;
+
+LOGUNIT_CLASS(SocketServerStarter)
+{
+   LOGUNIT_TEST_SUITE(SocketServerStarter);
+  LOGUNIT_TEST(startServer);
+   LOGUNIT_TEST_SUITE_END();
+   
+public:
+   void setUp()
+   {
+   }
+
+   void tearDown()
+   {
+   }
+   
+   void startServer()
+   {
+ helpers::Pool p;
+ apr_pool_t* pool = p.getAPRPool();
+ char* cmd = NULL;
+ apr_status_t stat = apr_env_get(, "SOCKET_SERVER_COMMAND", pool);
+
+ if (cmd && *cmd)
+ {
+  // prepare to launch the server
+  //
+  apr_proc_t server_pid;
+  apr_procattr_t* attr = NULL;
+  stat = apr_procattr_create(, pool);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  stat = apr_procattr_io_set(attr, APR_NO_PIPE, APR_NO_PIPE, 
APR_NO_PIPE);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+
+  //fprintf(stdout, "SOCKET_SERVER_COMMAND=%s\n", cmd);
+#ifdef SHELL_CMD_TYPE_WORKS
+  stat = apr_procattr_cmdtype_set(attr, APR_SHELLCMD);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  stat = apr_proc_create(_pid, cmd, NULL, NULL, attr, pool);
+#else
+  stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  // convert the space separated cmd string to the argument list
+  //
+  char** args = (char**)apr_palloc(pool, 15 * sizeof(*args));
+  char* pcmd = apr_pstrdup(pool, cmd);
+  int i = 0;
+  for (; i < 14 && pcmd && *pcmd; ++i)
+  {
+  args[i] = pcmd;
+  if (NULL != (pcmd = strchr(pcmd, ' ')))
 
 Review comment:
   That breaks paths with spaces, which is the default for e.g. 64 Bit Java in 
Windows. I suggest using a different custom divider, like `;` or even `:`. 
Neither of both could be reasonably used in this context in paths. The 
following fails for me:
   
   > set SOCKET_SERVER_COMMAND="C:\Program Files\Java\jdk-8\bin\java.exe" 
-classpath "%SOCKET_SERVER_CLASSPATH%" org.apache.log4j.net.ShortSocketServer 8 
input/socketServer
   
   > socketserverstarter : -starting="C:\Program with 8 arguments
   > FAILED 1 of 1


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376808023
 
 

 ##
 File path: src/test/cpp/net/socketservertestcase.cpp
 ##
 @@ -478,4 +477,4 @@ LOGUNIT_CLASS(SocketServerTestCase)
 const File SocketServerTestCase::TEMP("output/temp");
 const File SocketServerTestCase::FILTERED("output/filtered");
 
-LOGUNIT_TEST_SUITE_REGISTRATION_DISABLED(SocketServerTestCase)
+LOGUNIT_TEST_SUITE_REGISTRATION(SocketServerTestCase)
 
 Review comment:
   Should this test really be enabled? While your CMAKE-build might handle 
things automatically, it might be more difficult for users without CMAKE. Took 
me a while to figure things out based on this commit myself and the test still 
fails currently...
   
set PATH=C:\Program Files\Java\jdk-8\bin;C:\Program Files 
(x86)\UnxUtils\usr\local\wbin;%PATH%
set TEST_PROJ=%cd%
set LOG4CXX_VER_BASE=..\..\..\..
set TEST_SRC=%LOG4CXX_VER_BASE%\src\src\test
set TEST_RES=%TEST_SRC%\resources
   
set TOTO=wonderful
set key1=value
set key2=value2
   
set log4j_CLASSPATH=%LOG4CXX_VER_BASE%\..\..\..\..\Java\log4j-1.2.17.jar
set 
SOCKET_SERVER_SOURCES=%TEST_SRC%\java\org\apache\log4j\net\ShortSocketServer.java
set SOCKET_SERVER_CLASSPATH=%TEST_RES%;%log4j_CLASSPATH%
set CLASSPATH=%SOCKET_SERVER_CLASSPATH%
set SOCKET_SERVER_COMMAND=C:\Program 
Files\Java\jdk-8\bin\java.exe;org.apache.log4j.net.ShortSocketServer;8;input/socketServer
   
pushd "%TEST_RES%"
javac -d "." -classpath "%log4j_CLASSPATH%" "%SOCKET_SERVER_SOURCES%"
"%TEST_PROJ%\Win32\Debug\out\%~n0.exe" %*
popd
   
goto :EOF


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [logging-log4cxx] ams-tschoening commented on a change in pull request #14: Replace ant build with cmake

2020-02-09 Thread GitBox
ams-tschoening commented on a change in pull request #14: Replace ant build 
with cmake
URL: https://github.com/apache/logging-log4cxx/pull/14#discussion_r376807031
 
 

 ##
 File path: src/test/cpp/net/socketserverstarter.cpp
 ##
 @@ -0,0 +1,108 @@
+/*
+ * 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
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "../logunit.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+using namespace log4cxx;
+
+LOGUNIT_CLASS(SocketServerStarter)
+{
+   LOGUNIT_TEST_SUITE(SocketServerStarter);
+  LOGUNIT_TEST(startServer);
+   LOGUNIT_TEST_SUITE_END();
+   
+public:
+   void setUp()
+   {
+   }
+
+   void tearDown()
+   {
+   }
+   
+   void startServer()
+   {
+ helpers::Pool p;
+ apr_pool_t* pool = p.getAPRPool();
+ char* cmd = NULL;
+ apr_status_t stat = apr_env_get(, "SOCKET_SERVER_COMMAND", pool);
+
+ if (cmd && *cmd)
+ {
+  // prepare to launch the server
+  //
+  apr_proc_t server_pid;
+  apr_procattr_t* attr = NULL;
+  stat = apr_procattr_create(, pool);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  stat = apr_procattr_io_set(attr, APR_NO_PIPE, APR_NO_PIPE, 
APR_NO_PIPE);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+
+  //fprintf(stdout, "SOCKET_SERVER_COMMAND=%s\n", cmd);
+#ifdef SHELL_CMD_TYPE_WORKS
+  stat = apr_procattr_cmdtype_set(attr, APR_SHELLCMD);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  stat = apr_proc_create(_pid, cmd, NULL, NULL, attr, pool);
+#else
+  stat = apr_procattr_cmdtype_set(attr, APR_PROGRAM);
+  LOGUNIT_ASSERT(stat == APR_SUCCESS);
+  // convert the space separated cmd string to the argument list
+  //
+  char** args = (char**)apr_palloc(pool, 15 * sizeof(*args));
+  char* pcmd = apr_pstrdup(pool, cmd);
+  int i = 0;
+  for (; i < 14 && pcmd && *pcmd; ++i)
+  {
+  args[i] = pcmd;
+  if (NULL != (pcmd = strchr(pcmd, ' ')))
 
 Review comment:
   `;` is difficult on Windows, because it's used as divider for the 
Java-classpath already, while `:` is difficult on non-Windows, because that is 
used as divider for Java-classpaths. Might be best to not embed the classpath 
into the command at all and use 
[CLASSPATH](https://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html)
 environment variable instead?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services