[rtems commit] libtest: Improve gcov info dump
Sebastian Huber
sebh at rtems.org
Thu Feb 22 13:31:36 UTC 2024
Module: rtems
Branch: master
Commit: e9c7ba3e0509beca5dcfda47a654a51a25acfdb7
Changeset: http://git.rtems.org/rtems/commit/?id=e9c7ba3e0509beca5dcfda47a654a51a25acfdb7
Author: Sebastian Huber <sebastian.huber at embedded-brains.de>
Date: Fri Jan 19 10:38:20 2024 +0100
libtest: Improve gcov info dump
Make sure there is no spurious empty line between the gcov info and the
*** END OF GCOV INFO BASE64 ***
line. This helps to recalculate the hash correctly at the consumer
side.
---
cpukit/libtest/gcovdumpinfobase64.c | 6 +++++-
cpukit/libtest/testgcovdumpinfo.c | 4 +---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/cpukit/libtest/gcovdumpinfobase64.c b/cpukit/libtest/gcovdumpinfobase64.c
index f75d157ab9..62cd89ac7e 100644
--- a/cpukit/libtest/gcovdumpinfobase64.c
+++ b/cpukit/libtest/gcovdumpinfobase64.c
@@ -102,5 +102,9 @@ void _Gcov_Dump_info_base64( IO_Put_char put_char, void *arg )
ctx.put_char = put_char;
ctx.arg = arg;
_Gcov_Dump_info( _Gcov_Base64_encode, &ctx );
- _Base64_Encode( _Gcov_Base64_put_char, &ctx, ctx.buf, ctx.index, NULL, INT_MAX );
+
+ if ( ctx.index > 0 ) {
+ _Base64_Encode( put_char, arg, ctx.buf, ctx.index, NULL, INT_MAX );
+ ( *put_char )( '\n', arg );
+ }
}
diff --git a/cpukit/libtest/testgcovdumpinfo.c b/cpukit/libtest/testgcovdumpinfo.c
index 71cf4d6d37..1f32ceafcb 100644
--- a/cpukit/libtest/testgcovdumpinfo.c
+++ b/cpukit/libtest/testgcovdumpinfo.c
@@ -75,10 +75,8 @@ void rtems_test_gcov_dump_info( void )
_IO_Printf( rtems_put_char, NULL, "\n*** BEGIN OF GCOV INFO BASE64 ***\n" );
_Hash_Initialize( &gcov_hash );
_Gcov_Dump_info_base64( gcov_put_char, NULL );
- _IO_Printf( rtems_put_char, NULL, "\n*** END OF GCOV INFO BASE64 ***\n" );
- byte = '\n';
- _Hash_Add_data( &gcov_hash, &byte, sizeof( byte ) );
_Hash_Finalize( &gcov_hash, &result );
+ _IO_Printf( rtems_put_char, NULL, "*** END OF GCOV INFO BASE64 ***\n" );
_IO_Printf(
rtems_put_char,
NULL,
More information about the vc
mailing list