This is an automated email from the ASF dual-hosted git repository.

pengzheng pushed a commit to branch feature/update_github_actions
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/feature/update_github_actions 
by this push:
     new 2bfa9cec Reduce stack usage in test.
2bfa9cec is described below

commit 2bfa9ceca37477117c3ee33765a7a1e9756ebee2
Author: PengZheng <[email protected]>
AuthorDate: Thu Jan 19 18:17:31 2023 +0800

    Reduce stack usage in test.
---
 .github/workflows/macos.yml                                      | 2 +-
 .../log_writers/syslog_writer/gtest/src/SyslogWriterTestSuite.cc | 9 +++------
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index df76b708..8548363e 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -24,7 +24,7 @@ jobs:
           conan profile update settings.build_type=Release default
           conan profile update settings.compiler=apple-clang default
           conan profile update settings.compiler.cppstd=17 default
-          conan profile update settings.compiler.libcxx=libc++ default
+          conan profile update settings.compiler.libcxx=libc++11 default
           conan profile update settings.compiler.version=12.0 default
       - name: Install Dependencies
         env:
diff --git 
a/bundles/logging/log_writers/syslog_writer/gtest/src/SyslogWriterTestSuite.cc 
b/bundles/logging/log_writers/syslog_writer/gtest/src/SyslogWriterTestSuite.cc
index 613f8ab6..26415dac 100644
--- 
a/bundles/logging/log_writers/syslog_writer/gtest/src/SyslogWriterTestSuite.cc
+++ 
b/bundles/logging/log_writers/syslog_writer/gtest/src/SyslogWriterTestSuite.cc
@@ -18,6 +18,7 @@
  */
 
 #include <gtest/gtest.h>
+#include <string>
 #include <thread>
 #include <celix_log_sink.h>
 #include <celix_log_control.h>
@@ -86,12 +87,8 @@ TEST_F(SyslogWriterTestSuite, LogToSysLog) {
             ls->error(ls->handle, "test %i %i %i", 1, 2, 3);
 
             //a very long log message
-            char buf[2048];
-            for (int i = 0; i <= 2046; ++i) {
-                buf[i] = 'A';
-            }
-            buf[2047] = '\0';
-            ls->fatal(ls->handle, "%s", buf);
+            std::string buf(2047, 'A');
+            ls->fatal(ls->handle, "%s", buf.c_str());
         };
         bool called = celix_bundleContext_useServiceWithOptions(ctx.get(), 
&opts);
         EXPECT_TRUE(called);

Reply via email to