From: Aaron Traas Date: Wed, 28 Jun 2017 16:19:20 +0000 (-0400) Subject: Test coverage: make LCOV ignore sig_handler and OOM check X-Git-Tag: 1.1~47 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=94aca03203cbba94c25fba00b7ff80e529d275c7 Test coverage: make LCOV ignore sig_handler and OOM check --- diff --git a/main.c b/main.c index a36ffce..8acae39 100644 --- a/main.c +++ b/main.c @@ -37,6 +37,8 @@ bool oldstyle = false; bool editline = true; bool prompt = true; +// LCOV_EXCL_START +// exclude from coverage analysis because it requires interactivity to test static void sig_handler(int signo) { if (signo == SIGINT) { @@ -45,6 +47,7 @@ static void sig_handler(int signo) } exit(0); } +// LCOV_EXCL_STOP /* * MAIN PROGRAM diff --git a/misc.c b/misc.c index f05e518..b01662f 100644 --- a/misc.c +++ b/misc.c @@ -15,8 +15,11 @@ void* xmalloc(size_t size) { void* ptr = malloc(size); if (ptr == NULL) { + // LCOV_EXCL_START + // exclude from coverage analysis because we can't simulate an out of memory error in testing fprintf(stderr, "Out of memory!\n"); exit(EXIT_FAILURE); + // LCOV_EXCL_STOP } return (ptr); }