-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathunit_test.sh
More file actions
executable file
·128 lines (113 loc) · 3.72 KB
/
unit_test.sh
File metadata and controls
executable file
·128 lines (113 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#!/bin/bash
#
## Copyright 2023 Comcast Cable Communications Management, LLC
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
## SPDX-License-Identifier: Apache-2.0
#
ENABLE_COV=false
if [ "x$1" = "x--enable-cov" ]; then
echo "Enabling coverage options"
export CXXFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
export CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage"
export LDFLAGS="-lgcov --coverage"
ENABLE_COV=true
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
automake --add-missing
autoreconf --install
./configure
make clean
make
cd ../uploadstblogs/unittest
cd ../..
sh cov_build.sh
cd -
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
git clone https://github.com/rdkcentral/rdk_logger.git
cp rdk_logger/include/rdk_logger.h /usr/local/include
automake --add-missing
autoreconf --install
./configure
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 $TOP_DIR/unittest/
for test in \
./dcm_utils_gtest \
./dcm_schedjob_gtest \
./dcm_cronparse_gtest \
./dcm_parseconf_gtest \
./dcm_rbus_gtest \
./dcm_gtest \
./../uploadstblogs/unittest/context_manager_gtest \
./../uploadstblogs/unittest/archive_manager_gtest \
./../uploadstblogs/unittest/md5_utils_gtest \
./../uploadstblogs/unittest/validation_gtest \
./../uploadstblogs/unittest/strategy_selector_gtest \
./../uploadstblogs/unittest/path_handler_gtest \
./../uploadstblogs/unittest/upload_engine_gtest \
./../uploadstblogs/unittest/cleanup_handler_gtest \
./../uploadstblogs/unittest/verification_gtest \
./../uploadstblogs/unittest/rbus_interface_gtest \
./../uploadstblogs/unittest/uploadstblogs_gtest \
./../uploadstblogs/unittest/event_manager_gtest \
./../uploadstblogs/unittest/retry_logic_gtest \
./../uploadstblogs/unittest/strategies_gtest \
./../uploadstblogs/unittest/strategy_handler_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
status=$?
if [ $status -ne 0 ]; then
echo "Test $test failed with exit code $status"
fail=1
fi
done
if [ $fail -ne 0 ]; then
echo "Some unit tests failed."
exit 1
else
echo "All unit tests passed."
fi
if [ "$ENABLE_COV" = true ]; then
echo "********************"
echo "**** CAPTURE DCM-AGENT COVERAGE DATA ****"
echo "********************"
echo "Generating coverage report"
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