fix(sdk/watchdog): 236 收尾 — sigusr1_guard 无日志目录时落 stderr 可观测; test_wd_fw 补 fw-app/裸沉浸/裸非沉浸三用例; hello/files/ncm 随 meow_ui.a(4020227c) 重链 (已热更到卡, watchdog 6373d8e5 待入 M2.89)
This commit is contained in:
1 parent
49c31f1901
commit
92086129c5
11 files changed
+33
-10
No files matched your search
Binary file not shown.
@@ -24,6 +24,25 @@ static void check(const char *name, int got, int want)
|
||||
else { g_fail++; printf("FAIL %s: got %d want %d\n", name, got, want); }
|
||||
}
|
||||
|
||||
/* ---- M2.87:SIGUSR1 手势让位(handle_touch 左缘滑动分支)----
|
||||
* 判定(meow_watchdog.c):`!g_fw_app && immersive` 才发 SIGUSR1(只给裸沉浸 App);
|
||||
* SDK 框架 App(g_fw_app=1)不发(返回由 SDK on_swipe 处理),防 SIGUSR1 杀死 App。 */
|
||||
static volatile int g_sigusr1_hits = 0;
|
||||
static void on_sigusr1(int s) { (void)s; g_sigusr1_hits++; }
|
||||
|
||||
/* 经 handle_touch 模拟一次「左缘起点+向右滑」完整手势(press→release),返回 SIGUSR1 命中数。 */
|
||||
static int sim_swipe_sigusr1(int fw, int immersive)
|
||||
{
|
||||
g_fw_app = fw;
|
||||
g_sigusr1_hits = 0;
|
||||
last_x = 5; last_y = 300; /* 左缘原点(x<EDGE_W=24) */
|
||||
unsigned long long now = now_ms();
|
||||
handle_touch(immersive, getpid(), now - 3000, 1); /* press(过冷却期 + 坐标就绪) */
|
||||
last_x = 100; /* 向右滑 95px(>SWIPE_DX=50) */
|
||||
handle_touch(immersive, getpid(), now - 3000, 0); /* release */
|
||||
return g_sigusr1_hits;
|
||||
}
|
||||
|
||||
/* 在 <base>/<name> 建目录并写 app.json;写失败返回 -1。 */
|
||||
static int fixture(const char *base, const char *name, const char *appjson)
|
||||
{
|
||||
@@ -51,6 +70,7 @@ static int expect_fw(const char *base, const char *name, const char *appjson, in
|
||||
|
||||
int main(void)
|
||||
{
|
||||
signal(SIGUSR1, on_sigusr1); /* 捕获 handle_touch 可能发出的 SIGUSR1(测命中) */
|
||||
char dir[] = "/tmp/wdfwXXXXXX";
|
||||
if (!mkdtemp(dir)) { perror("mkdtemp"); return 2; }
|
||||
|
||||
@@ -84,6 +104,11 @@ int main(void)
|
||||
/* wd_framework_from_pid:自进程 /proc/self/exe 目录无 app.json -> 0,不崩 */
|
||||
check("from_pid(no app.json)", wd_framework_from_pid(getpid()), 0);
|
||||
|
||||
/* ---- M2.87 SIGUSR1 让位判定(仅裸沉浸 App 发 SIGUSR1)---- */
|
||||
check("sigusr1 fw-app (framework=1) -> 0", sim_swipe_sigusr1(1, 1), 0); /* SDK 框架 App:不发 */
|
||||
check("sigusr1 bare-immersive -> 1", sim_swipe_sigusr1(0, 1), 1); /* 裸沉浸:发(命中) */
|
||||
check("sigusr1 bare-nonimmersive -> 0", sim_swipe_sigusr1(0, 0), 0); /* 裸非沉浸:不发 */
|
||||
|
||||
/* 清理 */
|
||||
{
|
||||
char path[560];
|
||||
|
||||
Reference in new issue
Block a user