You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2018/02/01 01:14:45 UTC

[trafficserver] 01/02: Write debug logs in stderr when unit tests run

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

masaori pushed a commit to branch quic-latest
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 14dc16cc951b99f312f209e546ea4ce139c5b4f5
Author: Masaori Koshiba <ma...@apache.org>
AuthorDate: Thu Feb 1 10:13:41 2018 +0900

    Write debug logs in stderr when unit tests run
---
 iocore/net/quic/test/event_processor_main.cc | 10 +++++++---
 iocore/net/quic/test/main.cc                 | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/iocore/net/quic/test/event_processor_main.cc b/iocore/net/quic/test/event_processor_main.cc
index fbfead6..9132a38 100644
--- a/iocore/net/quic/test/event_processor_main.cc
+++ b/iocore/net/quic/test/event_processor_main.cc
@@ -27,9 +27,8 @@
 #include "catch.hpp"
 
 #include "I_EventSystem.h"
-#include "ts/ink_string.h"
 #include "ts/I_Layout.h"
-#include "diags.i"
+#include "ts/Diags.h"
 
 #define TEST_THREADS 1
 
@@ -39,8 +38,13 @@ struct EventProcessorListener : Catch::TestEventListenerBase {
   virtual void
   testRunStarting(Catch::TestRunInfo const &testRunInfo) override
   {
+    BaseLogFile *base_log_file = new BaseLogFile("stderr");
+    diags                      = new Diags(testRunInfo.name.c_str(), "" /* tags */, "" /* actions */, base_log_file);
+    diags->activate_taglist("vv_quic|quic", DiagsTagType_Debug);
+    diags->config.enabled[DiagsTagType_Debug] = true;
+    diags->show_location                      = SHOW_LOCATION_DEBUG;
+
     Layout::create();
-    init_diags("", nullptr);
     RecProcessInit(RECM_STAND_ALONE);
 
     ink_event_system_init(EVENT_SYSTEM_MODULE_VERSION);
diff --git a/iocore/net/quic/test/main.cc b/iocore/net/quic/test/main.cc
index 213dec8..f611f5e 100644
--- a/iocore/net/quic/test/main.cc
+++ b/iocore/net/quic/test/main.cc
@@ -25,3 +25,20 @@
 // https://github.com/philsquared/Catch/blob/master/docs/slow-compiles.md
 #define CATCH_CONFIG_MAIN
 #include "catch.hpp"
+
+#include "ts/Diags.h"
+
+struct EventProcessorListener : Catch::TestEventListenerBase {
+  using TestEventListenerBase::TestEventListenerBase; // inherit constructor
+
+  virtual void
+  testRunStarting(Catch::TestRunInfo const &testRunInfo) override
+  {
+    BaseLogFile *base_log_file = new BaseLogFile("stderr");
+    diags                      = new Diags(testRunInfo.name.c_str(), "" /* tags */, "" /* actions */, base_log_file);
+    diags->activate_taglist("vv_quic|quic", DiagsTagType_Debug);
+    diags->config.enabled[DiagsTagType_Debug] = true;
+    diags->show_location                      = SHOW_LOCATION_DEBUG;
+  }
+};
+CATCH_REGISTER_LISTENER(EventProcessorListener);

-- 
To stop receiving notification emails like this one, please contact
masaori@apache.org.