Skip to content

Commit

Permalink
Add LCOV_EXCL_* to suppress testing code coverage of CMockery and stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
dottedmag committed Oct 21, 2011
1 parent 6046ad8 commit f734692
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions tests/unit/cmockery.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/* LCOV_EXCL_START */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
Expand Down Expand Up @@ -1787,3 +1790,5 @@ int _run_tests(const UnitTest * const tests, const size_t number_of_tests) {
fail_if_blocks_allocated(check_point, "run_tests");
return (int)total_failed;
}

/* LCOV_EXCL_STOP */
13 changes: 7 additions & 6 deletions tests/unit/set_domainname_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ ExpectedClasses expected_classes[] =
void NewClass(const char *classname)
{
int i;
for (i = 0; i < sizeof(expected_classes)/sizeof(expected_classes[0]); ++i)
for (i = 0; i < sizeof(expected_classes)/sizeof(expected_classes[0]); ++i) /* LCOV_EXCL_LINE */
{
if (!strcmp(classname, expected_classes[i].name))
{
expected_classes[i].found = true;
return;
}
}
fail();
fail(); /* LCOV_EXCL_LINE */
}

typedef struct ExpectedVars
Expand All @@ -80,7 +80,7 @@ int i;
assert_string_equal(namespace, "sys");
assert_int_equal(type, cf_str);

for (i = 0; i < sizeof(expected_vars)/sizeof(expected_vars[0]); ++i)
for (i = 0; i < sizeof(expected_vars)/sizeof(expected_vars[0]); ++i) /* LCOV_EXCL_LINE */
{
if (!strcmp(varname, expected_vars[i].name))
{
Expand All @@ -89,8 +89,8 @@ for (i = 0; i < sizeof(expected_vars)/sizeof(expected_vars[0]); ++i)
return;
}
}
fprintf(stderr, "${%s.%s} <- %s (%c)\n", namespace, varname, value, type);
fail();
fprintf(stderr, "${%s.%s} <- %s (%c)\n", namespace, varname, value, type); /* LCOV_EXCL_LINE */
fail(); /* LCOV_EXCL_LINE */
}

static void test_set_names(void **state)
Expand Down Expand Up @@ -121,7 +121,7 @@ return run_tests(tests);
}



/* LCOV_EXCL_START */

/* Stub out functions we do not use in test */

Expand Down Expand Up @@ -282,3 +282,4 @@ RSA *PUBKEY;
char *CLASSTEXT[] = {};
char VIPADDRESS[18];

/* LCOV_EXCL_STOP */
3 changes: 3 additions & 0 deletions tests/unit/str_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const UnitTest tests[] =
return run_tests(tests);
}

/* LCOV_EXCL_START */

/* Stub out functions we do not use in test */

Expand All @@ -79,3 +80,5 @@ void FatalError(char *s, ...)
fail();
exit(42);
}

/* LCOV_EXCL_STOP */

0 comments on commit f734692

Please sign in to comment.