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:
+13
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user