-
Notifications
You must be signed in to change notification settings - Fork 42
executable file
·251 lines (230 loc) · 9.04 KB
/
L2-tests.yml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
name: DobbyL2Test
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
compiler: [ gcc, clang ]
coverage: [ with-coverage, without-coverage ]
exclude:
- compiler: clang
coverage: with-coverage
- compiler: clang
coverage: without-coverage
- compiler: gcc
coverage: without-coverage
# The matrix will try all possible combinations of the below arrays
# If adding a new cmake option, include both the ON and OFF version to ensure the
# matrix runs both versions
build_type: ["Debug"]
extra_flags: [ "-DLEGACY_COMPONENTS=ON"]
name: Build in ${{ matrix.build_type }} Mode (${{ matrix.extra_flags }})
steps:
- name: Install packages
run: >
sudo apt update
&&
sudo apt install -y build-essential cmake make git gcc pkgconf libtool libctemplate-dev libjsoncpp-dev libdbus-1-dev libsystemd-dev libyajl-dev libcap-dev go-md2man autoconf automake libseccomp-dev libboost-dev valgrind libcunit1-dev liblog4c-dev libfreetype6-dev libjpeg-dev xorg-dev python3 python3-pip libarchive-dev libcurl4 libcurl4-gnutls-dev libssl-dev libgpgme11-dev libtool-bin libarchive13 bison flex clang lcov figlet dbus libdbus-glib-1-dev dbus-user-session systemd libpam-systemd gnome-keyring iptables libprotobuf-c-dev
- name: Set gcc/with-coverage toolchain
if: ${{ matrix.compiler == 'gcc' && matrix.coverage == 'with-coverage' }}
run: echo "TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/Dobby/tests/gcc-with-coverage.cmake" >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- run: |
pip install jsonref
pip install coverage
- name: Set up CMake
uses: jwlawson/[email protected]
with:
cmake-version: '3.16.x'
- name: Checkout Dobby
uses: actions/checkout@v4
with:
path: Dobby
- name: Install gmock
run: |
cd $GITHUB_WORKSPACE
git clone https://github.com/google/googletest.git -b release-1.11.0
cd googletest
mkdir build
cd build
cmake ..
make
sudo make install
- name: Install crun
run: |
cd $GITHUB_WORKSPACE
git clone https://github.com/containers/crun.git
cd crun
./autogen.sh
./configure
sudo make install -j$(nproc)
sudo ln -sf /usr/local/bin/crun /usr/bin/crun
- name: Install SMCROUTE
run: |
cd $GITHUB_WORKSPACE
git clone --depth 1 --branch 2.5.5 https://github.com/troglobit/smcroute.git
cd smcroute
./autogen.sh
./configure
sudo make install -j$(nproc)
sudo ln -sf /usr/local/sbin/smcroutectl /usr/sbin/smcroutectl
sudo mkdir -p /usr/local/var/run
sudo systemctl enable smcroute
- name: Install libnl
run: |
cd $GITHUB_WORKSPACE
git clone --depth 1 --branch libnl3_5_0 https://github.com/thom311/libnl.git
cd libnl
./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc --disable-static
sudo make install -j$(nproc)
- name: Set DBUS config
run: |
sudo touch /etc/dbus-1/system.d/org.rdk.dobby.conf
sudo chmod -R 777 /etc/dbus-1/system.d/org.rdk.dobby.conf
sudo echo '<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy context="default">
<!-- Allow everything to be sent -->
<allow send_destination="*" eavesdrop="true"/>
<!-- Allow everything to be received -->
<allow eavesdrop="true"/>
<!-- Allow anyone to own anything -->
<allow own="*"/>
<!-- XXX: Allow all users to connect -->
<allow user="*"/>
</policy>
</busconfig>' > "/etc/dbus-1/system.d/org.rdk.dobby.conf"
- name: build Dobby
run: |
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
cd Dobby
sudo cp /usr/lib/x86_64-linux-gnu/dbus-1.0/include/dbus/dbus-arch-deps.h /usr/include/dbus-1.0/dbus
sudo mkdir -p /usr/lib/plugins/dobby
sudo mkdir -p /opt/persistent/rdk
sudo mkdir -p /var/volatile/rdk/dobby/bundles
sudo chmod 755 /var/volatile/rdk/dobby/bundles
mkdir -p build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}" -DRDK_PLATFORM=DEV_VM -DCMAKE_INSTALL_PREFIX:PATH=/usr ${{ matrix.extra_flags }} -DRDK=ON -DUSE_SYSTEMD=ON -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DAI_BUILD_TYPE=AI_DEBUG -DDOBBY_HIBERNATE_MEMCR_IMPL=ON ..
make -j $(nproc)
sudo make install
# Link for the DobbyInit tool
sudo ln -sf /usr/local/libexec/ /usr/libexec
sudo ln -sf /lib/x86_64-linux-gnu/libreadline.so.* /lib/
- name: build memcr
run: |
mkdir -p ~/memcr
cd ~/memcr
git clone https://github.com/LibertyGlobal/memcr.git .
make COMPRESS_LZ4=1 CHECKSUM_MD5=1 ENCRYPT=1
mkdir -p scripts
cp $GITHUB_WORKSPACE/Dobby/develop/vagrant/memcr/start_memcr.sh ~/memcr/scripts/
- name: Checkout srcThunder
run: |
cd $GITHUB_WORKSPACE
git clone -b R2 https://github.com/rdkcentral/Thunder.git
git clone -b R2 https://github.com/rdkcentral/ThunderInterfaces.git
git clone -b R2 https://github.com/rdkcentral/ThunderClientLibraries.git
git clone https://github.com/rdkcentral/rdkservices.git
- name: Build Thunder
run: >
cmake
-S "$GITHUB_WORKSPACE/Thunder/Tools"
-B build/ThunderTools
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake"
-DGENERIC_CMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake"
&&
sudo make -j4 -C build/ThunderTools
&&
sudo make -C build/ThunderTools install
&&
cmake
-S "$GITHUB_WORKSPACE/Thunder"
-B build/Thunder
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake"
-DBUILD_TYPE=${{ matrix.build_type }}
-DBINDING=127.0.0.1
-DPORT=9998
&&
sudo cmake --build build/Thunder -j4
&&
sudo cmake --install build/Thunder
- name: Build ThunderInterfaces
run: >
cmake
-S "$GITHUB_WORKSPACE/ThunderInterfaces"
-B build/ThunderInterfaces
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake"
&&
sudo cmake --build build/ThunderInterfaces -j4
&&
sudo cmake --install build/ThunderInterfaces
- name: Build ThunderClientLibraries
run: >
cmake
-S "$GITHUB_WORKSPACE/ThunderClientLibraries"
-B build/ThunderClientLibraries
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake"
-DVIRTUALINPUT=ON
&&
sudo cmake --build build/ThunderClientLibraries -j4
&&
sudo cmake --install build/ThunderClientLibraries
- name: Build rdkservices
run: >
cmake
-S "$GITHUB_WORKSPACE/rdkservices"
-B build/rdkservices
-DCMAKE_TOOLCHAIN_FILE="${{ env.TOOLCHAIN_FILE }}"
-DCMAKE_INSTALL_PREFIX=/usr
-DCMAKE_MODULE_PATH="$GITHUB_WORKSPACE/install/tools/cmake"
-DCOMCAST_CONFIG=OFF
-DPLUGIN_OCICONTAINER=ON
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
&&
sudo cmake --build build/rdkservices -j4
&&
sudo cmake --install build/rdkservices
- name: Run the l2 test
working-directory: Dobby/tests/L2_testing/test_runner/
run: |
python3 runner.py -p 3 -v 5
cp $GITHUB_WORKSPACE/Dobby/tests/L2_testing/test_runner/DobbyL2TestResults.json $GITHUB_WORKSPACE
- name: Generate coverage
if: ${{ matrix.coverage == 'with-coverage' }}
run: >
lcov -c
-o coverage.info
-d $GITHUB_WORKSPACE
&&
lcov
-r coverage.info
'/usr/include/*'
'*/tests/L1_testing/*'
'*/tests/L2_testing/*'
-o filtered_coverage.info
&&
genhtml
-o l2coverage/${{ matrix.build_type }}/${{ matrix.extra_flags }}/coverage
-t "dobby coverage"
filtered_coverage.info
- name: Upload artifacts
if: ${{ !env.ACT && matrix.coverage == 'with-coverage' }}
uses: actions/upload-artifact@v4
with:
name: artifacts
path: |
DobbyL2TestResults.json
l2coverage
if-no-files-found: warn