From 552e7934de6cfe8e2d0690eafca67149853de7a1 Mon Sep 17 00:00:00 2001 From: Kaiyeung Date: Tue, 21 Jan 2025 14:25:00 -0800 Subject: [PATCH] Update tool.drcov.fib.template and add ifndef in fib.c for intercept_signal. --- suite/tests/CMakeLists.txt | 6 ++-- suite/tests/common/fib.c | 9 ++++- suite/tests/common/tool.drcov.fib.template | 38 ++++++++++++---------- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/suite/tests/CMakeLists.txt b/suite/tests/CMakeLists.txt index 7c42831547e..2852a419b61 100644 --- a/suite/tests/CMakeLists.txt +++ b/suite/tests/CMakeLists.txt @@ -2670,8 +2670,10 @@ if (NOT ANDROID) # TODO i#38: Port test to Android. set(client.memory_dump_test_expectbase "memory_dump_test") endif () tobuild_ci(client.memory_dump_test client-interface/memory_dump_test.c "" "" "") - torunonly_ci(client.attach_memory_dump_test common.fib client.memory_dump_test.dll - client-interface/attach_memory_dump_test.runall "" "" "attach") + if (LINUX) + torunonly_ci(client.attach_memory_dump_test common.fib client.memory_dump_test.dll + client-interface/attach_memory_dump_test.runall "" "" "attach") + endif () endif () endif () diff --git a/suite/tests/common/fib.c b/suite/tests/common/fib.c index c466a116800..5c8e662bd36 100644 --- a/suite/tests/common/fib.c +++ b/suite/tests/common/fib.c @@ -68,11 +68,13 @@ fib(int n) return fib(n - 1) + fib(n - 2); } +#ifndef WINDOWS /* A no-op signal_handler to handle SIGTERM for attach memory dump test. */ static void signal_handler(int sig) { } +#endif int main(int argc, char **argv) @@ -83,7 +85,12 @@ main(int argc, char **argv) INIT(); USE_USER32(); - intercept_signal(SIGTERM, (handler_3_t)signal_handler, /*sigstack=*/false); + if (argc > 1 && strcmp(argv[1], "attach") == 0) { + attach = true; +#ifndef WINDOWS + intercept_signal(SIGTERM, (handler_3_t)signal_handler, /*sigstack=*/false); + } +#endif print("fib(%d)=%d\n", 5, fib(5)); /* Enable use as a shorter test for tool.drcacheof.func_view. */ diff --git a/suite/tests/common/tool.drcov.fib.template b/suite/tests/common/tool.drcov.fib.template index 64ce2d702aa..aabbd669175 100644 --- a/suite/tests/common/tool.drcov.fib.template +++ b/suite/tests/common/tool.drcov.fib.template @@ -5,27 +5,31 @@ DA:66,1 DA:67,0 DA:68,1 DA:69,1 -DA:73,1 -DA:76,1 -#if defined(WINDOWS) -DA:77,1 -#endif -DA:79,1 +DA:75,0 +DA:76,0 DA:81,1 -DA:82,0 DA:83,1 DA:85,1 DA:88,1 -DA:89,1 -DA:90,1 -#if defined(WINDOWS) -DA:91,1 -#endif -DA:93,1 -DA:94,1 -#if defined(WINDOWS) +DA:89,0 +DA:91,0 DA:95,1 -#endif DA:97,1 -DA:98,1 +DA:98,0 +DA:101,1 +DA:102,0 +DA:104,0 +DA:105,0 +DA:106,0 +DA:109,1 +DA:111,1 +DA:114,1 +DA:115,1 +DA:116,1 +DA:119,1 +DA:120,1 +DA:123,1 +DA:126,1 +DA:127,0 +DA:129,1 end_of_record