-
Notifications
You must be signed in to change notification settings - Fork 2
Feature/usblogupload backup #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
93fa87b
3a561b2
2348d03
8e0faaa
7ca8df1
fafcdb8
210f256
806dd7e
df811f3
17de9ff
96c4b9d
56670aa
75604ac
c1585ab
cc12250
7b533c3
20d0301
e72dba1
78678fa
1504714
dfdc0bd
d78399d
18a6948
254e48c
131b615
1089a56
519cf24
a21a5c7
6821e5f
0ca2a37
b370575
edb3c1a
1c3073f
c6345e0
1b9819f
fa39b09
17b90d5
b7936c2
e0b3505
29a984a
f821841
6a33370
c65f987
3f29a1f
e1ea0bf
6bcffab
62aad49
80b482c
03e3c26
b818fe9
d79e1f5
d96f7ab
8418acb
57b9f76
995120d
aad24c0
8c25027
e826ce4
553c5ba
51888c5
01546fd
8cea413
d39cee0
6bf0533
4940298
f159ad9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
| ## SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
|
|
||
| ENABLE_COV=false | ||
| ENABLE_COV=true | ||
|
|
||
| if [ "x$1" = "x--enable-cov" ]; then | ||
| echo "Enabling coverage options" | ||
|
|
@@ -29,7 +29,8 @@ if [ "x$1" = "x--enable-cov" ]; then | |
| fi | ||
| export TOP_DIR=`pwd` | ||
| export top_srcdir=`pwd` | ||
|
|
||
| export LD_LIBRARY_PATH="/usr/local/lib:$TOP_DIR/uploadstblogs/src/.libs:$LD_LIBRARY_PATH" | ||
| echo "RDK_PROFILE=TV" >> /etc/device.properties | ||
| cd unittest/ | ||
| cp mocks/mockrbus.h /usr/local/include | ||
| cp ../uploadstblogs/include/*.h /usr/local/include | ||
|
|
@@ -42,6 +43,9 @@ make clean | |
| make | ||
|
|
||
| cd ../uploadstblogs/unittest | ||
| cd ../.. | ||
| sh cov_build.sh | ||
|
||
| cd - | ||
|
Comment on lines
+46
to
+48
|
||
| git clone https://github.com/rdkcentral/iarmmgrs.git | ||
| cp iarmmgrs/sysmgr/include/sysMgr.h /usr/local/include | ||
| cp iarmmgrs/maintenance/include/maintenanceMGR.h /usr/local/include | ||
|
|
@@ -55,9 +59,18 @@ autoreconf --install | |
|
|
||
| make clean | ||
| make | ||
| pwd | ||
| cd ../../usbLogUpload/unittest | ||
| automake --add-missing | ||
| autoreconf --install | ||
|
|
||
| ./configure | ||
|
|
||
| make clean | ||
| make | ||
| echo "RDK_PROFILE=TV" >> /etc/device.properties | ||
| fail=0 | ||
| cd - | ||
| cd $TOP_DIR/unittest/ | ||
|
|
||
| for test in \ | ||
| ./dcm_utils_gtest \ | ||
|
|
@@ -81,7 +94,11 @@ for test in \ | |
| ./../uploadstblogs/unittest/retry_logic_gtest \ | ||
| ./../uploadstblogs/unittest/strategies_gtest \ | ||
| ./../uploadstblogs/unittest/strategy_handler_gtest \ | ||
| ./../uploadstblogs/unittest/uploadlogsnow_gtest | ||
| ./../uploadstblogs/unittest/uploadlogsnow_gtest \ | ||
| ./../usbLogUpload/unittest/usb_log_file_manager_gtest \ | ||
| ./../usbLogUpload/unittest/usb_log_validation_gtest \ | ||
| ./../usbLogUpload/unittest/usb_log_utils_gtest \ | ||
| ./../usbLogUpload/unittest/usb_log_archive_gtest | ||
|
|
||
| do | ||
| $test | ||
|
|
@@ -107,5 +124,4 @@ if [ "$ENABLE_COV" = true ]; then | |
| lcov --capture --directory . --output-file coverage.info | ||
| lcov --remove coverage.info '/usr/*' --output-file coverage.info | ||
| lcov --remove coverage.info "${PWD}/*" --output-file coverage.info | ||
| lcov --list coverage.info | ||
| fi | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -20,7 +20,7 @@ AUTOMAKE_OPTIONS = subdir-objects | |||||
| ACLOCAL_AMFLAGS = -I m4 | ||||||
|
|
||||||
| # Define the test executables | ||||||
| bin_PROGRAMS = usb_log_file_manager_gtest usb_log_main_gtest usb_log_validation_gtest | ||||||
| bin_PROGRAMS = usb_log_file_manager_gtest usb_log_main_gtest usb_log_validation_gtest usb_log_archive_gtest usb_log_utils_gtest | ||||||
|
|
||||||
| # Common include directories | ||||||
| COMMON_CPPFLAGS = -I/usr/include/gtest -I/usr/local/include -I/usr/local/include/gtest \ | ||||||
|
|
@@ -29,9 +29,11 @@ COMMON_CPPFLAGS = -I/usr/include/gtest -I/usr/local/include -I/usr/local/include | |||||
|
|
||||||
| AM_CPPFLAGS = $(COMMON_CPPFLAGS) | ||||||
| AM_CXXFLAGS = -std=c++14 | ||||||
| export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | ||||||
| export LD_LIBRARY_PATH="$TOP_DIR/uploadstblogs/src/.libs:$LD_LIBRARY_PATH" | ||||||
|
|
||||||
|
Comment on lines
+32
to
34
|
||||||
| export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH | |
| export LD_LIBRARY_PATH="$TOP_DIR/uploadstblogs/src/.libs:$LD_LIBRARY_PATH" |
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,25 @@ | ||||||||||||
| AC_INIT([usbLogUpload-unittest], [1.0], [support@example.com]) | ||||||||||||
| AM_INIT_AUTOMAKE([foreign subdir-objects]) | ||||||||||||
| AC_CONFIG_SRCDIR([Makefile.am]) | ||||||||||||
| AC_CONFIG_HEADERS([config.h]) | ||||||||||||
|
|
||||||||||||
| # Checks for programs. | ||||||||||||
| AC_PROG_CC | ||||||||||||
| AC_PROG_CXX | ||||||||||||
| AC_PROG_INSTALL | ||||||||||||
|
|
||||||||||||
| # Checks for libraries. | ||||||||||||
| AC_CHECK_LIB([pthread], [pthread_create]) | ||||||||||||
| AC_CHECK_LIB([cjson], [cJSON_Parse]) | ||||||||||||
| AC_CHECK_LIB([curl], [curl_easy_init]) | ||||||||||||
| AC_CHECK_LIB([ssl], [SSL_library_init]) | ||||||||||||
| AC_CHECK_LIB([crypto], [CRYPTO_new_ex_data]) | ||||||||||||
| AC_CHECK_LIB([gtest], [main]) | ||||||||||||
| AC_CHECK_LIB([gmock], [main]) | ||||||||||||
|
||||||||||||
| AC_CHECK_LIB([gmock], [main]) | |
| AC_CHECK_LIB([gmock], [main]) | |
| AC_CHECK_LIB([rdkloggers], [main]) | |
| AC_CHECK_LIB([fwutils], [main]) | |
| AC_CHECK_LIB([uploadstblogs], [main]) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,59 @@ | ||||||||||||||||||||||||||||
| // Copyright 2026 | ||||||||||||||||||||||||||||
| // Unit tests for usb_log_archive.c | ||||||||||||||||||||||||||||
| #include <gtest/gtest.h> | ||||||||||||||||||||||||||||
| #include "usb_log_archive.h" | ||||||||||||||||||||||||||||
| #include <string> | ||||||||||||||||||||||||||||
| #include <cstdio> | ||||||||||||||||||||||||||||
| #include <sys/stat.h> | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Mocks and stubs for dependencies | ||||||||||||||||||||||||||||
| extern "C" { | ||||||||||||||||||||||||||||
| int get_current_timestamp(char *buf, size_t len) { | ||||||||||||||||||||||||||||
| strncpy(buf, "01/01/26-12:00:00", len-1); | ||||||||||||||||||||||||||||
| buf[len-1] = '\0'; | ||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+13
|
||||||||||||||||||||||||||||
| // Mocks and stubs for dependencies | |
| extern "C" { | |
| int get_current_timestamp(char *buf, size_t len) { | |
| strncpy(buf, "01/01/26-12:00:00", len-1); | |
| buf[len-1] = '\0'; | |
| #include <cstring> | |
| // Mocks and stubs for dependencies | |
| extern "C" { | |
| int get_current_timestamp(char *buf, size_t len) { | |
| std::strncpy(buf, "01/01/26-12:00:00", len - 1); | |
| buf[len - 1] = '\0'; |
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy_file_and_delete() is stubbed to always succeed without creating the destination file or deleting the source. This means the success test doesn’t verify the primary output (archive_path exists) and can leave files behind in temp_dir. Update the stub to mimic the real side effects and assert that archive_path exists on success.
Copilot
AI
Mar 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TearDown() uses rmdir(temp_dir) but the test can leave files inside temp_dir (e.g., archives created by create_archive()), causing cleanup to silently fail and potentially break later test runs. Remove files recursively (or use a unique temporary directory and ensure it’s fully deleted).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit_test.shappendsRDK_PROFILE=TVto/etc/device.propertiesunconditionally. This can create duplicate entries on repeated runs and makes test setup non-idempotent. Follow the pattern used elsewhere in the repo (grep before append, and create the file if missing) to keep the environment stable.