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/pkparse.c b/library/pkparse.c
index bddcf5d..4b1fd5d 100644
--- a/library/pkparse.c
+++ b/library/pkparse.c
@@ -83,27 +83,27 @@
fseek( f, 0, SEEK_END );
if( ( size = ftell( f ) ) == -1 )
- {
+ { // LCOV_EXCL_START
fclose( f );
return( MBEDTLS_ERR_PK_FILE_IO_ERROR );
- }
+ } // LCOV_EXCL_STOP
fseek( f, 0, SEEK_SET );
*n = (size_t) size;
if( *n + 1 == 0 ||
( *buf = mbedtls_calloc( 1, *n + 1 ) ) == NULL )
- {
+ { // LCOV_EXCL_START
fclose( f );
return( MBEDTLS_ERR_PK_ALLOC_FAILED );
- }
+ } // LCOV_EXCL_STOP
if( fread( *buf, 1, *n, f ) != *n )
- {
+ { // LCOV_EXCL_START
fclose( f );
mbedtls_free( *buf );
return( MBEDTLS_ERR_PK_FILE_IO_ERROR );
- }
+ } // LCOV_EXCL_STOP
fclose( f );