-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_l2.sh
More file actions
executable file
·167 lines (141 loc) · 5.88 KB
/
run_l2.sh
File metadata and controls
executable file
·167 lines (141 loc) · 5.88 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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# 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
#
export top_srcdir=`pwd`
RESULT_DIR="/tmp/l2_test_report"
mkdir -p "$RESULT_DIR"
WORKDIR=`pwd`
export ROOT=/usr
export INSTALL_DIR=${ROOT}/local
mkdir -p $INSTALL_DIR
git clone https://github.com/rdkcentral/common_utilities.git
cd common_utilities
git checkout develop
autoreconf -i
./configure --enable-rdkcertselector --prefix=${INSTALL_DIR} CFLAGS=" -DRDK_LOGGER "
make && make install
cd ../
#Build rdkfwupdater
autoreconf -i
./configure --prefix=${INSTALL_DIR} --enable-rdkcertselector=yes --enable-mountutils=yes --enable-rfcapi=yes CFLAGS="-DRDK_LOGGER"
make clean
make && make install
# Verify daemon binary was installed
echo ""
echo "Verifying rdkFwupdateMgr installation..."
if [ -f "/usr/local/bin/rdkFwupdateMgr" ]; then
echo "Daemon binary found: /usr/local/bin/rdkFwupdateMgr"
ls -lh /usr/local/bin/rdkFwupdateMgr
else
echo "ERROR: Daemon binary NOT found at /usr/local/bin/rdkFwupdateMgr"
echo " Tests will fail - build may have failed"
exit 1
fi
#./cov_build.sh
# Compile Test binary for mfrutils
cc -o /usr/bin/mfr_util test/functional-tests/tests/mfrutils.c
rbuscli setv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.Enable boolean true
rbuscli setv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.SWDLSpLimit.TopSpeed int 1280000
rbuscli setv Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DbgServices.Enable boolean true
cp test/functional-tests/tests/rc-proxy-params.json /tmp/rc-proxy-params.json
# ========================================
# Start D-Bus System Daemon (Required for D-Bus tests)
# ========================================
mkdir -p /etc/dbus-1/system.d
cp test/functional-tests/tests/org.rdkfwupdater.Service.conf /etc/dbus-1/system.d/
pkill -HUP dbus-daemon 2>/dev/null || true
sleep 1
echo ""
echo "Starting D-Bus system daemon..."
# Check if D-Bus is already running
if ! pgrep -x "dbus-daemon" > /dev/null; then
# Ensure D-Bus runtime directory exists
mkdir -p /run/dbus
# Start D-Bus system daemon
dbus-daemon --system --fork
# Wait for D-Bus to be ready
sleep 2
# Verify D-Bus started successfully
if pgrep -x "dbus-daemon" > /dev/null; then
echo " D-Bus daemon started successfully"
else
echo "ERROR: Failed to start D-Bus daemon"
echo " D-Bus tests will fail!"
fi
else
echo "D-Bus daemon already running"
fi
echo ""
echo "=========================================="
echo "Running L2 Integration Tests"
echo "=========================================="
echo ""
# ========================================
# PHASE 1: Standard Certificate Tests (client.p12)
# ========================================
echo "[Phase 1/3] Running standard tests with normal certificates..."
# Run all existing tests
echo "Running existing image download tests..."
pytest --json-report --json-report-file $RESULT_DIR/rdkfwupdater_image_tests.json \
test/functional-tests/tests/test_imagedwnl.py \
test/functional-tests/tests/test_imagedwnl_error.py \
test/functional-tests/tests/test_certbundle_dwnl.py \
test/functional-tests/tests/test_peripheral_imagedwnl.py
# ========================================
# PHASE 2: D-Bus Handler and Cache Tests
# ========================================
# Run new D-Bus handler and cache tests
echo ""
echo "[Phase 2/3] Running D-Bus handler and cache tests..."
pytest -v -s --json-report --json-report-file $RESULT_DIR/rdkfwupdater_dbus_tests.json \
test/functional-tests/tests/test_dbus_DownloadFirmware.py \
test/functional-tests/tests/test_dbus_UnregisterProcess.py \
test/functional-tests/tests/test_dbus_CheckForUpdate.py \
test/functional-tests/tests/test_dbus_RegisterProcess.py \
test/functional-tests/tests/test_dbus_UpdateFirmware.py
# ========================================
# PHASE 3: PKCS#11 Certificate Fallback Test (if enabled)
# ========================================
if [ "$ENABLE_PKCS11" = "true" ]; then
echo ""
echo "=========================================="
echo "[Phase 3/3] PKCS#11 Certificate Fallback Test"
echo "=========================================="
echo ""
echo "Note: This phase tests PKCS#11 behavior when reference.p12 is not available."
echo " It validates certselector fallback to client.p12/client.pem"
echo " when reference.p12 is missing or unavailable."
echo ""
# Run PKCS#11 fallback test (removes reference.p12, verifies fallback to client.p12/client.pem)
echo "Running certificate fallback test..."
pytest -v -s --json-report --json-report-file $RESULT_DIR/rdkfwupdater_pkcs11_fallback_tests.json \
test/functional-tests/tests/test_pkcs11_fallback.py
echo ""
echo "PKCS#11 fallback test report: $RESULT_DIR/rdkfwupdater_pkcs11_fallback_tests.json"
else
echo ""
echo "=========================================="
echo "PKCS#11 fallback test skipped (ENABLE_PKCS11 not set)"
echo "To enable: export ENABLE_PKCS11=true"
echo "=========================================="
fi
echo ""
echo "=========================================="
echo "L2 Test Results"
echo "=========================================="
echo "Image tests report: $RESULT_DIR/rdkfwupdater_image_tests.json"
echo "D-Bus tests report: $RESULT_DIR/rdkfwupdater_dbus_tests.json"
echo "=========================================="