From 3035ab50785a3798393a98011aa749bf93b1b03a Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 1 Nov 2018 19:36:48 +0900 Subject: [PATCH 01/16] Release version 1.3.0 Changes: - Fixed port registration - Change parameter types to use move semantic - Fixed wrong timeout interval Change-Id: I3074e2a55623aff1effccf886d7023bdd8045afa Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index 384c6cb..bbe58c2 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -1,6 +1,6 @@ Name: rpc-port Summary: RPC Port library -Version: 1.2.4 +Version: 1.3.0 Release: 0 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From a852bac3c4c63637206655903c5af2766ada4a02 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 2 Nov 2018 13:47:07 +0900 Subject: [PATCH 02/16] Fix socket pair requests Requires: - https://review.tizen.org/gerrit/#/c/192266/ [amd] - https://review.tizen.org/gerrit/#/c/192286/ [aul-1] - https://review.tizen.org/gerrit/#/c/192287/ [rpc-port] Change-Id: I2946e94cd5d27db859eec809ef610b6bbc90c079 Signed-off-by: Hwankyu Jhun --- src/fdbroker-internal.cc | 10 ++++++---- src/fdbroker-internal.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/fdbroker-internal.cc b/src/fdbroker-internal.cc index aa234c7..010d555 100644 --- a/src/fdbroker-internal.cc +++ b/src/fdbroker-internal.cc @@ -143,12 +143,14 @@ FdBroker::SocketPair::~SocketPair() { close(socks_[RECEIVER]); } -int FdBroker::SocketPair::Request() { +int FdBroker::SocketPair::Request(const std::string& target_appid, + const std::string& port_name) { if (mock_) { return socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, socks_); } - if (aul_rpc_port_create_socket_pair(&socks_) != AUL_R_OK) { + if (aul_rpc_port_create_socket_pair(target_appid.c_str(), + port_name.c_str(), &socks_) != AUL_R_OK) { LOGE("error create socket pair"); return -1; } @@ -243,9 +245,9 @@ int FdBroker::Send(const std::string& target_appid, return -1; } - if (main_sock_pair.Request() != 0) + if (main_sock_pair.Request(target_appid, port_name) != 0) return -1; - if (delegate_sock_pair.Request() != 0) + if (delegate_sock_pair.Request(target_appid, port_name) != 0) return -1; if (mock_) { diff --git a/src/fdbroker-internal.h b/src/fdbroker-internal.h index e9b15b8..510c992 100644 --- a/src/fdbroker-internal.h +++ b/src/fdbroker-internal.h @@ -115,7 +115,7 @@ class FdBroker { explicit SocketPair(bool mock = false); ~SocketPair(); - int Request(); + int Request(const std::string& target_appid, const std::string& port_name); void RequestMock(); int Get(Type t) const; int Detach(Type t); -- 2.7.4 From 0fb36d62214d4e2fc45ddf7bf72d5388845d9278 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 2 Nov 2018 13:59:35 +0900 Subject: [PATCH 03/16] Fix wrong parameter Change-Id: I52f78ae7c99380bcc7e6ec218b9017c0303f591f Signed-off-by: Hwankyu Jhun --- src/fdbroker-internal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fdbroker-internal.cc b/src/fdbroker-internal.cc index 010d555..ad14b96 100644 --- a/src/fdbroker-internal.cc +++ b/src/fdbroker-internal.cc @@ -491,7 +491,7 @@ int FdBroker::RegisterDbusInterface(const std::string& port_name) { return -1; } - LOGI("%s is registered", port_name); + LOGI("%s is registered", port_name.c_str()); return 0; } -- 2.7.4 From ac15051f77cd65d671f945511a2c33393fa11e6c Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 5 Nov 2018 18:43:50 +0900 Subject: [PATCH 04/16] Release version 1.3.1 Changes: - Fix socket pair requests - Fix wrong parameter Change-Id: Ib89ee2e8a9c32c104944db2f5c3abc22b32fa4b1 Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index bbe58c2..70f75e1 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -1,6 +1,6 @@ Name: rpc-port Summary: RPC Port library -Version: 1.3.0 +Version: 1.3.1 Release: 0 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 79ab22a87c9043f5b9747f55d9d0c91c8d294c0b Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 26 Nov 2018 15:33:06 +0900 Subject: [PATCH 05/16] Handle EPIPE error The Write() Method uses send() with MSG_NOSIGNAL instead of write(). Change-Id: I20251df65375dacdc42f9a4da1d531dd3e635728 Signed-off-by: Hwankyu Jhun --- src/port-internal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/port-internal.cc b/src/port-internal.cc index 2cd3a72..34557b6 100644 --- a/src/port-internal.cc +++ b/src/port-internal.cc @@ -134,7 +134,7 @@ int Port::Write(const void* buf, unsigned int size) { } while (left) { - nb = write(fd_, buffer, left); + nb = send(fd_, buffer, left, MSG_NOSIGNAL); if (nb == -1) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { LOGE("write_socket: %d errno, sleep and retry ...", errno); -- 2.7.4 From 4eaa33eab6dad750f314515a05ee678b07293a6e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 26 Nov 2018 16:59:17 +0900 Subject: [PATCH 06/16] Release version 1.3.2 Changes: - Handle EPIPE error Change-Id: Ie086bdbad897a6149640a4175660b05065f91e30 Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index 70f75e1..74f6330 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -1,6 +1,6 @@ Name: rpc-port Summary: RPC Port library -Version: 1.3.1 +Version: 1.3.2 Release: 0 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From a46c82eb0073909677fce2a562974d9d5440f459 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 7 Dec 2018 14:06:07 +0900 Subject: [PATCH 07/16] Fix a wrong log format Change-Id: I3dbe115d478dea3b4e57efe1fb383ee77e9ace02 Signed-off-by: Hwankyu Jhun --- src/port-internal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/port-internal.cc b/src/port-internal.cc index 34557b6..daa11ce 100644 --- a/src/port-internal.cc +++ b/src/port-internal.cc @@ -71,7 +71,7 @@ int Port::Read(void* buf, unsigned int size) { while (left) { nb = read(fd_, buffer, left); if (nb == 0) { - LOGE("read_socket: ...read EOF, socket closed %d: nb %d\n", fd_, nb); + LOGE("read_socket: ...read EOF, socket closed %d: nb %zd\n", fd_, nb); return RPC_PORT_ERROR_IO_ERROR; } else if (nb == -1) { if (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK) { -- 2.7.4 From d1eeb43d618c1e4379c72ed9692c0bc478bb8b2a Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 7 Dec 2018 14:14:09 +0900 Subject: [PATCH 08/16] Release version 1.3.3 Changes: - Fix a wrong log format Change-Id: Ib7e40d6f313f9f6f1b9402d1759feb6d91464493 Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index 74f6330..d58490c 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -1,6 +1,6 @@ Name: rpc-port Summary: RPC Port library -Version: 1.3.2 +Version: 1.3.3 Release: 0 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 9352c724da8a0e73811baa33ade9067649f3ca78 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 10 Dec 2018 17:54:21 +0900 Subject: [PATCH 09/16] Fix Unit Test The package name is changed to "rpc-port-unittests". The executable file name is changed to "rpc-port_unittests". The descriptions are added. Change-Id: I7bccadd241f938f7ebd75ea0d82a5932fcdfbf5d Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 10 ++-- unit_tests/CMakeLists.txt | 10 ++-- unit_tests/src/rpc_port_parcel_test.cc | 91 +++++++++++++++++++++++++++++----- unit_tests/src/rpc_port_test.cc | 45 +++++++++++++++-- 4 files changed, 129 insertions(+), 27 deletions(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index d58490c..df1d35d 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -66,15 +66,15 @@ rm -rf %{buildroot} %{_libdir}/lib%{name}.so ################################################# -# gtest-rpc-port +# rpc-port-unittests ################################################# -%package -n gtest-rpc-port +%package -n rpc-port-unittests Summary: GTest for rpc-port Group: Development/Libraries Requires: %{name} -%description -n gtest-rpc-port +%description -n rpc-port-unittests GTest for rpc-port -%files -n gtest-rpc-port -%{_bindir}/gtest-rpc-port +%files -n rpc-port-unittests +%{_bindir}/rpc-port_unittests diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index ecbe1b6..a3b19c4 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -1,14 +1,14 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -PROJECT(gtest-rpc-port CXX) +PROJECT(rpc-port_unittests CXX) INCLUDE(FindPkgConfig) -pkg_check_modules(gtest-rpc-port REQUIRED +pkg_check_modules(rpc-port_unittests REQUIRED glib-2.0 gmock aul ) -FOREACH(flag ${gtest-rpc-port_CFLAGS}) +FOREACH(flag ${rpc-port_unittests_CFLAGS}) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}") ENDFOREACH(flag) SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline") @@ -25,6 +25,6 @@ ADD_EXECUTABLE(${PROJECT_NAME} ${SOURCES} ) -TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${gtest-rpc-port_LDFLAGS} rpc-port) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${rpc-port_unittests_LDFLAGS} rpc-port) -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/) +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin) diff --git a/unit_tests/src/rpc_port_parcel_test.cc b/unit_tests/src/rpc_port_parcel_test.cc index 21e11c4..a04d6a1 100644 --- a/unit_tests/src/rpc_port_parcel_test.cc +++ b/unit_tests/src/rpc_port_parcel_test.cc @@ -101,7 +101,12 @@ class ParcelTest : public ::testing::Test { bool touch_to_ = false; }; -TEST(rpc_port_parcel, rpc_port_parcel_create_destroy) { +/* + * @testcase rpc_port_parcel_create_destroy_P + * @description Creates and destroys the rpc-port parcel handle + * @apicovered rpc_port_parcel_create, rpc_port_parcel_destroy + */ +TEST(rpc_port_parcel, rpc_port_parcel_create_destroy_P) { rpc_port_parcel_h handle; int ret = rpc_port_parcel_create(&handle); @@ -113,7 +118,12 @@ TEST(rpc_port_parcel, rpc_port_parcel_create_destroy) { ASSERT_EQ(ret, 0); } -TEST_F(ParcelTest, read_write_byte) { +/* + * @testcase rpc_port_parcel_read_write_byte_P + * @description Writes and reads the byte data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_byte, rpc_port_parcel_read_byte + */ +TEST_F(ParcelTest, rpc_port_parcel_write_read_byte_P) { int ret = rpc_port_parcel_write_byte(handle_, 'k'); ASSERT_EQ(ret, 0); @@ -123,7 +133,12 @@ TEST_F(ParcelTest, read_write_byte) { ASSERT_EQ(b, 'k'); } -TEST_F(ParcelTest, read_write_int16) { +/* + * @testcase rpc_port_parcel_read_write_int16_P + * @description Writes and reads the int16 data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_int16, rpc_port_parcel_read_int16 + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_in16_P) { int ret = rpc_port_parcel_write_int16(handle_, 123); ASSERT_EQ(ret, 0); @@ -133,7 +148,12 @@ TEST_F(ParcelTest, read_write_int16) { ASSERT_EQ(b, 123); } -TEST_F(ParcelTest, read_write_int32) { +/* + * @testcase rpc_port_parcel_read_write_int32_P + * @description Writes and reads the int32 data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_int32, rpc_port_parcel_read_int32 + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_int32_P) { int ret = rpc_port_parcel_write_int32(handle_, 123456); ASSERT_EQ(ret, 0); @@ -143,7 +163,12 @@ TEST_F(ParcelTest, read_write_int32) { ASSERT_EQ(b, 123456); } -TEST_F(ParcelTest, read_write_int64) { +/* + * @testcase rpc_port_parcel_read_write_int64_P + * @description Writes and reads the int64 data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_int64, rpc_port_parcel_read_int64 + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_int64_P) { int ret = rpc_port_parcel_write_int64(handle_, 12345678); ASSERT_EQ(ret, 0); @@ -153,7 +178,12 @@ TEST_F(ParcelTest, read_write_int64) { ASSERT_EQ(b, 12345678); } -TEST_F(ParcelTest, read_write_float) { +/* + * @testcase rpc_port_parcel_read_write_float_P + * @description Writes and reads the float data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_float, rpc_port_parcel_read_float + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_float_P) { int ret = rpc_port_parcel_write_float(handle_, 123.456f); ASSERT_EQ(ret, 0); @@ -163,7 +193,12 @@ TEST_F(ParcelTest, read_write_float) { ASSERT_EQ(b, 123.456f); } -TEST_F(ParcelTest, read_write_double) { +/* + * @testcase rpc_port_parcel_read_write_double_P + * @description Writes and reads the double data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_double, rpc_port_parcel_read_double + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_double_P) { int ret = rpc_port_parcel_write_double(handle_, 123.456f); ASSERT_EQ(ret, 0); @@ -173,7 +208,12 @@ TEST_F(ParcelTest, read_write_double) { ASSERT_EQ(b, 123.456f); } -TEST_F(ParcelTest, read_write_string) { +/* + * @testcase rpc_port_parcel_read_write_string_P + * @description Writes and reads the string data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_string, rpc_port_parcel_read_string + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_string_P) { const char str[] = "abcdef"; int ret = rpc_port_parcel_write_string(handle_, str); ASSERT_EQ(ret, 0); @@ -185,7 +225,12 @@ TEST_F(ParcelTest, read_write_string) { ASSERT_STREQ(s1.Get(), str); } -TEST_F(ParcelTest, read_write_bool) { +/* + * @testcase rpc_port_parcel_read_write_bool_P + * @description Writes and reads the boolean data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_bool, rpc_port_parcel_read_bool + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_bool_P) { int ret = rpc_port_parcel_write_bool(handle_, true); ASSERT_EQ(ret, 0); @@ -195,7 +240,12 @@ TEST_F(ParcelTest, read_write_bool) { ASSERT_TRUE(b); } -TEST_F(ParcelTest, read_write_bundle) { +/* + * @testcase rpc_port_parcel_read_write_bundle_P + * @description Writes and reads the bundle data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_bundle, rpc_port_parcel_read_bundle + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_bundle_P) { bundle* b = bundle_create(); ASSERT_NE(b, nullptr); @@ -218,7 +268,12 @@ TEST_F(ParcelTest, read_write_bundle) { ASSERT_STREQ("Value", str); } -TEST_F(ParcelTest, read_write_array_count) { +/* + * @testcase rpc_port_parcel_read_write_array_count_P + * @description Writes and reads the array count data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write_array_count, rpc_port_parcel_read_array_count + */ +TEST_F(ParcelTest, rpc_port_parcle_read_write_array_count_P) { int ret = rpc_port_parcel_write_array_count(handle_, 123); ASSERT_EQ(ret, 0); @@ -228,7 +283,12 @@ TEST_F(ParcelTest, read_write_array_count) { ASSERT_EQ(c, 123); } -TEST_F(ParcelTest, read_write) { +/* + * @testcase rpc_port_parcel_read_write_P + * @description Writes and reads the data to the rpc-port parcel handle + * @apicovered rpc_port_parcel_write, rpc_port_parcel_read + */ +TEST_F(ParcelTest, rpc_port_parcel_read_write_P) { rpc_port_parcelable_t p = { .to = WriteParcelable, .from = ReadParcelable @@ -243,7 +303,12 @@ TEST_F(ParcelTest, read_write) { ASSERT_TRUE(touch_from_); } -TEST_F(ParcelTest, burst_read_write) { +/* + * @testcase rpc_port_parcel_burst_read_write_P + * @description Writes and reads the data by burst mode to the rpc-port parcel handle + * @apicovered rpc_port_parcel_burst_write, rpc_port_parcel_burst_read + */ +TEST_F(ParcelTest, rpc_port_parcel_burst_read_write_P) { unsigned char buf[] = { 0, 1, 2, 3, 4 }; int ret = rpc_port_parcel_burst_write(handle_, buf, sizeof(buf)); ASSERT_EQ(ret, 0); diff --git a/unit_tests/src/rpc_port_test.cc b/unit_tests/src/rpc_port_test.cc index dd2dc87..601f4c4 100644 --- a/unit_tests/src/rpc_port_test.cc +++ b/unit_tests/src/rpc_port_test.cc @@ -168,6 +168,13 @@ class RpcPortConnection : public RpcPortBase { bool touch_proxy_received_event_cb_ = false; }; +/* + * @testcase rpc_port_event_connect_P + * @description After the rpc_port_proxy_connect() is called, + * the rambda function is called by connected events. + * @apicovered rpc_port_stub_add_connected_event_cb, rpc_port_stub_listen, + * rpc_port_proxy_add_connected_event_cb, rpc_port_proxy_connect, + */ TEST_F(RpcPortBase, rpc_port_event_connect) { int ret = rpc_port_stub_add_connected_event_cb(stub_handle_, [](const char *sender, const char* instance, void *data) { @@ -195,7 +202,14 @@ TEST_F(RpcPortBase, rpc_port_event_connect) { ASSERT_TRUE(touch_stub_connected_event_cb_); } -TEST_F(RpcPortBase, rpc_port_proxy_event_reject) { +/* + * @testcase rpc_port_proxy_event_reject_n + * @description After the rpc_port_proxy_connect() is called, + * the rambda function is called by the rejected event. + * @apicovered rpc_port_stub_listen, rpc_port_proxy_add_connected_event_cb, + * rpc_port_proxy_connect, + */ +TEST_F(RpcPortBase, rpc_port_proxy_event_reject_N) { int ret = rpc_port_stub_listen(stub_handle_); ASSERT_EQ(ret, 0); @@ -213,7 +227,13 @@ TEST_F(RpcPortBase, rpc_port_proxy_event_reject) { ASSERT_TRUE(touch_proxy_rejected_event_cb_); } -TEST_F(RpcPortConnection, rpc_port_proxy_event_receive) { +/* + * @testcase rpc_port_proxy_event_receive_P + * @description Writes and reads the data to the port handles. + * And then, checks the data in callback functions. + * @apicovered rpc_port_write, rpc_port_read + */ +TEST_F(RpcPortConnection, rpc_port_proxy_event_receive_p) { char res[] = "OK"; char r_buf[256]; @@ -247,6 +267,11 @@ TEST_F(RpcPortConnection, rpc_port_proxy_event_receive) { ASSERT_STREQ(res, r_buf); } +/* + * @testcase rpc_port_read_write_P + * @description Writes and reads the data to the port handles. + * @apicovered rpc_port_write, rpc_port_read + */ TEST_F(RpcPortConnection, rpc_port_read_write) { char buf[] = "test message"; char res[] = "OK"; @@ -271,14 +296,26 @@ TEST_F(RpcPortConnection, rpc_port_read_write) { ASSERT_STREQ("OK", r_buf); } -TEST_F(RpcPortConnection, rpc_port_proxy_disconnected) { +/* + * @testcase rpc_port_proxy_disconnected_N + * @description Kills the stub port. + * And then, checks whether the disconnected event callback is invoked or not. + * @apicovered rpc_port_stub_add_disconnected_event_cb + */ +TEST_F(RpcPortConnection, rpc_port_proxy_disconnected_N) { KillStub(); RunMainLoop(); ASSERT_TRUE(touch_proxy_disconnected_event_cb_); } -TEST_F(RpcPortConnection, rpc_port_stub_disconnected) { +/* + * @testcase rpc_port_stub_disconnected_N + * @description Kills the proxy port. + * And then, checks whether the disconnected event callback is invoked or not. + * @apicovered rpc_port_proxy_add_disconnected_event_cb + */ +TEST_F(RpcPortConnection, rpc_port_stub_disconnected_N) { KillProxy(); RunMainLoop(); -- 2.7.4 From 53d7dd8ec044fb11477e4359317e99baadb061a8 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 14 Dec 2018 16:04:18 +0900 Subject: [PATCH 10/16] Make a gcov package for coverage measurement Change-Id: Ibd38571573dead9c202543ea8ca43bd98849b893 Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 61 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 8 deletions(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index df1d35d..3689a4e 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -35,26 +35,71 @@ Requires: %{name} = %{version}-%{release} %description devel RPC Port library (Development) package. +################################################# +# rpc-port-unittests +################################################# +%package -n rpc-port-unittests +Summary: GTest for rpc-port +Group: Development/Libraries +Requires: %{name} + +%description -n rpc-port-unittests +GTest for rpc-port + +################################################# +# rpc-port-gcov +################################################# +%if 0%{?gcov:1} +%package gcov +Summary: RPC Port(gcov) +Group: Application Framework/Testing + +%description gcov +RPC Port gcov objects +%endif + %prep %setup -q cp %{SOURCE1001} . %build +%if 0%{?gcov:1} +export CFLAGS+=" -fprofile-arcs -ftest-coverage" +export CXXFLAGS+=" -fprofile-arcs -ftest-coverage" +export FFLAGS+=" -fprofile-arcs -ftest-coverage" +export LDFLAGS+=" -lgcov" +%endif + MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %cmake . -DFULLVER=%{version} -DMAJORVER=${MAJORVER} # Call make instruction with smp support %__make %{?jobs:-j%jobs} +%if 0%{?gcov:1} +mkdir -p gcov-obj +find . -name '*.gcno' -exec cp '{}' gcov-obj ';' +%endif + %install rm -rf %{buildroot} %make_install +%if 0%{?gcov:1} +mkdir -p %{buildroot}%{_datadir}/gcov/obj +install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj +%endif + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig +%post -n rpc-port-unittests +%if 0%{?gcov:1} +%{_bindir}/rpc-port_unittests +%endif + %files %manifest %{name}.manifest %attr(0644,root,root) %{_libdir}/lib%{name}.so.* @@ -68,13 +113,13 @@ rm -rf %{buildroot} ################################################# # rpc-port-unittests ################################################# -%package -n rpc-port-unittests -Summary: GTest for rpc-port -Group: Development/Libraries -Requires: %{name} - -%description -n rpc-port-unittests -GTest for rpc-port - %files -n rpc-port-unittests %{_bindir}/rpc-port_unittests + +################################################# +# rpc-port-gcov +################################################# +%if 0%{?gcov:1} +%files gcov +%{_datadir}/gcov/obj/* +%endif -- 2.7.4 From 595c7a6cbf71727b62456316581ca093844b769a Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 14 Dec 2018 17:14:24 +0900 Subject: [PATCH 11/16] Release version 1.3.4 Changes: - Fix Unit Test - Make a gcov package for coverage measurement Change-Id: I58bc0f42395b09ac9edb03baa91a66a7c1caff57 Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index 3689a4e..06b4e16 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -1,6 +1,6 @@ Name: rpc-port Summary: RPC Port library -Version: 1.3.3 +Version: 1.3.4 Release: 0 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 499cde7eea263eaf82c323ae413ed16a6c607f60 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 11 Feb 2019 12:36:51 +0900 Subject: [PATCH 12/16] Adjust log level Change-Id: Ib497cdb84b0ff3186f05090bf2e963229954d4bf Signed-off-by: Hwankyu Jhun --- src/ac-internal.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ac-internal.cc b/src/ac-internal.cc index f2e728b..89138ca 100644 --- a/src/ac-internal.cc +++ b/src/ac-internal.cc @@ -161,7 +161,7 @@ int AccessController::Cynara::Check(const std::string& privilege) const { LOGD("check privilege %s", privilege.c_str()); if (cynara_check(cynara_, client_, "", user_, privilege.c_str()) != CYNARA_API_ACCESS_ALLOWED) { - LOGD("cynara_check() is not allowed : %s", privilege.c_str()); + LOGE("cynara_check() is not allowed : %s", privilege.c_str()); return -1; } -- 2.7.4 From 053c439cfe19179f2d5ab4caf6d3d36b7d88932e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 11 Feb 2019 15:20:52 +0900 Subject: [PATCH 13/16] Release version 1.3.5 Changes: - Adjust log level Change-Id: I9943d5b4477f3bfa30916960daa0c3d14fb38ebf Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index 06b4e16..675e137 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -1,6 +1,6 @@ Name: rpc-port Summary: RPC Port library -Version: 1.3.4 +Version: 1.3.5 Release: 0 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From a1f0c346bb4de24d036e9f13eb02f813e11e1b65 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Mon, 11 Feb 2019 17:46:34 +0900 Subject: [PATCH 14/16] Fix static analysis issues Change-Id: If83771089ef803f9f8da21168aac85f26431663e Signed-off-by: Junghoon Park --- unit_tests/src/rpc_port_parcel_test.cc | 2 +- unit_tests/src/rpc_port_test.cc | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/unit_tests/src/rpc_port_parcel_test.cc b/unit_tests/src/rpc_port_parcel_test.cc index a04d6a1..2b67502 100644 --- a/unit_tests/src/rpc_port_parcel_test.cc +++ b/unit_tests/src/rpc_port_parcel_test.cc @@ -259,8 +259,8 @@ TEST_F(ParcelTest, rpc_port_parcel_read_write_bundle_P) { b = nullptr; ret = rpc_port_parcel_read_bundle(handle_, &b); - ASSERT_EQ(ret, 0); bp = std::unique_ptr(b, bundle_free); + ASSERT_EQ(ret, 0); char* str; ret = bundle_get_str(bp.get(), "Test", &str); diff --git a/unit_tests/src/rpc_port_test.cc b/unit_tests/src/rpc_port_test.cc index 601f4c4..666dfed 100644 --- a/unit_tests/src/rpc_port_test.cc +++ b/unit_tests/src/rpc_port_test.cc @@ -105,10 +105,11 @@ class RpcPortConnection : public RpcPortBase { rpc_port_h port, void *data) -> int { RpcPortConnection* p = static_cast(data); p->stub_port_ = port; - rpc_port_stub_get_port(p->stub_handle_, RPC_PORT_PORT_CALLBACK, + int ret = rpc_port_stub_get_port(p->stub_handle_, RPC_PORT_PORT_CALLBACK, instance, &p->stub_callback_port_); - p->Finish(); + if (ret != 0) + return -1; return 0; }, this); ASSERT_EQ(ret, 0); -- 2.7.4 From e45e07405b14e33b3d65a743e7e4f7f1865a4042 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 11 Feb 2019 18:38:07 +0900 Subject: [PATCH 15/16] Release version 1.3.6 Changes: - Fix static analysis issues Change-Id: I7e18d80851248de0d62e30d35aedc2a368d01eca Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index 675e137..d39e382 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -1,6 +1,6 @@ Name: rpc-port Summary: RPC Port library -Version: 1.3.5 +Version: 1.3.6 Release: 0 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From c2396a11234b29967c735d893b8ef6c8c69e9ca2 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 20 Feb 2019 09:40:05 +0900 Subject: [PATCH 16/16] Make weak dependencies - Uses "Recommends" instead of "Requires" Change-Id: Icd0fae74bd7ca931e606a4b87b930a5e1d24b2cf Signed-off-by: Hwankyu Jhun --- packaging/rpc-port.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/rpc-port.spec b/packaging/rpc-port.spec index d39e382..8239504 100755 --- a/packaging/rpc-port.spec +++ b/packaging/rpc-port.spec @@ -22,7 +22,7 @@ Requires(post): /sbin/ldconfig Requires(post): coreutils Requires(postun): /sbin/ldconfig -Requires: amd-mod-rpc-port +Recommends: amd-mod-rpc-port %description RPC Port library package. -- 2.7.4