From 94aca03203cbba94c25fba00b7ff80e529d275c7 Mon Sep 17 00:00:00 2001 From: Aaron Traas Date: Wed, 28 Jun 2017 12:19:20 -0400 Subject: [PATCH] Test coverage: make LCOV ignore sig_handler and OOM check --- main.c | 3 +++ misc.c | 3 +++ 2 files changed, 6 insertions(+) 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); } -- 2.31.1