Exclude a few lines from lcov coverage stats:
- "fail" branches in selftests
- "should never happen" errors in SSL
- cipher_xxx() failures in SSL
- some things that fail only if malloc() fails
- some things that fail only if fread/fwrite()/ftell() fails
(after fopen() succeeded)
- some things that fail only if a parameter is invalid, but the parameter was
actually validated earlier
- generated code in library/error.c
diff --git a/library/ctr_drbg.c b/library/ctr_drbg.c
index aefddfa..a24db3e 100644
--- a/library/ctr_drbg.c
+++ b/library/ctr_drbg.c
@@ -429,10 +429,10 @@
goto exit;
if( fwrite( buf, 1, MBEDTLS_CTR_DRBG_MAX_INPUT, f ) != MBEDTLS_CTR_DRBG_MAX_INPUT )
- {
+ { // LCOV_EXCL_START
ret = MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR;
goto exit;
- }
+ } // LCOV_EXCL_STOP
ret = 0;
@@ -461,10 +461,10 @@
}
if( fread( buf, 1, n, f ) != n )
- {
+ { // LCOV_EXCL_START
fclose( f );
return( MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR );
- }
+ } // LCOV_EXCL_STOP
fclose( f );