Skip to content

Commit

Permalink
Merge pull request #313 from KaleeswaranGnanagurusamy/master
Browse files Browse the repository at this point in the history
[RDK-46381] Fix the networking and command_line_containers related is…
  • Loading branch information
goruklu committed Feb 20, 2024
2 parents d64aed1 + f2bd727 commit b7911c4
Show file tree
Hide file tree
Showing 15 changed files with 102 additions and 26 deletions.
37 changes: 31 additions & 6 deletions .github/workflows/L2-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ jobs:
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 valgrind lcov figlet dbus libdbus-glib-1-dev dbus-user-session systemd libpam-systemd gnome-keyring iptables libprotobuf-c-dev
- name: Set clang toolchain
if: ${{ matrix.compiler == 'clang' }}
run: echo "TOOLCHAIN_FILE=${GITHUB_WORKSPACE}/Dobby/tests/clang.cmake" >> $GITHUB_ENV
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' }}
Expand Down Expand Up @@ -118,6 +114,7 @@ jobs:
- 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
Expand Down Expand Up @@ -211,5 +208,33 @@ jobs:
- name: Run the l2 test
working-directory: Dobby/tests/L2_testing/test_runner/
run: |
python3 runner.py -p 1 -v 5
python3 runner.py -p 3 -v 5
- 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@v3
with:
name: artifacts
path: |
l2coverage
if-no-files-found: warn

2 changes: 1 addition & 1 deletion daemon/process/settings/dobby.dev_vm.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],

"network": {
"externalInterfaces": [ "enp0s8", "enp0s3" ],
"externalInterfaces": [ "enp0s8", "enp0s3", "docker0", "eth0" ],
"addressRange": "100.64.11.0"
},

Expand Down
6 changes: 6 additions & 0 deletions develop/vagrant/Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ Vagrant.configure("2") do |config|
figlet DEPENDENCIES # ASCII banner
apt install -y build-essential cmake make git gcc pkgconf libtool libctemplate-dev libjsoncpp-dev libjsoncpp1 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
#
# To resolve DNS server resolver
#
sudo ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
#
# Create build folders, links etc...
#
Expand Down
34 changes: 34 additions & 0 deletions tests/L2_testing/dobby_specs/mounts-github-workflow-vm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"version": "1.0",
"cwd": "/",
"args": [
"cat",
"/files/sample.txt"
],
"env": [
],
"user": {
"uid": 1000,
"gid": 1000
},
"console": {
"limit": 65536,
"path": "/tmp/mounts-github-workflow-vm.log"
},
"etc": {
"group": [
"root:x:0:"
],
"passwd": [
"root::0:0:root:/:/bin/false"
]
},
"memLimit": 41943040,
"network": "nat",
"mounts": [{
"destination": "/files",
"options": ["rbind", "ro", "nosuid", "nodev"],
"source": "/home/runner/work/Dobby/Dobby/Dobby/tests/L2_testing/test_runner/files",
"type": "bind"
}]
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"console": {
"limit": 65536,
"path": "/tmp/mounts-vm.log"
"path": "/tmp/mounts-vagrant-vm.log"
},
"etc": {
"group": [
Expand All @@ -28,7 +28,7 @@
"mounts": [{
"destination": "/files",
"options": ["rbind", "ro", "nosuid", "nodev"],
"source": "/home/vagrant/srcDobby/tests/test_runner/files",
"source": "/home/vagrant/srcDobby/tests/L2_testing/test_runner/files",
"type": "bind"
}]
}
}
3 changes: 2 additions & 1 deletion tests/L2_testing/dobby_specs/wget-private.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"cwd": "/",
"args": [
"wget",
"--timeout=5",
"example.com"
],
"env": [
Expand Down Expand Up @@ -39,4 +40,4 @@
"nodev"
]
}]
}
}
2 changes: 1 addition & 1 deletion tests/L2_testing/test_runner/basic_sanity_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@


def execute_test():
if test_utils.selected_platform != test_utils.Platforms.virtual_machine:
if test_utils.selected_platform != test_utils.Platforms.vagrant_vm and test_utils.selected_platform != test_utils.Platforms.github_workflow_vm:
return test_utils.print_unsupported_platform(basename(__file__), test_utils.selected_platform)

output_table = []
Expand Down
Binary file modified tests/L2_testing/test_runner/bundle/network1_bundle.tar.gz
Binary file not shown.
Binary file modified tests/L2_testing/test_runner/bundle/sleepy-thunder_bundle.tar.gz
100755 → 100644
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/L2_testing/test_runner/bundle_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def execute_test():
test_utils.get_bundle_path(test.container_id),
bundle_path])

output = test_utils.create_simple_test_output(test, status.stdout is "", "", status.stdout)
output = test_utils.create_simple_test_output(test, (status.stdout == ""), "", status.stdout)
output_table.append(output)
test_utils.print_single_result(output)

Expand All @@ -82,7 +82,7 @@ def execute_test():
"-rf",
test_utils.get_bundle_path(test.container_id)])

