move sentry code around and add a stub unittest for it
This commit is contained in:
		@@ -228,6 +228,7 @@ if (USE_WS OR USE_TEST)
 | 
				
			|||||||
  add_subdirectory(ixcrypto)
 | 
					  add_subdirectory(ixcrypto)
 | 
				
			||||||
  add_subdirectory(ixcobra)
 | 
					  add_subdirectory(ixcobra)
 | 
				
			||||||
  add_subdirectory(ixsnake)
 | 
					  add_subdirectory(ixsnake)
 | 
				
			||||||
 | 
					  add_subdirectory(ixsentry)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  add_subdirectory(third_party/spdlog spdlog)
 | 
					  add_subdirectory(third_party/spdlog spdlog)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										24
									
								
								ixsentry/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								ixsentry/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
				
			|||||||
 | 
					#
 | 
				
			||||||
 | 
					# Author: Benjamin Sergeant
 | 
				
			||||||
 | 
					# Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set (IXSENTRY_SOURCES
 | 
				
			||||||
 | 
					    ixsentry/IXSentryClient.cpp
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set (IXSENTRY_HEADERS
 | 
				
			||||||
 | 
					    ixsentry/IXSentryClient.h
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					add_library(ixsentry STATIC
 | 
				
			||||||
 | 
					  ${IXSENTRY_SOURCES}
 | 
				
			||||||
 | 
					  ${IXSENTRY_HEADERS}
 | 
				
			||||||
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					set(IXSENTRY_INCLUDE_DIRS
 | 
				
			||||||
 | 
					    .
 | 
				
			||||||
 | 
					    ../third_party
 | 
				
			||||||
 | 
					    ../third_party/spdlog/include)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					target_include_directories( ixsentry PUBLIC ${IXSENTRY_INCLUDE_DIRS} )
 | 
				
			||||||
@@ -45,6 +45,7 @@ set (SOURCES
 | 
				
			|||||||
  IXCobraMetricsPublisherTest.cpp
 | 
					  IXCobraMetricsPublisherTest.cpp
 | 
				
			||||||
  IXDNSLookupTest.cpp
 | 
					  IXDNSLookupTest.cpp
 | 
				
			||||||
  IXWebSocketSubProtocolTest.cpp
 | 
					  IXWebSocketSubProtocolTest.cpp
 | 
				
			||||||
 | 
					  IXSentryClientTest.cpp
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Some unittest don't work on windows yet
 | 
					# Some unittest don't work on windows yet
 | 
				
			||||||
@@ -83,5 +84,6 @@ target_link_libraries(ixwebsocket_unittest ixcobra)
 | 
				
			|||||||
target_link_libraries(ixwebsocket_unittest ixwebsocket)
 | 
					target_link_libraries(ixwebsocket_unittest ixwebsocket)
 | 
				
			||||||
target_link_libraries(ixwebsocket_unittest ixcrypto)
 | 
					target_link_libraries(ixwebsocket_unittest ixcrypto)
 | 
				
			||||||
target_link_libraries(ixwebsocket_unittest ixcore)
 | 
					target_link_libraries(ixwebsocket_unittest ixcore)
 | 
				
			||||||
 | 
					target_link_libraries(ixwebsocket_unittest ixsentry)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install(TARGETS ixwebsocket_unittest DESTINATION bin)
 | 
					install(TARGETS ixwebsocket_unittest DESTINATION bin)
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										30
									
								
								test/IXSentryClientTest.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								test/IXSentryClientTest.cpp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,30 @@
 | 
				
			|||||||
 | 
					/*
 | 
				
			||||||
 | 
					 *  IXSentryClientTest.cpp
 | 
				
			||||||
 | 
					 *  Author: Benjamin Sergeant
 | 
				
			||||||
 | 
					 *  Copyright (c) 2019 Machine Zone. All rights reserved.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include "IXTest.h"
 | 
				
			||||||
 | 
					#include "catch.hpp"
 | 
				
			||||||
 | 
					#include <iostream>
 | 
				
			||||||
 | 
					#include <string.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					using namespace ix;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace ix
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    TEST_CASE("sentry", "[sentry]")
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        SECTION("Attempt to perform nil")
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					#if 0
 | 
				
			||||||
 | 
					            SentryClient sentryClient;
 | 
				
			||||||
 | 
					            std::string stack = "";
 | 
				
			||||||
 | 
					            auto frames = sentryClient.parseLuaStackTrace(stack);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            REQUIRE(frames.size() > 0);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					} // namespace ix
 | 
				
			||||||
@@ -34,8 +34,6 @@ add_executable(ws
 | 
				
			|||||||
  ../third_party/jsoncpp/jsoncpp.cpp
 | 
					  ../third_party/jsoncpp/jsoncpp.cpp
 | 
				
			||||||
  ${STATSD_CLIENT_SOURCES}
 | 
					  ${STATSD_CLIENT_SOURCES}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  IXSentryClient.cpp
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  ws_http_client.cpp
 | 
					  ws_http_client.cpp
 | 
				
			||||||
  ws_ping_pong.cpp
 | 
					  ws_ping_pong.cpp
 | 
				
			||||||
  ws_broadcast_server.cpp
 | 
					  ws_broadcast_server.cpp
 | 
				
			||||||
@@ -64,6 +62,7 @@ target_link_libraries(ws ixcobra)
 | 
				
			|||||||
target_link_libraries(ws ixwebsocket)
 | 
					target_link_libraries(ws ixwebsocket)
 | 
				
			||||||
target_link_libraries(ws ixcrypto)
 | 
					target_link_libraries(ws ixcrypto)
 | 
				
			||||||
target_link_libraries(ws ixcore)
 | 
					target_link_libraries(ws ixcore)
 | 
				
			||||||
 | 
					target_link_libraries(ws ixsentry)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if(NOT APPLE AND NOT USE_MBED_TLS)
 | 
					if(NOT APPLE AND NOT USE_MBED_TLS)
 | 
				
			||||||
  find_package(OpenSSL REQUIRED)
 | 
					  find_package(OpenSSL REQUIRED)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
 *  Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
 | 
					 *  Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "IXSentryClient.h"
 | 
					#include <ixsentry/IXSentryClient.h>
 | 
				
			||||||
#include <atomic>
 | 
					#include <atomic>
 | 
				
			||||||
#include <chrono>
 | 
					#include <chrono>
 | 
				
			||||||
#include <condition_variable>
 | 
					#include <condition_variable>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user