Add branch coverage build for simulation

Adds build_coverage.sh script that:
- Builds the simulation with GCC branch coverage instrumentation
- Supports --report flag to run simulation and generate lcov HTML report
- Uses 60 second timeout with SIGINT for graceful shutdown

Also adds SIGINT handler to simulation to exit cleanly and flush coverage data.
This commit is contained in:
Claude
2026-01-16 16:47:58 +00:00
parent c10493881b
commit 4cac3a721e
3 changed files with 60 additions and 2 deletions
+13 -1
View File
@@ -109,8 +109,20 @@ int main(int argc, char **argv)
#endif
#ifdef MAIN_SIMULATION
#include <signal.h>
static volatile int simulation_running = 1;
static void sigint_handler(int sig)
{
(void)sig;
simulation_running = 0;
}
int main(void)
{
signal(SIGINT, sigint_handler);
Quakey *quakey;
int ret = quakey_init(&quakey, 1);
if (ret < 0)
@@ -161,7 +173,7 @@ int main(void)
quakey_spawn(quakey, config, "cs --addr 127.0.0.4");
}
for (;;)
while (simulation_running)
quakey_schedule_one(quakey);
quakey_free(quakey);