From c58c8bf830a8bfb57236c9fc4e46d065fb859963 Mon Sep 17 00:00:00 2001 From: Sergey Yakubov <sergey.yakubov@desy.de> Date: Fri, 28 Sep 2018 11:29:55 +0200 Subject: [PATCH] adjust for MacOs --- common/cpp/src/system_io/system_io.h | 5 ++++ examples/worker/getnext_broker/check_linux.sh | 2 ++ .../event_monitor_producer/CMakeLists.txt | 14 ++++++----- .../src/system_folder_watch.h | 7 +++++- .../src/system_folder_watch_macos_dummy.h | 24 +++++++++++++++++++ receiver/unittests/test_request.cpp | 3 +-- 6 files changed, 46 insertions(+), 9 deletions(-) create mode 100644 producer/event_monitor_producer/src/system_folder_watch_macos_dummy.h diff --git a/common/cpp/src/system_io/system_io.h b/common/cpp/src/system_io/system_io.h index 00ff32d82..48c614927 100644 --- a/common/cpp/src/system_io/system_io.h +++ b/common/cpp/src/system_io/system_io.h @@ -15,6 +15,11 @@ typedef SSIZE_T ssize_t; #include "../../../../../../../../usr/include/netinet/in.h" #endif +#ifdef __APPLE__ +# define MSG_NOSIGNAL 0 +#endif + + namespace asapo { class SystemIO final : public IO { diff --git a/examples/worker/getnext_broker/check_linux.sh b/examples/worker/getnext_broker/check_linux.sh index ed90a1acb..04ee45752 100644 --- a/examples/worker/getnext_broker/check_linux.sh +++ b/examples/worker/getnext_broker/check_linux.sh @@ -24,6 +24,8 @@ do echo 'db.data.insert({"_id":'$i',"size":100,"name":"'$i'","lastchange":1})' | mongo ${database_name} done +sleep 1 + $@ 127.0.0.1:8400 $database_name 2 $token_test_run 1000 | grep "Processed 3 file(s)" diff --git a/producer/event_monitor_producer/CMakeLists.txt b/producer/event_monitor_producer/CMakeLists.txt index fb44c774f..cebdbdb98 100644 --- a/producer/event_monitor_producer/CMakeLists.txt +++ b/producer/event_monitor_producer/CMakeLists.txt @@ -5,8 +5,9 @@ set(SOURCE_FILES src/event_detector_factory.cpp src/folder_event_detector.cpp ) - -IF(WIN32) +IF (APPLE) + #do nothing +ELSEIF(WIN32) set(SOURCE_FILES ${SOURCE_FILES} src/system_folder_watch_windows.cpp src/single_folder_watch_windows.cpp src/watch_io.cpp @@ -15,7 +16,7 @@ IF(WIN32) ) ELSEIF(UNIX) set(SOURCE_FILES ${SOURCE_FILES} src/system_folder_watch_linux.cpp src/inotify_event.cpp src/inotify_linux.cpp) -ENDIF(WIN32) +ENDIF(APPLE) @@ -55,13 +56,14 @@ set(TEST_SOURCE_FILES unittests/test_event_detector_factory.cpp unittests/test_folder_event_detector.cpp ) - -IF(UNIX) +IF (APPLE) + #do nothing +ELSEIF(UNIX) set(TEST_SOURCE_FILES ${TEST_SOURCE_FILES} unittests/test_system_folder_watch_linux.cpp) ELSE() set(TEST_SOURCE_FILES ${TEST_SOURCE_FILES} unittests/test_system_folder_watch_windows.cpp unittests/test_single_folder_watch_windows.cpp) -ENDIF(UNIX) +ENDIF(APPLE) set(TEST_LIBRARIES "${TARGET_NAME}") diff --git a/producer/event_monitor_producer/src/system_folder_watch.h b/producer/event_monitor_producer/src/system_folder_watch.h index e81687f5c..2dcf28a59 100644 --- a/producer/event_monitor_producer/src/system_folder_watch.h +++ b/producer/event_monitor_producer/src/system_folder_watch.h @@ -5,9 +5,14 @@ #include "system_folder_watch_windows.h" #endif -#if defined(__linux__) || defined (__APPLE__) +#if defined(__linux__) #include "system_folder_watch_linux.h" #endif +#if defined(__APPLE__) +#include "system_folder_watch_macos_dummy.h" +#endif + + #endif //ASAPO_SYSTEM_FODLER_WATCH_H diff --git a/producer/event_monitor_producer/src/system_folder_watch_macos_dummy.h b/producer/event_monitor_producer/src/system_folder_watch_macos_dummy.h new file mode 100644 index 000000000..0c2bcc0a6 --- /dev/null +++ b/producer/event_monitor_producer/src/system_folder_watch_macos_dummy.h @@ -0,0 +1,24 @@ +#ifndef ASAPO_SYSTEM_FOLDER_WATCH_MACOS_DUMMY_H +#define ASAPO_SYSTEM_FOLDER_WATCH_MACOS_DUMMY_H + +#include "common.h" +#include "preprocessor/definitions.h" + + +// dummy file to make it compile on macos + + +namespace asapo { + +class SystemFolderWatch { + public: + VIRTUAL Error StartFolderMonitor(const std::string &root_folder, const std::vector<std::string> &monitored_folders) { + return nullptr; + }; + VIRTUAL FilesToSend GetFileList(Error* err) { + return {}; + }; +}; + +} +#endif //ASAPO_SYSTEM_FOLDER_WATCH_MACOS_DUMMY_H diff --git a/receiver/unittests/test_request.cpp b/receiver/unittests/test_request.cpp index c0bf0497c..8224ea207 100644 --- a/receiver/unittests/test_request.cpp +++ b/receiver/unittests/test_request.cpp @@ -162,8 +162,7 @@ TEST_F(RequestTests, HandleProcessesRequests) { TEST_F(RequestTests, DataIsNullAtInit) { auto& data = request->GetData(); - - ASSERT_THAT(data, Eq(nullptr)); + ASSERT_THAT(data.get(), Eq(nullptr)); } TEST_F(RequestTests, GetDataIsNotNullptr) { -- GitLab