From 185d90833f144989d77fbec50cfd9c240ac4009e Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 15 Sep 2020 17:02:46 +0900 Subject: [PATCH 01/16] Release version 0.5.6 Changes: - Fix static analysis issue Change-Id: Ibf5042d977cccaabbcbf9e7b42d8c432cdc8819d Signed-off-by: Junghyun Yeon --- packaging/librua.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index 6c6af0d..dc7ca41 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,5 +1,5 @@ Name: librua -Version: 0.5.5 +Version: 0.5.6 Release: 0 License: Apache-2.0 Summary: Recently used application -- 2.7.4 From 45b3581fa81639109da942b48ad8bb1e96e50c68 Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Tue, 15 Sep 2020 17:35:04 +0900 Subject: [PATCH 02/16] Fix static analysis issue Change-Id: If3fb2f3e8389f1a5ac5c86c2a53a14363e0b0cbb Signed-off-by: Junghyun Yeon --- tests/unittest/rua_manager_unit_test.cc | 1 + tests/unittest/rua_unit_test.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/unittest/rua_manager_unit_test.cc b/tests/unittest/rua_manager_unit_test.cc index f066c8b..d596b60 100644 --- a/tests/unittest/rua_manager_unit_test.cc +++ b/tests/unittest/rua_manager_unit_test.cc @@ -92,6 +92,7 @@ out: free(table[i]); } + free(table); return nullptr; } diff --git a/tests/unittest/rua_unit_test.cc b/tests/unittest/rua_unit_test.cc index 3021478..87146f8 100644 --- a/tests/unittest/rua_unit_test.cc +++ b/tests/unittest/rua_unit_test.cc @@ -160,6 +160,7 @@ out: free(table[i]); } + free(table); return nullptr; } -- 2.7.4 From d5050b542b2b5d0a445920ef5888c8ba153b492c Mon Sep 17 00:00:00 2001 From: Junghyun Yeon Date: Wed, 16 Sep 2020 13:37:51 +0900 Subject: [PATCH 03/16] Release version 0.5.7 Changes: - Fix static analysis issue Change-Id: I23ffaabbb78bef5a5652aed31c4ae1937d573801 Signed-off-by: Junghyun Yeon --- packaging/librua.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index dc7ca41..c5386fe 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,5 +1,5 @@ Name: librua -Version: 0.5.6 +Version: 0.5.7 Release: 0 License: Apache-2.0 Summary: Recently used application -- 2.7.4 From 3c2bc2ca84f98d0774be350621a37a44a25f1416 Mon Sep 17 00:00:00 2001 From: hyunho Date: Thu, 17 Sep 2020 14:36:54 +0900 Subject: [PATCH 04/16] Fix gtest memory leak Change-Id: I3f46a47e5d22e8aaff0d493352b7d6112452cf94 Signed-off-by: hyunho --- tests/unittest/rua_manager_unit_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unittest/rua_manager_unit_test.cc b/tests/unittest/rua_manager_unit_test.cc index d596b60..b0428e5 100644 --- a/tests/unittest/rua_manager_unit_test.cc +++ b/tests/unittest/rua_manager_unit_test.cc @@ -402,7 +402,7 @@ TEST_F(RuaManagerTest, rua_info_get_label) { WillOnce(Return(0)); char* label; - int ret = rua_info_get_label(info_, &label); + auto p = std::unique_ptr(label, std::free); EXPECT_EQ(ret, 0); } \ No newline at end of file -- 2.7.4 From 6d14b4560bd78fdddf90d6054643c90582db04d4 Mon Sep 17 00:00:00 2001 From: hyunho Date: Thu, 17 Sep 2020 14:38:08 +0900 Subject: [PATCH 05/16] Release version 0.5.8 Changes: - Fix gtest memory leak Change-Id: I9cd8cd1bc9925c2a077ba6c49880a3fc5bc3ed51 Signed-off-by: hyunho --- packaging/librua.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index c5386fe..17baa7c 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,5 +1,5 @@ Name: librua -Version: 0.5.7 +Version: 0.5.8 Release: 0 License: Apache-2.0 Summary: Recently used application -- 2.7.4 From 7c436c0ca677065ed34c99e613e7b8fea019dcad Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 6 Oct 2020 12:17:12 +0900 Subject: [PATCH 06/16] Fix memory leak Change-Id: I93819b930a3ebe430b7849eab1d6cd466a324533 Signed-off-by: hyunho --- tests/unittest/rua_unit_test.cc | 124 ++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/tests/unittest/rua_unit_test.cc b/tests/unittest/rua_unit_test.cc index 87146f8..d8d13b7 100644 --- a/tests/unittest/rua_unit_test.cc +++ b/tests/unittest/rua_unit_test.cc @@ -32,6 +32,60 @@ using ::testing::DoAll; using ::testing::SetArgPointee; using ::testing::Return; +static char** __create_table(void) { + char** table = (char** )calloc(10, sizeof(char*)); + table[0] = strdup("pkgname"); + if (table[0] == nullptr) + goto out; + + table[1] = strdup("apppath"); + if (table[1] == nullptr) + goto out; + + table[2] = strdup("arg"); + if (table[2] == nullptr) + goto out; + + table[3] = strdup("122232"); + if (table[3] == nullptr) + goto out; + + table[4] = strdup("instance_id"); + if (table[4] == nullptr) + goto out; + + table[5] = strdup("instance_name"); + if (table[5] == nullptr) + goto out; + + table[6] = strdup("icon"); + if (table[6] == nullptr) + goto out; + + table[7] = strdup("uri"); + if (table[7] == nullptr) + goto out; + + table[8] = strdup("image"); + if (table[8] == nullptr) + goto out; + + table[9] = strdup("compid"); + if (table[9] == nullptr) + goto out; + + return table; + +out: + for (int i = 0; i < 10; i++) { + if (table[i]) + free(table[i]); + } + + free(table); + return nullptr; +} + class Mocks : public ::testing::NiceMock, public ::testing::NiceMock, public ::testing::NiceMock {}; @@ -42,10 +96,17 @@ class RuaTest : public TestFixture { virtual ~RuaTest() {} virtual void SetUp() { + table_ = __create_table(); } virtual void TearDown() { + if (table_) { + for (int i = 0; i < 10; i++) + free(table_[i]); + free(table_); + } } + char** table_ = nullptr; }; static void __rua_history_update_cb(char** table, int nrows, int ncols, @@ -110,63 +171,8 @@ TEST_F(RuaTest, rua_unregister_update_cb_N) { EXPECT_NE(ret, 0); } -static char** __create_table(void) { - char** table = (char** )calloc(10, sizeof(char*)); - table[0] = strdup("pkgname"); - if (table[0] == nullptr) - goto out; - - table[1] = strdup("apppath"); - if (table[1] == nullptr) - goto out; - - table[2] = strdup("arg"); - if (table[2] == nullptr) - goto out; - - table[3] = strdup("122232"); - if (table[3] == nullptr) - goto out; - - table[4] = strdup("instance_id"); - if (table[4] == nullptr) - goto out; - - table[5] = strdup("instance_name"); - if (table[5] == nullptr) - goto out; - - table[6] = strdup("icon"); - if (table[6] == nullptr) - goto out; - - table[7] = strdup("uri"); - if (table[7] == nullptr) - goto out; - - table[8] = strdup("image"); - if (table[8] == nullptr) - goto out; - - table[9] = strdup("compid"); - if (table[9] == nullptr) - goto out; - - return table; - -out: - for (int i = 0; i < 10; i++) { - if (table[i]) - free(table[i]); - } - - free(table); - return nullptr; -} - TEST_F(RuaTest, rua_history_get_rec) { - char** table = __create_table(); - ASSERT_TRUE(table != nullptr); + ASSERT_TRUE(table_ != nullptr); EXPECT_CALL(GetMock(), sqlite3_open_v2(_, _, _, _)).WillOnce(Return(0)); @@ -178,7 +184,7 @@ TEST_F(RuaTest, rua_history_get_rec) { sqlite3_busy_handler(_, _, _)).WillOnce(Return(0)); EXPECT_CALL(GetMock(), sqlite3_get_table(_, _, _, _, _, _)). - WillOnce(DoAll(SetArgPointee<2>(table), + WillOnce(DoAll(SetArgPointee<2>(table_), SetArgPointee<3>(1), SetArgPointee<4>(0), (Return(0)))); @@ -195,10 +201,6 @@ TEST_F(RuaTest, rua_history_get_rec) { EXPECT_EQ(ret, 0); rua_history_unload_db(&get_table); - - for (int i = 0; i < 10; i++) - free(table[i]); - free(table); } TEST_F(RuaTest, rua_is_latest_app_N) { -- 2.7.4 From c89f708af7a2930c31e513cfb920c3403dd14995 Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 6 Oct 2020 12:22:51 +0900 Subject: [PATCH 07/16] Null check for GError Change-Id: Ie556db6f53f861bb4afb054905d6e9662456e068 Signed-off-by: hyunho --- src/rua_dbus.c | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/src/rua_dbus.c b/src/rua_dbus.c index aae2c28..e910328 100644 --- a/src/rua_dbus.c +++ b/src/rua_dbus.c @@ -66,17 +66,25 @@ int rua_dbus_send_update_signal(update_type type) RUA_SIGNAL_DATA_UPDATE, g_variant_new("(i)", type), &err) == FALSE) { - LOGE("g_dbus_connection_emit_signal() is failed. %s", - err->message); - g_clear_error(&err); + if (err != NULL) { + LOGE("g_dbus_connection_emit_signal() is failed. %s", + err->message); + g_clear_error(&err); + } else { + LOGE("g_dbus_connection_emit_signal() is failed"); + } __rua_dbus_exit(); return -1; } if (g_dbus_connection_flush_sync(conn, NULL, &err) == FALSE) { - LOGE("g_dbus_connection_flush_sync() is failed. %s", - err->message); - g_clear_error(&err); + if (err != NULL) { + LOGE("g_dbus_connection_flush_sync() is failed. %s", + err->message); + g_clear_error(&err); + } else { + LOGE("g_dbus_connection_emit_signal() is failed"); + } __rua_dbus_exit(); return -1; } @@ -208,14 +216,20 @@ static void __signal_handler(GDBusConnection *connection, static void __rua_dbus_init(void) { - if (!conn) { - GError *err = NULL; - conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); - if (!conn) { - LOGE("g_bus_get_sync() is failed. %s", err->message); - g_error_free(err); - return; - } + GError *err = NULL; + + if (conn) + return; + + conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); + if (conn) + return; + + if (err != NULL) { + LOGE("g_bus_get_sync() is failed. %s", err->message); + g_error_free(err); + } else { + LOGE("g_bus_get_sync() is failed."); } } -- 2.7.4 From c15c8205f1abcf3c2c68f67ce14e72b0d80510e0 Mon Sep 17 00:00:00 2001 From: hyunho Date: Tue, 6 Oct 2020 12:42:38 +0900 Subject: [PATCH 08/16] Release version 0.5.9 Changes: - Fix memory leak - Null check for GError Change-Id: I0552e4c20fdb893ba3b71a0060e0e4af65f6fbf3 Signed-off-by: hyunho --- packaging/librua.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index 17baa7c..9f04afd 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,5 +1,5 @@ Name: librua -Version: 0.5.8 +Version: 0.5.9 Release: 0 License: Apache-2.0 Summary: Recently used application -- 2.7.4 From a98771ba3a84d2ecc56f28a11e7827b6b7bdfa70 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 12 Mar 2021 13:06:01 +0900 Subject: [PATCH 09/16] Reduce error logs To reduce unnecessary error logs, this patch adds if statement to check that the paramter is nullptr. Change-Id: I6645a22720f8e63e60715e53fb1e06931cdf4c99 Signed-off-by: Hwankyu Jhun --- src/rua_info.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/rua_info.c b/src/rua_info.c index 42df487..59fd2bb 100644 --- a/src/rua_info.c +++ b/src/rua_info.c @@ -244,6 +244,9 @@ static void __rua_info_remove_comp_info(void *data) { aul_comp_info_h comp_info; + if (!data) + return; + comp_info = (aul_comp_info_h)data; aul_comp_info_destroy(comp_info); } -- 2.7.4 From ab04dc84993977d7331080ceebb9a98e09724ee4 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 15 Mar 2021 17:49:23 +0900 Subject: [PATCH 10/16] Release version 0.5.10 Changes: - Reduce error logs Change-Id: I358745b0515cc9883236aca0460e10bc40abdca9 Signed-off-by: Hwankyu Jhun --- packaging/librua.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index 9f04afd..9134cdd 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,5 +1,5 @@ Name: librua -Version: 0.5.9 +Version: 0.5.10 Release: 0 License: Apache-2.0 Summary: Recently used application -- 2.7.4 From c01f377e632d3bea490369e8d8f44026cb47a16a Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Mon, 15 Nov 2021 17:15:30 +0900 Subject: [PATCH 11/16] Fix memory leak Change-Id: Ia44a0d5d8ce02297553c180b3ba28d43b057956d Signed-off-by: Changgyu Choi --- src/rua_util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rua_util.c b/src/rua_util.c index ee83521..82baede 100644 --- a/src/rua_util.c +++ b/src/rua_util.c @@ -84,6 +84,7 @@ int _rua_util_open_db(sqlite3 **db, int flags, uid_t uid, char *db_name) r = sqlite3_busy_handler(*db, __db_busy_handler, NULL); if (r != SQLITE_OK) { LOGE("register busy handler failed: %s", sqlite3_errmsg(*db)); + sqlite3_close_v2(*db); return -1; } -- 2.7.4 From bf743374e1285c2ae8189d2d0a6fcbf5050d5306 Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Mon, 15 Nov 2021 18:59:45 +0900 Subject: [PATCH 12/16] Release version 0.5.11 Changes: - Fix memory leak Change-Id: Ibfd49ddef061ab6a63bff38bcd351abc12da2656 Signed-off-by: Changgyu Choi --- packaging/librua.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index 9134cdd..28c2aab 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,5 +1,5 @@ Name: librua -Version: 0.5.10 +Version: 0.5.11 Release: 0 License: Apache-2.0 Summary: Recently used application -- 2.7.4 From d813b8af008409575b650c4614591f5085c14672 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 20 Jan 2022 14:38:16 +0900 Subject: [PATCH 13/16] Fix installation path of gcov result Change-Id: I4ef307d3217bc94fdb76f2dace4e0c39cd39dc87 Signed-off-by: Hwankyu Jhun --- packaging/librua.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index 28c2aab..aed845d 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -77,8 +77,8 @@ install -m 0644 rua.zip %{buildroot}%{_datadir}/gcov/ %make_install %if 0%{?gcov:1} -mkdir -p %{buildroot}%{_datadir}/gcov/obj -install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj +mkdir -p %{buildroot}%{_datadir}/gcov/obj/%{name} +install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name} %endif %post -p /sbin/ldconfig -- 2.7.4 From da2da8365ab895c945fd1b618f0b350ea437428f Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 20 Jan 2022 15:17:33 +0900 Subject: [PATCH 14/16] Release version 0.5.12 Changes: - Fix installation path of gcov result Change-Id: Iafbce07d6af24da5d298cdaee95632180017ecc6 Signed-off-by: Hwankyu Jhun --- packaging/librua.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index aed845d..c57f611 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,5 +1,5 @@ Name: librua -Version: 0.5.11 +Version: 0.5.12 Release: 0 License: Apache-2.0 Summary: Recently used application -- 2.7.4 From 5a5e475537cd874b540ccbf7859fe5050f6fe15d Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Thu, 26 May 2022 15:08:25 +0900 Subject: [PATCH 15/16] Fix spec file for coverage measurement To measure code coverages automatically, a run-unittest.sh is needed. Change-Id: I1c626b6c94af086b0522328c2dbb9c6d34df5bd5 Signed-off-by: Changgyu Choi --- packaging/librua.spec | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index c57f611..e69c26a 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -33,11 +33,11 @@ Requires: %{name} = %{version} %description devel Recently used application library (devel) -%package test +%package unittests Summary: Recently used application (test) Requires: %{name} = %{version} -%description test +%description unittests Recently used application library (test) %prep @@ -59,11 +59,6 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` make %{?_smp_mflags} -%if 0%{?gcov:1} -mkdir -p gcov-obj -find . -name '*.gcno' -exec cp '{}' gcov-obj ';' -%endif - %check (cd tests && cd unittest && LD_LIBRARY_PATH=../../ ctest -V) %if 0%{?gcov:1} @@ -77,10 +72,39 @@ install -m 0644 rua.zip %{buildroot}%{_datadir}/gcov/ %make_install %if 0%{?gcov:1} -mkdir -p %{buildroot}%{_datadir}/gcov/obj/%{name} -install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name} +builddir=$(basename $PWD) +gcno_obj_dir=%{buildroot}%{_datadir}/gcov/obj/%{name}/"$builddir" +mkdir -p "$gcno_obj_dir" +find . -name '*.gcno' -exec cp --parents '{}' "$gcno_obj_dir" ';' %endif +cat << EOF > run-unittest.sh +#!/bin/sh +setup() { + echo "setup start" +} + +test_main() { + echo "test_main start" + /usr/bin/rua-test +} + +teardown() { + echo "teardown start" +} + +main() { + setup + test_main + teardown +} + +main "\$*" +EOF + +mkdir -p %{buildroot}%{_bindir}/tizen-unittests/%{name} +install -m 0755 run-unittest.sh %{buildroot}%{_bindir}/tizen-unittests/%{name}/ + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig @@ -99,10 +123,11 @@ install -m 0644 gcov-obj/* %{buildroot}%{_datadir}/gcov/obj/%{name} %{_libdir}/librua.so %{_libdir}/pkgconfig/rua.pc -%files test +%files unittests %manifest %{name}.manifest %defattr(-,root,root,-) %{_bindir}/rua-test +%{_bindir}/tizen-unittests/%{name}/run-unittest.sh ################################################# # rua-gcov -- 2.7.4 From fb6d048dd3e24f4ec0a0b11f5b5e7ab517ba4e50 Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Fri, 27 May 2022 10:39:38 +0900 Subject: [PATCH 16/16] Release version 0.5.13 Changes: - Fix spec file for coverage measurement Change-Id: I9135d58fd7f53954564cf3a35f206324f242a561 Signed-off-by: Changgyu Choi --- packaging/librua.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/librua.spec b/packaging/librua.spec index e69c26a..d269711 100644 --- a/packaging/librua.spec +++ b/packaging/librua.spec @@ -1,5 +1,5 @@ Name: librua -Version: 0.5.12 +Version: 0.5.13 Release: 0 License: Apache-2.0 Summary: Recently used application -- 2.7.4