Test coverage: make LCOV ignore sig_handler and OOM check
This commit is contained in:
parent
d5942e1732
commit
94aca03203
2 changed files with 6 additions and 0 deletions
3
main.c
3
main.c
|
@ -37,6 +37,8 @@ bool oldstyle = false;
|
||||||
bool editline = true;
|
bool editline = true;
|
||||||
bool prompt = true;
|
bool prompt = true;
|
||||||
|
|
||||||
|
// LCOV_EXCL_START
|
||||||
|
// exclude from coverage analysis because it requires interactivity to test
|
||||||
static void sig_handler(int signo)
|
static void sig_handler(int signo)
|
||||||
{
|
{
|
||||||
if (signo == SIGINT) {
|
if (signo == SIGINT) {
|
||||||
|
@ -45,6 +47,7 @@ static void sig_handler(int signo)
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
// LCOV_EXCL_STOP
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MAIN PROGRAM
|
* MAIN PROGRAM
|
||||||
|
|
3
misc.c
3
misc.c
|
@ -15,8 +15,11 @@ void* xmalloc(size_t size)
|
||||||
{
|
{
|
||||||
void* ptr = malloc(size);
|
void* ptr = malloc(size);
|
||||||
if (ptr == NULL) {
|
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");
|
fprintf(stderr, "Out of memory!\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
// LCOV_EXCL_STOP
|
||||||
}
|
}
|
||||||
return (ptr);
|
return (ptr);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue