CI:集成测试改为与冒烟窗口并行喂 UDP,失败时输出 pPowerManger 日志与 DB 表诊断
build-test-deploy / ci (push) Failing after 11m39s
build-test-deploy / ci (push) Failing after 11m39s
This commit is contained in:
+22
-6
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user