MCPcopy Create free account
hub / github.com/FastLED/FastLED / setup

Function setup

src/platforms/posix/run_unit_test.hpp:73–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73static void setup(double timeout_seconds = 20.0) FL_NOEXCEPT {
74 const char* disable_env = getenv("FASTLED_DISABLE_TIMEOUT_WATCHDOG");
75 if (disable_env && (strcmp(disable_env, "1") == 0 || strcmp(disable_env, "true") == 0)) {
76 return;
77 }
78
79 const char* timeout_env = getenv("FASTLED_TEST_TIMEOUT");
80 if (timeout_env) {
81 double parsed = atof(timeout_env);
82 if (parsed > 0.0) {
83 timeout_seconds = parsed;
84 }
85 }
86
87 g_timeout_seconds = timeout_seconds;
88 g_active = true;
89
90 struct sigaction sa;
91 memset(&sa, 0, sizeof(sa));
92 sa.sa_handler = alarm_handler;
93 sigemptyset(&sa.sa_mask);
94 sa.sa_flags = 0;
95
96 if (sigaction(SIGALRM, &sa, nullptr) == 0) {
97 alarm(static_cast<unsigned int>(timeout_seconds));
98 printf("Runner watchdog enabled (%.1f seconds)\n", timeout_seconds);
99 }
100}
101
102static void cancel() FL_NOEXCEPT {
103 if (!g_active) {

Callers 2

mainFunction · 0.70
mainFunction · 0.70

Calls 5

getenvFunction · 0.85
strcmpFunction · 0.85
memsetFunction · 0.85
printfFunction · 0.85
sigactionClass · 0.70

Tested by

no test coverage detected