fix(build): clear matrix failures while preserving features

This commit is contained in:
mikecarper committed 2026-09-22 23:23:25 -07:00
1 parent 7b8ca33386
commit e6b002759d
14 files changed
+170 -12

No files matched your search

+7
View File
@@ -12,6 +12,13 @@ fail() {
[ "$OPTION3_BUILD_WORKERS" -eq 1 ] \
|| fail "logging matrix permits concurrent PlatformIO target builds"
for utility in profile_switch_t096_sx1262 xiao_s3_partition_migrator \
heltec_v4_partition_migrator_test_hold xiao_s3_partition_legacy_seed \
Heltec_v3_repeater_observer_mqtt_sim; do
is_redundant_bulk_build_target "$utility" \
|| fail "release matrix includes development utility $utility"
done
# Reduced RAK profiles all retain the compact INA set, but GPS depends on
# whether the bridge already owns Serial1. Keep those independent contracts so
# a valid Serial1 image cannot fail release qualification for an absent GPS
+2 -1
View File
@@ -38,7 +38,8 @@ pio_result=1
for pio_message in \
"firmware.elf section .text will not fit in region FLASH" \
"region FLASH overflowed by 43080 bytes" \
"Error: The program size is greater than maximum allowed"; do
"Error: The program size is greater than maximum allowed" \
"Error: The program size (1314113 bytes) is greater than maximum allowed (1310720 bytes)"; do
check_status 42
grep -Fq "$pio_message" "$test_root/output" || fail "compiler output was lost"
done
+20
View File
@@ -1,3 +1,5 @@
import ctypes
import hashlib
import subprocess
import tempfile
import unittest
@@ -22,6 +24,22 @@ SOURCES = [
class Ed25519CompactTest(unittest.TestCase):
def test_compact_sha512_matches_hashlib_at_block_boundaries(self):
with tempfile.TemporaryDirectory() as temp_dir:
library = Path(temp_dir) / "sha512.so"
subprocess.run(["cc", "-std=c99", "-O2", "-shared", "-fPIC",
"-DED25519_COMPACT_SHA512=1", str(ED25519 / "sha512.c"),
"-o", str(library)], check=True)
sha = ctypes.CDLL(str(library)).sha512
sha.argtypes = [ctypes.c_void_p, ctypes.c_size_t, ctypes.c_void_p]
sha.restype = ctypes.c_int
for length in (0, 1, 63, 64, 111, 112, 127, 128, 129, 255, 256, 1024, 4097):
data = bytes((i * 73 + 19) % 256 for i in range(length))
output = ctypes.create_string_buffer(64)
with self.subTest(length=length):
self.assertEqual(sha(data, len(data), output), 0)
self.assertEqual(output.raw, hashlib.sha512(data).digest())
def test_stm32_builds_enable_compact_base_table(self):
platformio = (ROOT / "platformio.ini").read_text()
stm32_base = platformio.split("[stm32_base]", 1)[1].split("\n[", 1)[0]
@@ -32,6 +50,8 @@ class Ed25519CompactTest(unittest.TestCase):
for label, extra_flags in (
("standard", []),
("compact", ["-DED25519_COMPACT_BASE=1"]),
("compact_sha512", ["-DED25519_COMPACT_BASE=1",
"-DED25519_COMPACT_SHA512=1"]),
):
executable = Path(temp_dir) / label
subprocess.run(
+91
View File
@@ -0,0 +1,91 @@
"""Exercise production scope storage and truncation with 254 neighbors."""
from pathlib import Path
import subprocess
import tempfile
import unittest
from test_replay_reset_integration import extract_braced
ROOT = Path(__file__).resolve().parents[1]
class NeighborScopeStorageTest(unittest.TestCase):
def test_response_bounds_and_publish_prefix(self):
header = (ROOT / "examples/simple_repeater/MyMesh.h").read_text()
source = (ROOT / "examples/simple_repeater/MyMesh.cpp").read_text()
layout = header[header.index(" struct NeighborDiscoverEntry {"):
header.index(" uint8_t neighbor_discover_count;")]
methods = "\n".join(extract_braced(source, signature) for signature in (
"bool MyMesh::completeNeighborDiscoverEntry()",
"bool MyMesh::handleNeighborDiscoverResponse("))
code = r'''
#include <cassert>
#include <cstdint>
#include <cstring>
#include <cstddef>
#define MAX_NEIGHBOURS 254
#define PUB_KEY_SIZE 32
namespace mesh {
struct Identity { uint8_t pub_key[32]; };
struct Utils { static void toHex(char* out, const uint8_t*, size_t) { out[0] = 0; } };
}
struct MQTTBridge {
static constexpr int NEIGHBORS_MAX_PUBLISH_ENTRIES = 20;
static constexpr size_t NEIGHBORS_JSON_BUFFER_SIZE = 8192;
};
struct MQTTMessageBuilder {
struct NeighborsMessageEntry {
const char* key; float snr; uint32_t age; const char* scopes;
const char* status; int16_t rssi;
};
static size_t measureNeighborsMessageEntry(const NeighborsMessageEntry&) { return 100; }
};
struct Clock { uint32_t getCurrentTime() { return 100; } };
struct MyMesh {
enum { ND_UNSENT, ND_QUEUED, ND_PENDING, ND_RESPONDED, ND_TIMEOUT, ND_SEND_FAILED };
''' + layout + r'''
unsigned neighbor_discover_next = 0, neighbor_discover_count = 254;
unsigned neighbor_discover_publish_count = 0;
size_t neighbor_discover_json_size = 0;
bool neighbor_discover_truncated = false, finished = false;
Clock clock;
Clock* getRTCClock() { return &clock; }
void touchNeighbourHeard(const mesh::Identity&, uint32_t, float, int16_t) {}
void finishNeighborDiscover() { finished = true; }
bool completeNeighborDiscoverEntry();
bool handleNeighborDiscoverResponse(int, const uint8_t*, size_t, float, int16_t);
};
''' + methods + r'''
int main() {
MyMesh m = {};
static_assert(sizeof(m.neighbor_discover_scopes) == 21 * 96, "bounded scope storage");
static_assert(sizeof(m.neighbor_discover) / sizeof(m.neighbor_discover[0]) == 254,
"retain every neighbor snapshot");
uint8_t response[200] = {};
uint32_t tag = 123;
memcpy(response, &tag, 4);
memset(response + 8, 'x', sizeof(response) - 8);
for (int i = 0; i <= 20; ++i) {
auto& entry = m.neighbor_discover[i];
entry.status = MyMesh::ND_PENDING;
entry.tag = tag;
assert(m.handleNeighborDiscoverResponse(i, response, sizeof(response), 5, -100));
assert(strlen(m.neighbor_discover_scopes[i]) == 95);
assert(m.completeNeighborDiscoverEntry() == (i < 20));
}
assert(m.finished && m.neighbor_discover_truncated);
assert(m.neighbor_discover_publish_count == 20);
assert(!m.handleNeighborDiscoverResponse(21, response, sizeof(response), 5, -100));
assert(!m.handleNeighborDiscoverResponse(-1, response, sizeof(response), 5, -100));
}
'''
with tempfile.TemporaryDirectory() as directory:
path = Path(directory)
(path / "test.cpp").write_text(code)
subprocess.run(["g++", "-std=c++17", "-fsanitize=address,undefined",
str(path / "test.cpp"), "-o", str(path / "test")], check=True)
subprocess.run([str(path / "test")], check=True)
if __name__ == "__main__":
unittest.main()