-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding testbed implementation of CI tests;
adding option to tests rvc4 against different versions of os;
- Loading branch information
1 parent
1643aae
commit 9f5e229
Showing
9 changed files
with
206 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from lib_testbed.power.PowerFactory import PowerFactory | ||
from lib_testbed.config.Config import Config | ||
from lib_testbed.utils.ssh_util import * | ||
from time import sleep | ||
|
||
testbed_name=os.getenv("SET_HIL_TESTBED") | ||
config=Config(testbed_name) | ||
print(config.cameras) | ||
|
||
for camera in config.cameras: | ||
if camera.platform == "rvc2": | ||
print(camera.name) | ||
power_control=PowerFactory.get_power_object_for_device(config, camera.name) | ||
power_control[0].off() | ||
sleep(2) | ||
power_control[0].on() | ||
for camera in config.cameras: | ||
if camera.platform == "rvc4": | ||
power_control=PowerFactory.get_power_object_for_device(config, camera.name) | ||
if len(power_control) == 2: | ||
power_control[1].off() | ||
power_control[0].off() | ||
sleep(2) | ||
power_control[0].on() | ||
power_control[1].on() | ||
elif len(power_control) == 1: | ||
power_control[0].off() | ||
sleep(2) | ||
power_control[0].on() | ||
else: | ||
print("No devices available in power_control.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
|
||
echo "/home/$USER/hil_framework/lib_testbed/tools" >> $GITHUB_PATH | ||
echo "PYTHONPATH="$PYTHONPATH:/home/$USER/hil_framework"" >> $GITHUB_ENV | ||
echo "HIL_FRAMEWORK_PATH="/home/$USER/hil_framework"" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
|
||
# Set up a Python virtual environment | ||
rm -rf venv | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
rm -rf build/ | ||
export PATH="$PATH:/home/hil/hil_framework/lib_testbed/tools" | ||
export PYTHONPATH="$PYTHONPATH:/home/hil/hil_framework" | ||
export HIL_FRAMEWORK_PATH="/home/hil/hil_framework" | ||
source /home/hil/.SETUP_CONFIG_VARS | ||
|
||
# Install required Python packages | ||
pip install numpy pytest pytest-html > /dev/null 2>&1 | ||
pushd /home/$USER/hil_framework/ > /dev/null 2>&1 && pip install -r requirements.txt > /dev/null 2>&1 && popd > /dev/null 2>&1 | ||
|
||
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun_vanilla -D DEPTHAI_BUILD_TESTS=ON | ||
cmake --build build --parallel 8 --config Release --target stability_stress_test | ||
cd build | ||
../ci/stability_stress_test_combined.sh 86400 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/bash | ||
|
||
# Check if the argument is provided | ||
if [ $# -lt 1 ]; then | ||
echo "Usage: $0 <test_type> [--rvc2 | --rvc4]" | ||
echo " test_type Specify test flavor: vanilla, asan-ubsan, or tsan." | ||
echo " --rvc2 Optional: Run tests with RVC2 configuration." | ||
echo " --rvc4 Optional: Run tests with RVC4 configuration." | ||
exit 1 | ||
fi | ||
# Get the test type from the argument | ||
TEST_FLAVOR=$1 | ||
TEST_ARGS=$2 | ||
|
||
# Set up a Python virtual environment | ||
rm -rf venv | ||
python3 -m venv venv | ||
source venv/bin/activate | ||
export LC_ALL=en_US.UTF-8 | ||
locale | ||
|
||
if [ "$TEST_FLAVOR" == "vanilla" ]; then | ||
echo $CMAKE_TOOLCHAIN_PATH | ||
else | ||
export CMAKE_TOOLCHAIN_PATH=$PWD/cmake/toolchain/${FLAVOR}.cmake | ||
fi | ||
|
||
export PATH="$PATH:/home/hil/hil_framework/lib_testbed/tools" | ||
export PYTHONPATH="$PYTHONPATH:/home/hil/hil_framework" | ||
export HIL_FRAMEWORK_PATH="/home/hil/hil_framework" | ||
source /home/hil/.SETUP_CONFIG_VARS | ||
|
||
# Install required Python packages | ||
pip install numpy pytest pytest-html > /dev/null 2>&1 | ||
pushd /home/$USER/hil_framework/ > /dev/null 2>&1 && git pull && git submodule update --init --recursive > /dev/null 2>&1 && popd > /dev/null 2>&1 | ||
pushd /home/$USER/hil_framework/ > /dev/null 2>&1 && pip install -r requirements.txt > /dev/null 2>&1 && popd > /dev/null 2>&1 | ||
|
||
# Check for optional RVC arguments | ||
if [[ "$TEST_ARGS" == "--rvc4" ]]; then | ||
echo "Running RVC4 configuration commands..." | ||
adb root | ||
adb shell systemctl stop agentconfd setup | ||
adb shell systemctl disable agentconfd setup | ||
adb shell mkdir -p /persist/factory | ||
adb shell touch /persist/factory/enabled | ||
adb shell reboot | ||
echo "Device reboot initiated for RVC4. Factory mode enabled." | ||
elif [[ "$TEST_ARGS" == "--rvc2" ]]; then | ||
python scripts/hil/powercycle_rvc2.py | ||
sleep 10 | ||
echo "RVC2 configuration specified. Continuing with test setup..." | ||
fi | ||
|
||
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D HUNTER_ROOT=$HOME/.hun2_$TEST_FLAVOR -D DEPTHAI_BUILD_EXAMPLES=ON -D DEPTHAI_BUILD_TESTS=ON -D DEPTHAI_TEST_EXAMPLES=ON -D DEPTHAI_BUILD_PYTHON=ON -D DEPTHAI_PYTHON_TEST_EXAMPLES=ON -D DEPTHAI_PYTHON_ENABLE_EXAMPLES=ON | ||
cmake --build build --parallel 2 --config Release | ||
|
||
export DISPLAY=:99 | ||
xdpyinfo -display $DISPLAY >/dev/null 2>&1 || (Xvfb $DISPLAY &) | ||
cd tests | ||
python3 run_tests.py $TEST_ARGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters