From bfd4d43dee6358f11cba44cf0554371524c34fd7 Mon Sep 17 00:00:00 2001 From: Falk Werner Date: Sat, 4 Apr 2020 12:49:02 +0200 Subject: [PATCH] fix: compile error on arm targets --- test/webfuse/mocks/mock_jsonrpc_proxy.cc | 10 +++---- test/webfuse/mocks/mock_jsonrpc_proxy.hpp | 10 +++---- .../tests/adapter/operation/test_close.cc | 4 +-- .../tests/adapter/operation/test_open.cc | 2 +- test/webfuse/utils/wrap.hpp | 30 +++++++++++++++++++ 5 files changed, 41 insertions(+), 15 deletions(-) diff --git a/test/webfuse/mocks/mock_jsonrpc_proxy.cc b/test/webfuse/mocks/mock_jsonrpc_proxy.cc index 3cb0a8e..3fb243e 100644 --- a/test/webfuse/mocks/mock_jsonrpc_proxy.cc +++ b/test/webfuse/mocks/mock_jsonrpc_proxy.cc @@ -5,19 +5,17 @@ extern "C" { static webfuse_test::MockJsonRpcProxy * webfuse_test_MockJsonRpcProxy = nullptr; -WF_WRAP_FUNC6(webfuse_test_MockJsonRpcProxy, void, wf_jsonrpc_proxy_vinvoke, +WF_WRAP_VFUNC5(webfuse_test_MockJsonRpcProxy, void, wf_jsonrpc_proxy_vinvoke, struct wf_jsonrpc_proxy *, wf_jsonrpc_proxy_finished_fn *, void *, char const *, - char const *, - va_list); + char const *); -WF_WRAP_FUNC4(webfuse_test_MockJsonRpcProxy, void, wf_jsonrpc_proxy_vnotify, +WF_WRAP_VFUNC3(webfuse_test_MockJsonRpcProxy, void, wf_jsonrpc_proxy_vnotify, struct wf_jsonrpc_proxy *, char const *, - char const *, - va_list); + char const *); } namespace webfuse_test diff --git a/test/webfuse/mocks/mock_jsonrpc_proxy.hpp b/test/webfuse/mocks/mock_jsonrpc_proxy.hpp index fc39e1f..74d61af 100644 --- a/test/webfuse/mocks/mock_jsonrpc_proxy.hpp +++ b/test/webfuse/mocks/mock_jsonrpc_proxy.hpp @@ -12,18 +12,16 @@ class MockJsonRpcProxy public: MockJsonRpcProxy(); virtual ~MockJsonRpcProxy(); - MOCK_METHOD6(wf_jsonrpc_proxy_vinvoke, void ( + MOCK_METHOD5(wf_jsonrpc_proxy_vinvoke, void ( struct wf_jsonrpc_proxy * proxy, wf_jsonrpc_proxy_finished_fn * finished, void * user_data, char const * method_name, - char const * param_info, - va_list args)); - MOCK_METHOD4(wf_jsonrpc_proxy_vnotify, void ( + char const * param_info)); + MOCK_METHOD3(wf_jsonrpc_proxy_vnotify, void ( struct wf_jsonrpc_proxy * proxy, char const * method_name, - char const * param_info, - va_list args)); + char const * param_info)); }; diff --git a/test/webfuse/tests/adapter/operation/test_close.cc b/test/webfuse/tests/adapter/operation/test_close.cc index b7a7a9b..885e3bb 100644 --- a/test/webfuse/tests/adapter/operation/test_close.cc +++ b/test/webfuse/tests/adapter/operation/test_close.cc @@ -17,7 +17,7 @@ using testing::StrEq; TEST(wf_impl_operation_close, notify_proxy) { MockJsonRpcProxy proxy; - EXPECT_CALL(proxy, wf_jsonrpc_proxy_vnotify(_,StrEq("close"),StrEq("siii"),_)).Times(1); + EXPECT_CALL(proxy, wf_jsonrpc_proxy_vnotify(_,StrEq("close"),StrEq("siii"))).Times(1); MockOperationsContext context; EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) @@ -39,7 +39,7 @@ TEST(wf_impl_operation_close, notify_proxy) TEST(wf_impl_operation_close, fail_rpc_null) { MockJsonRpcProxy proxy; - EXPECT_CALL(proxy, wf_jsonrpc_proxy_vnotify(_,_,_,_)).Times(0); + EXPECT_CALL(proxy, wf_jsonrpc_proxy_vnotify(_,_,_)).Times(0); MockOperationsContext context; EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) diff --git a/test/webfuse/tests/adapter/operation/test_open.cc b/test/webfuse/tests/adapter/operation/test_open.cc index e7e5ca4..f82e81e 100644 --- a/test/webfuse/tests/adapter/operation/test_open.cc +++ b/test/webfuse/tests/adapter/operation/test_open.cc @@ -19,7 +19,7 @@ using testing::StrEq; TEST(wf_impl_operation_open, invoke_proxy) { MockJsonRpcProxy proxy; - EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("open"),StrEq("sii"),_)).Times(1); + EXPECT_CALL(proxy, wf_jsonrpc_proxy_vinvoke(_,_,_,StrEq("open"),StrEq("sii"))).Times(1); MockOperationsContext context; EXPECT_CALL(context, wf_impl_operations_context_get_proxy(_)).Times(1) diff --git a/test/webfuse/utils/wrap.hpp b/test/webfuse/utils/wrap.hpp index 4402598..30694de 100644 --- a/test/webfuse/utils/wrap.hpp +++ b/test/webfuse/utils/wrap.hpp @@ -99,4 +99,34 @@ } \ } + +#define WF_WRAP_VFUNC3( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE ) \ + extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, va_list); \ + RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, va_list args) \ + { \ + if (nullptr == GLOBAL_VAR ) \ + { \ + return __real_ ## FUNC_NAME (arg1, arg2, arg3, args); \ + } \ + else \ + { \ + return GLOBAL_VAR -> FUNC_NAME(arg1, arg2, arg3); \ + } \ + } + +#define WF_WRAP_VFUNC5( GLOBAL_VAR, RETURN_TYPE, FUNC_NAME, ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE ) \ + extern RETURN_TYPE __real_ ## FUNC_NAME (ARG1_TYPE, ARG2_TYPE, ARG3_TYPE, ARG4_TYPE, ARG5_TYPE, va_list); \ + RETURN_TYPE __wrap_ ## FUNC_NAME (ARG1_TYPE arg1, ARG2_TYPE arg2, ARG3_TYPE arg3, ARG4_TYPE arg4, ARG5_TYPE arg5, va_list args) \ + { \ + if (nullptr == GLOBAL_VAR ) \ + { \ + return __real_ ## FUNC_NAME (arg1, arg2, arg3, arg4, arg5, args); \ + } \ + else \ + { \ + return GLOBAL_VAR -> FUNC_NAME(arg1, arg2, arg3, arg4, arg5); \ + } \ + } + + #endif