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

Function setup

src/platforms/apple/run_unit_test.hpp:74–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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