Files
jiecheng-business/test/voice_helper/throttle_test.sh
freeboss b7b5518834 feat: dev-5.1 分支基线(v1.3.35 发版后代码 + 5.1 声道改造文档)
- 以 main(ccc65af) 为基线提交当前工作区代码
- 新增 5.1 声道改造文档两份
- .gitignore 补充 .vscode/、.screenshots/
2026-11-02 19:25:12 +08:00

30 lines
1014 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# throttle_test.sh - 节流测试
# 同类 CONTROL 命令 2 秒内连续投递多条,验证只保留最后一条(文档 §7.5)
# 用法: throttle_test.sh [action] [count]
# action 默认 PAUSE
# count 默认 5(2 秒内投递 5 次)
set -e
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/common.sh"
require_adb
check_receiver_exists
ACTION="${1:-PAUSE}"
COUNT="${2:-5}"
print_header "节流测试 CONTROL/${ACTION} × ${COUNT}(2 秒内)"
log_warn "请先确保正在播放页(run_all.sh 已跳转到播放页),否则会被守卫拦截"
for i in $(seq 1 "${COUNT}"); do
PAYLOAD=$(build_control_payload "${ACTION}")
log_info "[${i}/${COUNT}] 投递 ${ACTION}"
send_voice_broadcast "CONTROL" "${PAYLOAD}" "throttle-$(date +%s%3N)-${i}" >/dev/null
sleep 0.3
done
log_ok "投递完成,预期服务端只执行最后一条 ${ACTION}"
log_info "可通过 logcat 过滤 VoiceCommandLogger 验证 throttle 日志"