test: verify inherited nRF52 optimizer before firmware suites

This commit is contained in:
mikecarper committed 2026-10-09 20:50:13 -07:00
1 parent 4b074e12c1
commit 1339c8546e
3 files changed
+20 -9

No files matched your search

+6 -3
View File
@@ -98,6 +98,12 @@ jobs:
python3 -B scripts/check_arduinojson_pin.py --self-test
python3 -B scripts/check_arduinojson_pin.py
- name: Verify build-size diagnostics and nRF52 optimizer recipes
run: |
bash test/test_build_size_detection.sh
python3 -B test/test_nrf52_size_profile.py -v
python3 -B test/test_rak_combined_build_config.py -v
- name: Run Unit Tests
run: pio test -e native -e native_kiss_modem -e native_ota_channel -vv
@@ -455,7 +461,6 @@ jobs:
env:
MESHCORE_REQUIRE_ARM_COMPILER: '1'
run: |
bash test/test_build_size_detection.sh
python3 -B test/test_firmware_ram.py
python3 -B test/test_recent_repeater_storage.py -v
python3 -B test/test_ota_cold_buffers.py -v
@@ -474,7 +479,6 @@ jobs:
- name: Verify opt-in RAK4631 combined Ethernet and OTA modes
run: |
python3 -B test/test_rak_combined_build_config.py -v
python3 -B test/test_rak_combined_ota.py -v
python3 -B test/test_rak_ethernet_transmit.py -v
python3 -B test/test_rak4631_ethernet_runtime.py -v
@@ -482,7 +486,6 @@ jobs:
- name: Verify nRF52 infrastructure trims and unchanged Companion scope
run: |
python3 -B test/test_nrf52_flash_trim.py -v
python3 -B test/test_nrf52_size_profile.py -v
python3 -B test/test_nrf52_tft_font_trim.py -v
python3 -B test/test_ota_target_names.py -v
python3 -B test/test_ota_cli_listing.py -v
+5 -5
View File
@@ -62,16 +62,16 @@ if run_pio_with_size_detection run -e test > /dev/null 2>&1; then
fi
[ ! -e "$test_root/pio-called" ] || fail "PIO ran without diagnostic storage"
# Keep sensors and protocol features while shrinking nRF52 repeater code.
# Keep sensors and protocol features while inheriting nrf52_base's -Oz.
PIO_ENV_PLATFORM_BY_NAME[ikoka_nano_nrf_22dbm_repeater]=NRF52_PLATFORM
PLATFORMIO_BUILD_FLAGS=''
PLATFORMIO_BUILD_UNFLAGS=''
apply_nrf52_size_profile ikoka_nano_nrf_22dbm_repeater
[[ "$PLATFORMIO_BUILD_FLAGS" == *' -Os'* ]] || fail "full-sensor repeater omitted size optimization"
[ -z "$PLATFORMIO_BUILD_FLAGS" ] || fail "full-sensor repeater added an optimizer override or changed features"
[[ "$PLATFORMIO_BUILD_UNFLAGS" == *'-Ofast'* ]] || fail "aggressive optimization was not removed"
[[ "$PLATFORMIO_BUILD_FLAGS" != *'-UENV_INCLUDE_'* ]] || fail "sensor support was reduced"
# The legacy RAK4631 Ethernet image uses the same optimizer without inheriting
# The legacy RAK4631 Ethernet image inherits the same optimizer without inheriting
# Full Companion's transport/source-only OTA overlay or reducing its sensors.
(
PIO_ENV_PLATFORM_BY_NAME[RAK_4631_companion_radio_ethernet]=NRF52_PLATFORM
@@ -84,8 +84,8 @@ apply_nrf52_size_profile ikoka_nano_nrf_22dbm_repeater
PLATFORMIO_BOARD_UPLOAD_MAXIMUM_SIZE=712704
PLATFORMIO_BOARD_BUILD_LDSCRIPT=boards/nrf52840_s140_v6.ld
apply_nrf52_size_profile RAK_4631_companion_radio_ethernet
[ "$PLATFORMIO_BUILD_FLAGS" = "$expected_flags -Os" ] \
|| fail "Ethernet Companion changed features instead of only optimization ($profile)"
[ "$PLATFORMIO_BUILD_FLAGS" = "$expected_flags" ] \
|| fail "Ethernet Companion added an optimizer override or changed features ($profile)"
[ "$PLATFORMIO_BUILD_UNFLAGS" = $'-D EXTRAFS=1\n-Ofast' ] \
|| fail "Ethernet Companion removed flags other than aggressive optimization ($profile)"
[ "$PLATFORMIO_BOARD_UPLOAD_MAXIMUM_SIZE" = 712704 ] \
+9 -1
View File
@@ -7,6 +7,7 @@ import importlib.util
import json
import os
from pathlib import Path
import re
import shlex
import subprocess
import tempfile
@@ -30,6 +31,11 @@ class RakCombinedBuildConfigTest(unittest.TestCase):
def test_matching_profiles_preserve_identity_and_never_run_platformio(self):
original = (ROOT / "platformio.ini").read_bytes()
variant = (ROOT / "variants/rak4631/platformio.ini").read_bytes()
base_flags = shlex.split(ini(ROOT / "platformio.ini")["nrf52_base"]["build_flags"])
base_optimizers = [flag for flag in base_flags
if re.fullmatch(r"-O(?:[0-3sgz]|fast)", flag)]
self.assertTrue(base_optimizers)
self.assertEqual(base_optimizers[-1], "-Oz")
with tempfile.TemporaryDirectory(prefix="meshcore-rak-config-") as temp:
directory = Path(temp)
marker = directory / "unexpected-platformio"
@@ -58,7 +64,9 @@ class RakCombinedBuildConfigTest(unittest.TestCase):
self.assertIn("-D MAX_NEIGHBOURS=50", flags)
self.assertNotIn("FLOOD_PACKET_FILTER_SLOTS", flags)
self.assertIn("-Ofast", overlay["build_unflags"])
self.assertIn("-Os", flags)
self.assertEqual([flag for flag in shlex.split(flags)
if re.fullmatch(r"-O(?:[0-3sgz]|fast)", flag)], [],
"trial overlays must inherit canonical -Oz without overriding it")
self.assertIn("-DLORA_FREQ=910.525", flags)
self.assertIn(str(overlay_path), config["platformio"]["extra_configs"])
self.assertEqual(hashlib.sha256(config_path.read_bytes()).hexdigest(), item["config_sha256"])