From 5e7404ec9f478eb88a60ed64a46f9f2007ab9449 Mon Sep 17 00:00:00 2001 From: zjk <1553836110@qq.com> Date: Fri, 14 Aug 2026 22:06:18 +0800 Subject: [PATCH] =?UTF-8?q?CI=EF=BC=9A=E9=9B=86=E6=88=90=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=B8=8E=E5=86=92=E7=83=9F=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E5=B9=B6=E8=A1=8C=E5=96=82=20UDP=EF=BC=8C=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E6=97=B6=E8=BE=93=E5=87=BA=20pPowerManger=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E4=B8=8E=20DB=20=E8=A1=A8=E8=AF=8A=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ci/build-test.sh | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/ci/build-test.sh b/ci/build-test.sh index 67b45be..d672431 100755 --- a/ci/build-test.sh +++ b/ci/build-test.sh @@ -123,6 +123,12 @@ EOF ./pPowerManger "${MISSION_FILE}" > /tmp/pm_smoke.log 2>&1 & PM_PID=$! + + # 集成测试:与冒烟窗口并行喂 UDP 反馈(在进程存活期间尽快发送) + t1=$(now_ms) + "${BIN_DIR}/udpFeeder" 127.0.0.1 5001 6 > /tmp/integ_feed.log 2>&1 & + FEEDER_PID=$! + sleep 5 if kill -0 "${PM_PID}" 2>/dev/null; then @@ -132,19 +138,29 @@ EOF echo ">>> Smoke test FAILED (pPowerManger exited)" >&2 fi - # --- 集成测试:UDP 反馈 → SQLite 落行 --- + wait "${FEEDER_PID}" 2>/dev/null || true + + # 集成校验:UDP 反馈 → SQLite 落行 if [ "${SMOKE_OK}" = "1" ]; then - echo ">>> Integration test: feed UDP feedback + check DB" - t1=$(now_ms) - if "${BIN_DIR}/udpFeeder" 127.0.0.1 5001 6 > /tmp/integ_feed.log 2>&1 \ - && sleep 2 \ - && PM_DB="${BIN_DIR}/power_data.db" python3 "${SRC_DIR}/test/integration/check_db.py" > /tmp/integ_check.log 2>&1; then + if PM_DB="${BIN_DIR}/power_data.db" python3 "${SRC_DIR}/test/integration/check_db.py" > /tmp/integ_check.log 2>&1; then INTEG_OK=1 echo ">>> Integration test PASSED (UDP->DB rows)" else echo ">>> Integration test FAILED" >&2 cat /tmp/integ_feed.log >&2 cat /tmp/integ_check.log >&2 + echo "--- pPowerManger 日志末尾 ---" >&2 + tail -15 /tmp/pm_smoke.log >&2 2>/dev/null || true + echo "--- power_data.db 表 ---" >&2 + PM_DB="${BIN_DIR}/power_data.db" python3 -c " +import sqlite3,os,sys +p=os.environ['PM_DB'] +print('exists:', os.path.exists(p)) +if os.path.exists(p): + c=sqlite3.connect(p); cur=c.cursor() + cur.execute(\"SELECT name FROM sqlite_master WHERE type='table'\") + print('tables:', [r[0] for r in cur.fetchall()]); c.close() +" >&2 2>/dev/null || true fi INTEG_TIME=$(( $(now_ms) - t1 )) fi