-
Notifications
You must be signed in to change notification settings - Fork 964
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generate a coverage report for End to end tests (#5667)
* Generate coverage report after running tests * Wait for integration program to stop/start
- Loading branch information
Showing
4 changed files
with
36 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,15 @@ on: | |
jobs: | ||
test-simulator: | ||
runs-on: ubuntu-latest | ||
env: | ||
LCOV_CAPTURE_FLAGS: --quiet --capture --include "${PWD}/src/*" --exclude '*/src/mesh/generated/*' --directory .pio/build/coverage/src --base-directory "${PWD}" | ||
steps: | ||
- name: Install libs needed for native build | ||
shell: bash | ||
run: | | ||
sudo apt-get update --fix-missing | ||
sudo apt-get install -y libbluetooth-dev libgpiod-dev libyaml-cpp-dev openssl libssl-dev libulfius-dev liborcania-dev libusb-1.0-0-dev libi2c-dev | ||
sudo apt-get install -y lcov | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
@@ -24,7 +27,7 @@ jobs: | |
shell: bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -U platformio adafruit-nrfutil | ||
pip install -U platformio adafruit-nrfutil dotmap | ||
pip install -U meshtastic --pre | ||
- name: Upgrade platformio | ||
|
@@ -36,17 +39,25 @@ jobs: | |
run: bin/build-native.sh | ||
|
||
# We now run integration test before other build steps (to quickly see runtime failures) | ||
- name: Build for native | ||
run: platformio run -e native | ||
- name: Build for native/coverage | ||
run: | | ||
platformio run -e coverage | ||
lcov ${{ env.LCOV_CAPTURE_FLAGS }} --initial --output-file coverage_base.info | ||
- name: Integration test | ||
run: | | ||
.pio/build/native/program & sleep 10 # 5 seconds was not enough | ||
.pio/build/coverage/program & | ||
PID=$! | ||
timeout 20 bash -c "until ls -al /proc/$PID/fd | grep socket; do sleep 1; done" | ||
echo "Simulator started, launching python test..." | ||
python3 -c 'from meshtastic.test import testSimulator; testSimulator()' | ||
wait | ||
lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name integration --output-file coverage_integration.info | ||
- name: PlatformIO Tests | ||
run: platformio test -e native --junit-output-path testreport.xml | ||
run: | | ||
platformio test -e coverage --junit-output-path testreport.xml | ||
lcov ${{ env.LCOV_CAPTURE_FLAGS }} --test-name tests --output-file coverage_tests.info | ||
- name: Test Report | ||
uses: dorny/[email protected] | ||
|
@@ -56,6 +67,19 @@ jobs: | |
path: testreport.xml | ||
reporter: java-junit | ||
|
||
- name: Generate Code Coverage Report | ||
run: | | ||
lcov --quiet --add-tracefile coverage_base.info --add-tracefile coverage_integration.info --add-tracefile coverage_tests.info --output-file coverage_src.info | ||
mkdir code-coverage-report | ||
genhtml --quiet --legend --prefix "${PWD}" coverage_src.info --output-directory code-coverage-report | ||
mv coverage_*.info code-coverage-report | ||
- name: Save Code Coverage Report | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: code-coverage-report | ||
path: code-coverage-report | ||
|
||
hardware-tests: | ||
runs-on: test-runner | ||
steps: | ||
|
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