Skip to content

Commit

Permalink
iox-eclipse-iceoryx#1054 remove noexcept clock_* mock, empty ACL impl…
Browse files Browse the repository at this point in the history
…ementation for unix, link unix with rt

Signed-off-by: Christian Eltzschig <me@elchris.org>
  • Loading branch information
elfenpiff authored and MatthiasKillat committed Feb 6, 2022
1 parent 32d76b5 commit 32dd94d
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 22 deletions.
6 changes: 6 additions & 0 deletions iceoryx_hoofs/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,10 @@ elseif(QNX)
PRIVATE
socket
)
elseif(UNIX)
target_link_libraries(iceoryx_platform
PUBLIC
rt
pthread
)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,86 @@
#ifndef IOX_HOOFS_LINUX_PLATFORM_ACL_HPP
#define IOX_HOOFS_LINUX_PLATFORM_ACL_HPP

#include <sys/acl.h>
#include "iceoryx_hoofs/platform/types.hpp"

#define ACL_USER_OBJ 0
#define ACL_USER 1
#define ACL_GROUP_OBJ 2
#define ACL_GROUP 3
#define ACL_OTHER 4
#define ACL_READ 5
#define ACL_WRITE 6
#define ACL_MASK 7

struct __acl_ext
{
};

using acl_t = struct __acl_ext*;
using acl_permset_t = int;
using acl_perm_t = int;
using acl_entry_t = int;
using acl_tag_t = int;

inline int acl_valid(acl_t)
{
return 0;
}

inline int acl_set_fd(int, acl_t)
{
return 0;
}

inline acl_t acl_init(int)
{
static struct __acl_ext stub;
return &stub;
}

inline int acl_free(void*)
{
return 0;
}

inline int acl_create_entry(acl_t*, acl_entry_t* )
{
return 0;
}

inline int acl_set_tag_type(acl_entry_t , acl_tag_t )
{
return 0;
}

inline int acl_set_qualifier(acl_entry_t , const void* )
{
return 0;
}

inline int acl_get_permset(acl_entry_t , acl_permset_t* )
{
return 0;
}

inline int acl_add_perm(acl_permset_t , acl_perm_t )
{
return 0;
}

inline char* acl_to_text(acl_t , ssize_t* )
{
return nullptr;
}

inline acl_t acl_from_text(const char* )
{
return acl_t();
}

inline acl_t acl_get_fd(int )
{
return acl_t();
}

#endif // IOX_HOOFS_LINUX_PLATFORM_ACL_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ constexpr uint64_t IOX_MAX_PATH_LENGTH = 1023U;
constexpr bool IOX_SHM_WRITE_ZEROS_ON_CREATION = true;
constexpr uint64_t IOX_MAX_SHM_NAME_LENGTH = PATH_MAX;
constexpr const char IOX_PATH_SEPARATORS[] = "/";
constexpr uint64_t IOX_UDS_SOCKET_MAX_MESSAGE_SIZE = 4096;
constexpr uint64_t IOX_UDS_SOCKET_MAX_MESSAGE_SIZE = 1024;
constexpr const char IOX_UDS_SOCKET_PATH_PREFIX[] = "/tmp/";
constexpr const char IOX_LOCK_FILE_PATH_PREFIX[] = "/tmp/";
using IoxIpcChannelType = iox::posix::UnixDomainSocket;
Expand Down
2 changes: 1 addition & 1 deletion iceoryx_hoofs/test/moduletests/test_access_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//
// SPDX-License-Identifier: Apache-2.0

#if !defined(_WIN32) && !defined(__APPLE__)
#if !defined(_WIN32) && !defined(__APPLE__) && !defined(unix) && !defined(__unix) && !defined(__unix__)
#include "iceoryx_hoofs/internal/posix_wrapper/access_control.hpp"
#include "iceoryx_hoofs/platform/pwd.hpp"
#include "iceoryx_hoofs/platform/stat.hpp"
Expand Down
4 changes: 3 additions & 1 deletion iceoryx_hoofs/test/moduletests/test_ipc_channel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ using namespace iox::posix;
using IpcChannelTypes = Types<UnixDomainSocket>;
#elif defined(_WIN32)
using IpcChannelTypes = Types<NamedPipe>;
#elif defined(unix) || defined(__unix) || defined(__unix__)
using IpcChannelTypes = Types<UnixDomainSocket, NamedPipe>;
#else
using IpcChannelTypes = Types<MessageQueue, UnixDomainSocket, NamedPipe>;
#endif
Expand Down Expand Up @@ -364,7 +366,7 @@ TYPED_TEST(IpcChannel_test, wildCreate)
ASSERT_THAT(result.has_error(), Eq(true));
}

#if !defined(__APPLE__)
#if !( defined(__APPLE__) || defined(unix) || defined(__unix) || defined(__unix__) )
TYPED_TEST(IpcChannel_test, TimedSendWorks)
{
::testing::Test::RecordProperty("TEST_ID", "12fe0ee5-37f8-4c34-ba44-ed50872a5fd9");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,9 @@ class time_MOCK
static bool doUseMock; // = true;
};

#if defined(QNX) || defined(QNX__) || defined(__QNX__)
int clock_getres(clockid_t clk_id, struct timespec* res);
int clock_gettime(clockid_t clk_id, struct timespec* res);
int clock_settime(clockid_t clk_id, const struct timespec* res);
#else
int clock_getres(clockid_t clk_id, struct timespec* res) noexcept;
int clock_gettime(clockid_t clk_id, struct timespec* res) noexcept;
int clock_settime(clockid_t clk_id, const struct timespec* res) noexcept;
#endif
#endif

#endif // IOX_HOOFS_MOCKS_TIME_MOCK_HPP
13 changes: 1 addition & 12 deletions iceoryx_hoofs/testing/mocks/time_mock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,19 @@ time_MOCK::time_MOCK()
{
}

#if defined(QNX) || defined(QNX__) || defined(__QNX__)
int clock_getres(clockid_t clk_id, struct timespec* res)
#else
int clock_getres(clockid_t clk_id, struct timespec* res) noexcept
#endif
{
return (time_MOCK::doUseMock) ? time_MOCK::mock->clock_getres(clk_id, res)
: STATIC_FUNCTION_LOADER_AUTO_DEDUCE(clock_getres)(clk_id, res);
}
#if defined(QNX) || defined(QNX__) || defined(__QNX__)

int clock_gettime(clockid_t clk_id, struct timespec* res)
#else
int clock_gettime(clockid_t clk_id, struct timespec* res) noexcept
#endif
{
return (time_MOCK::doUseMock) ? time_MOCK::mock->clock_gettime(clk_id, res)
: STATIC_FUNCTION_LOADER_AUTO_DEDUCE(clock_gettime)(clk_id, res);
}

#if defined(QNX) || defined(QNX__) || defined(__QNX__)
int clock_settime(clockid_t clk_id, const struct timespec* res)
#else
int clock_settime(clockid_t clk_id, const struct timespec* res) noexcept
#endif
{
return (time_MOCK::doUseMock) ? time_MOCK::mock->clock_settime(clk_id, res)
: STATIC_FUNCTION_LOADER_AUTO_DEDUCE(clock_settime)(clk_id, res);
Expand Down

0 comments on commit 32dd94d

Please sign in to comment.