From 58bce15b1e08b8f940b0e8a7a3dc1fdd416f643d Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Mon, 2 May 2016 13:17:03 -0500 Subject: [PATCH] Exclude the CUnit tests themselves from lcov --- client/config_init.c | 8 ++++---- common/fko_util.c | 8 ++++---- lib/base64.c | 8 ++++---- lib/cipher_funcs.c | 8 ++++---- lib/digest.c | 8 ++++---- lib/fko_decode.c | 9 ++++----- lib/hmac.c | 8 ++++---- server/access.c | 9 ++++----- test/gen-coverage-report.sh | 4 +++- test/lcov.env | 2 ++ 10 files changed, 37 insertions(+), 35 deletions(-) diff --git a/client/config_init.c b/client/config_init.c index cac4abe6..640c28a3 100644 --- a/client/config_init.c +++ b/client/config_init.c @@ -51,10 +51,10 @@ #define BITMASK_ARRAY_SIZE 2 /*!< Number of 32bits integer used to handle bitmask in the fko_var_bitmask_t structure */ #define LF_CHAR 0x0A /*!< Hexadecimal value associated to the LF char */ -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ #include "cunit_common.h" DECLARE_TEST_SUITE(config_init, "Config init test suite"); -#endif +#endif /* LCOV_EXCL_STOP */ /** * Structure to handle long bitmask. @@ -2676,7 +2676,7 @@ usage(void) return; } -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_TEST_SUITE_INIT(config_init) { @@ -2734,4 +2734,4 @@ int register_ts_config_init(void) return register_ts(&TEST_SUITE(config_init)); } -#endif /* HAVE_C_UNIT_TESTS */ +#endif /* HAVE_C_UNIT_TESTS */ /* LCOV_EXCL_STOP */ diff --git a/common/fko_util.c b/common/fko_util.c index 4edfa389..7841d37c 100644 --- a/common/fko_util.c +++ b/common/fko_util.c @@ -49,10 +49,10 @@ #define NULL_STRING "" /*!< String which represents a NULL buffer */ -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ #include "cunit_common.h" DECLARE_TEST_SUITE(utils_test, "Utility functions test suite"); -#endif +#endif /* LCOV_EXCL_STOP */ /** * Structure to handle an encryption mode string string and its associated integer value @@ -1085,7 +1085,7 @@ count_characters(const char *str, const char match, int len) return count; } -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_UTEST(test_count_characters, "test the count_characters function") { @@ -1109,5 +1109,5 @@ int register_utils_test(void) return register_ts(&TEST_SUITE(utils_test)); } -#endif +#endif /* LCOV_EXCL_STOP */ /***EOF***/ diff --git a/lib/base64.c b/lib/base64.c index ced2553e..0629179e 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -51,10 +51,10 @@ static unsigned char map2[] = }; #endif -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ #include "cunit_common.h" DECLARE_TEST_SUITE(base64_test, "Utility functions test suite"); -#endif +#endif /* LCOV_EXCL_STOP */ int b64_decode(const char *in, unsigned char *out) @@ -140,7 +140,7 @@ strip_b64_eq(char *data) *ndx = '\0'; } -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_UTEST(test_base64_encode, "test base64 encoding functions") { char test_str[32] = {0}; @@ -248,5 +248,5 @@ int register_base64_test(void) return register_ts(&TEST_SUITE(base64_test)); } -#endif +#endif /* LCOV_EXCL_STOP */ /***EOF***/ diff --git a/lib/cipher_funcs.c b/lib/cipher_funcs.c index 4bc76f69..c34dc3b6 100644 --- a/lib/cipher_funcs.c +++ b/lib/cipher_funcs.c @@ -48,9 +48,9 @@ #endif #endif -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_TEST_SUITE(digest_test, "Cipher functions test suite"); -#endif +#endif /* LCOV_EXCL_STOP */ /* Get random data. */ @@ -417,7 +417,7 @@ add_gpg_prefix(fko_ctx_t ctx) return(FKO_SUCCESS); } -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ @@ -659,5 +659,5 @@ int register_ts_aes_test(void) return register_ts(&TEST_SUITE(digest_test)); } -#endif +#endif /* LCOV_EXCL_STOP */ /***EOF***/ diff --git a/lib/digest.c b/lib/digest.c index 158beb42..e769bc14 100644 --- a/lib/digest.c +++ b/lib/digest.c @@ -29,9 +29,9 @@ #include "fko_common.h" #include "digest.h" #include "base64.h" -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_TEST_SUITE(digest_test, "digest functions test suite"); -#endif +#endif /* LCOV_EXCL_STOP */ /* Compute MD5 hash on in and store result in out. */ void @@ -192,7 +192,7 @@ sha3_512_base64(char *out, unsigned char *in, size_t size) } -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_UTEST(test_md5, "md5 test vectors") //https://tools.ietf.org/html/rfc1321.html { @@ -575,5 +575,5 @@ int register_ts_digest_test(void) return register_ts(&TEST_SUITE(digest_test)); } -#endif /* HAVE_C_UNIT_TESTS */ +#endif /* HAVE_C_UNIT_TESTS */ /* LCOV_EXCL_STOP */ /***EOF***/ diff --git a/lib/fko_decode.c b/lib/fko_decode.c index 81dd036b..1afdba65 100644 --- a/lib/fko_decode.c +++ b/lib/fko_decode.c @@ -38,9 +38,9 @@ /* Char used to separate SPA fields in an SPA packet */ #define SPA_FIELD_SEPARATOR ":" -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_TEST_SUITE(fko_decode, "FKO decode test suite"); -#endif +#endif /* LCOV_EXCL_STOP */ static int num_fields(char *str) @@ -590,7 +590,7 @@ fko_decode_spa_data(fko_ctx_t ctx) return(FKO_SUCCESS); } -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_UTEST(num_fields, "Count the number of SPA fields in a SPA packet") { @@ -649,6 +649,5 @@ int register_ts_fko_decode(void) return register_ts(&TEST_SUITE(fko_decode)); } -#endif /* HAVE_C_UNIT_TESTS */ - +#endif /* HAVE_C_UNIT_TESTS */ /* LCOV_EXCL_STOP */ /***EOF***/ diff --git a/lib/hmac.c b/lib/hmac.c index da14ed8c..b087e856 100644 --- a/lib/hmac.c +++ b/lib/hmac.c @@ -29,9 +29,9 @@ */ #include "hmac.h" -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_TEST_SUITE(hmac_test, "hmac functions test suite"); -#endif +#endif /* LCOV_EXCL_STOP */ /** * /brief populate the inner and outer pads @@ -383,7 +383,7 @@ hmac_sha3_512(const char *msg, const unsigned int msg_len, return FKO_SUCCESS; } -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_UTEST(test_hmac_md5, "hmac_md5 test vectors") // https://tools.ietf.org/html/rfc2202 { @@ -1474,4 +1474,4 @@ int register_ts_hmac_test(void) return register_ts(&TEST_SUITE(hmac_test)); } -#endif /* HAVE_C_UNIT_TESTS */ +#endif /* HAVE_C_UNIT_TESTS */ /* LCOV_EXCL_STOP */ diff --git a/server/access.c b/server/access.c index 872b6c18..6b98b2d4 100644 --- a/server/access.c +++ b/server/access.c @@ -48,10 +48,10 @@ #define SUCCESS 1 #endif -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ #include "cunit_common.h" DECLARE_TEST_SUITE(access, "Access test suite"); -#endif +#endif /* LCOV_EXCL_STOP */ /** * \brief include keys file @@ -2482,7 +2482,7 @@ include_keys_file(acc_stanza_t *curr_acc, const char *access_filename, fko_srv_o return EXIT_SUCCESS; } -#ifdef HAVE_C_UNIT_TESTS +#ifdef HAVE_C_UNIT_TESTS /* LCOV_EXCL_START */ DECLARE_UTEST(compare_port_list, "check compare_port_list function") { @@ -2511,6 +2511,5 @@ int register_ts_access(void) return register_ts(&TEST_SUITE(access)); } -#endif /* HAVE_C_UNIT_TESTS */ - +#endif /* HAVE_C_UNIT_TESTS */ /* LCOV_EXCL_STOP */ /***EOF***/ diff --git a/test/gen-coverage-report.sh b/test/gen-coverage-report.sh index b18179d1..dd1720d0 100755 --- a/test/gen-coverage-report.sh +++ b/test/gen-coverage-report.sh @@ -7,7 +7,9 @@ cd .. lcov $LCOV_RC_BC --no-checksum --capture --directory . --output-file $LCOV_INFO lcov $LCOV_RC_BC --no-checksum -a $LCOV_BASE -a $LCOV_INFO --output-file $LCOV_INFO_TMP lcov $LCOV_RC_BC --no-checksum -r $LCOV_INFO_TMP /usr/include/\* --output-file $LCOV_INFO_TMP2 -lcov $LCOV_RC_BC --no-checksum -r $LCOV_INFO_TMP2 test/fko-wrapper/\* --output-file $LCOV_INFO_FINAL +lcov $LCOV_RC_BC --no-checksum -r $LCOV_INFO_TMP2 \*cunit\* --output-file $LCOV_INFO_TMP3 +lcov $LCOV_RC_BC --no-checksum -r $LCOV_INFO_TMP3 \*utests\* --output-file $LCOV_INFO_TMP4 +lcov $LCOV_RC_BC --no-checksum -r $LCOV_INFO_TMP4 test/fko-wrapper/\* --output-file $LCOV_INFO_FINAL genhtml $GENHTML_USE_BC --output-directory $LCOV_RESULTS_DIR --branch-coverage $LCOV_INFO_FINAL cd $TOP_DIR diff --git a/test/lcov.env b/test/lcov.env index 5f8207c4..9d17b151 100644 --- a/test/lcov.env +++ b/test/lcov.env @@ -3,6 +3,8 @@ LCOV_BASE="$TOP_DIR/lcov_coverage.base" LCOV_INFO="$TOP_DIR/lcov_coverage.info" LCOV_INFO_TMP="$TOP_DIR/lcov_coverage.info_tmp" LCOV_INFO_TMP2="$TOP_DIR/lcov_coverage.info_tmp2" +LCOV_INFO_TMP3="$TOP_DIR/lcov_coverage.info_tmp3" +LCOV_INFO_TMP4="$TOP_DIR/lcov_coverage.info_tmp4" LCOV_INFO_FINAL="$TOP_DIR/lcov_coverage_final.info" LCOV_RESULTS_DIR="$TOP_DIR/lcov-results"