output = test_utils.create_simple_test_output(test, status.stderr is "", "", status.stderr)
output = test_utils.create_simple_test_output(test, (status.stderr == ""), "", status.stderr)
output_table.append(output)
test_utils.print_single_result(output)

Expand Down
9 changes: 7 additions & 2 deletions tests/L2_testing/test_runner/command_line_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"hello world",
"Prints \"Hello World\" to the console as a baseline functionality test"),
test_utils.Test("Check mounts",
"mounts-vm",
"mounts-vagrant-vm",
"lorem ipsum",
"Mounts a sample text file into the container and attempts to read it"),
test_utils.Test("Check environment variables",
Expand Down Expand Up @@ -67,7 +67,12 @@ def platform_dependent_modifications():
"mounts-xi6",
"JENKINS_BUILD_NUMBER=",
"Mounts a sample text file into the container and attempts to read it")
elif test_utils.selected_platform == test_utils.Platforms.virtual_machine:
elif test_utils.selected_platform == test_utils.Platforms.github_workflow_vm:
tests[1] = test_utils.Test("Check mounts",
"mounts-github-workflow-vm",
"lorem ipsum",
"Mounts a sample text file into the container and attempts to read it")
elif test_utils.selected_platform == test_utils.Platforms.vagrant_vm:
# nothing to do, already selected proper one
pass
else:
Expand Down
2 changes: 1 addition & 1 deletion tests/L2_testing/test_runner/gui_containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def execute_test():
output_table = []

# check if platform is supported
if test_utils.selected_platform == test_utils.Platforms.virtual_machine:
if test_utils.selected_platform == test_utils.Platforms.vagrant_vm or test_utils.selected_platform == test_utils.Platforms.github_workflow_vm:
test_utils.print_unsupported_platform(path.basename(__file__), test_utils.selected_platform)
return test_utils.count_print_results(output_table)

Expand Down
16 changes: 10 additions & 6 deletions tests/L2_testing/test_runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
container_manipulations,
bundle_generation,
plugin_launcher,
# command_line_containers, # Commented these tests because they are all failing in the workflow and will be enabled once they are resolved
# start_from_bundle,
# thunder_plugin,
# network_tests,
command_line_containers,
start_from_bundle,
thunder_plugin,
network_tests,
gui_containers,
pid_limit_tests]

Expand All @@ -47,8 +47,12 @@ def run_all_tests():
tested_groups_count = 0
for test in supported_tests:
test_utils.print_log("\nExecuting test Test Group: \"%s\"" % test.__name__, test_utils.Severity.info)
if (test_utils.selected_platform == test_utils.Platforms.virtual_machine) and (test.__name__ == "gui_containers"):
test_utils.print_unsupported_platform("gui_containers.py", test_utils.selected_platform)
if (test_utils.selected_platform == test_utils.Platforms.vagrant_vm ) and (test.__name__ == "gui_containers"):
test_utils.print_unsupported_platform(test.__name__, test_utils.selected_platform)
# Skipped these tests because they are all failing in the workflow and will be enabled once they are resolved
elif (test_utils.selected_platform == test_utils.Platforms.github_workflow_vm) and \
((test.__name__ == "gui_containers") or (test.__name__ == "network_tests")):
test_utils.print_unsupported_platform(test.__name__, test_utils.selected_platform)
else:
success, total = test.execute_test()
test_utils.print_log("\nTest Group: \"%s\"" % test.__name__, test_utils.Severity.info)
Expand Down
3 changes: 2 additions & 1 deletion tests/L2_testing/test_runner/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ def __exit__(self, etype, value, traceback):

class Platforms(IntEnum):
no_selection = 0
virtual_machine = 1
vagrant_vm = 1
xi_6 = 2
github_workflow_vm = 3


class Severity(IntEnum):
Expand Down
4 changes: 2 additions & 2 deletions tests/L2_testing/test_runner/thunder_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def start_wpeframework():
"""

if test_utils.selected_platform == test_utils.Platforms.virtual_machine:
if test_utils.selected_platform == test_utils.Platforms.vagrant_vm or test_utils.selected_platform == test_utils.Platforms.github_workflow_vm:
return start_wpeframework_vm()
elif test_utils.selected_platform == test_utils.Platforms.xi_6:
# WPEFramework normally runs as a systemd service on Xi6 so doesn't need to be launched manually.
Expand All @@ -185,7 +185,7 @@ def stop_wpeframework(process):
"""

if test_utils.selected_platform == test_utils.Platforms.virtual_machine:
if test_utils.selected_platform == test_utils.Platforms.vagrant_vm or test_utils.selected_platform == test_utils.Platforms.github_workflow_vm:
stop_wpeframework_vm(process)
elif test_utils.selected_platform == test_utils.Platforms.xi_6:
# WPEFramework normally runs as a systemd service on Xi6 so doesn't need to be closed manually.
Expand Down

0 comments on commit b7911c4

Please sign in to comment.