projects
/
open-adventure.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d5942e1
)
Test coverage: make LCOV ignore sig_handler and OOM check
author
Aaron Traas
<aaron@traas.org>
Wed, 28 Jun 2017 16:19:20 +0000
(12:19 -0400)
committer
Eric S. Raymond
<esr@thyrsus.com>
Wed, 28 Jun 2017 17:23:34 +0000
(13:23 -0400)
main.c
patch
|
blob
|
history
misc.c
patch
|
blob
|
history
diff --git
a/main.c
b/main.c
index a36ffce8d3f78e1f1117fb4af17e65701c005459..8acae39e43bc2b94aea85d3147643a2f995dcf04 100644
(file)
--- 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 f05e51883c5e55dbab1a323f73e15cca6149e2b5..b01662f5120f4739cea47623b433c7e15ae58cc2 100644
(file)
--- 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);
}