You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by rr...@apache.org on 2020/03/26 14:56:47 UTC

[trafficserver] branch master updated: Convert single regression test in iocore/eventsystem/SocketManager.cc to Catch.

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

rrm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new 26daeab  Convert single regression test in iocore/eventsystem/SocketManager.cc to Catch.
26daeab is described below

commit 26daeab82f350404b0d097c332f2b66bc8f7bfba
Author: Walter Karas <wk...@verizonmedia.com>
AuthorDate: Wed Mar 25 13:09:31 2020 -0500

    Convert single regression test in iocore/eventsystem/SocketManager.cc to Catch.
---
 iocore/eventsystem/SocketManager.cc               | 16 ----------------
 iocore/eventsystem/unit_tests/test_EventSystem.cc | 21 +++++++++++++++++++--
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/iocore/eventsystem/SocketManager.cc b/iocore/eventsystem/SocketManager.cc
index 6dffbe1..9835519 100644
--- a/iocore/eventsystem/SocketManager.cc
+++ b/iocore/eventsystem/SocketManager.cc
@@ -29,7 +29,6 @@
 #include "P_EventSystem.h"
 
 #include "tscore/TextBuffer.h"
-#include "tscore/TestBox.h"
 
 SocketManager socketManager;
 
@@ -127,18 +126,3 @@ SocketManager::fastopen_supported()
 
   return value & TFO_CLIENT_ENABLE;
 }
-
-REGRESSION_TEST(socket_fastopen)(RegressionTest *test, int level, int *pstatus)
-{
-  TestBox box(test, pstatus);
-
-  box = REGRESSION_TEST_PASSED;
-
-  if (SocketManager::fastopen_supported()) {
-    box.check(MSG_FASTOPEN != 0, "TCP Fast Open is supported, MSG_FASTOPEN must not be 0");
-  }
-
-  if (::access("/proc/sys/net/ipv4/tcp_fastopen", F_OK) == 0) {
-    box.check(MSG_FASTOPEN != 0, "TCP Fast Open is available, MSG_FASTOPEN must not be 0");
-  }
-}
diff --git a/iocore/eventsystem/unit_tests/test_EventSystem.cc b/iocore/eventsystem/unit_tests/test_EventSystem.cc
index 75faad2..5de42b0 100644
--- a/iocore/eventsystem/unit_tests/test_EventSystem.cc
+++ b/iocore/eventsystem/unit_tests/test_EventSystem.cc
@@ -46,7 +46,7 @@ TEST_CASE("EventSystem", "[iocore]")
       ink_atomic_increment((int *)&count, 1);
 
       EThread *e = this_ethread();
-      printf("thread=%d (%p) count = %d\n", e->id, e, count);
+      std::printf("thread=%d (%p) count = %d\n", e->id, e, count);
 
       return 0;
     }
@@ -59,7 +59,7 @@ TEST_CASE("EventSystem", "[iocore]")
     kill_function(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
     {
       EThread *e = this_ethread();
-      printf("thread=%d (%p) count is %d\n", e->id, e, count);
+      std::printf("thread=%d (%p) count is %d\n", e->id, e, count);
 
       REQUIRE(count > 0);
       REQUIRE(count <= TEST_TIME_SECOND * TEST_THREADS);
@@ -99,3 +99,20 @@ struct EventProcessorListener : Catch::TestEventListenerBase {
 };
 
 CATCH_REGISTER_LISTENER(EventProcessorListener);
+
+TEST_CASE("EventSystemSocketManager", "[iocore][sock_mgr]")
+{
+  if (SocketManager::fastopen_supported()) {
+    if (MSG_FASTOPEN == 0) {
+      std::printf("TCP Fast Open is supported, MSG_FASTOPEN must not be 0\n");
+      CHECK(false);
+    }
+  }
+
+  if (::access("/proc/sys/net/ipv4/tcp_fastopen", F_OK) == 0) {
+    if (MSG_FASTOPEN == 0) {
+      std::printf("TCP Fast Open is supported, MSG_FASTOPEN must not be 0\n");
+      CHECK(false);
+    }
+  }
+}