Improve coverage computation

This commit is contained in:
Patrick Pelissier committed 2023-04-03 00:23:05 +02:00
1 parent 1d163a396e
commit aebe1308fc
8 files changed
+22 -8

No files matched your search

+1 -1
View File
@@ -68,7 +68,7 @@ all:
awk ' printit { print } /END_COVERAGE/ { printit=1}' $< > $<.end.c
$(CC) $(CPPFLAGS) -E -DNDEBUG -DWITHIN_COVERAGE $< |grep -v '^#' |awk ' /END_COVERAGE/ { printit=0} printit { print } /START_COVERAGE/ { printit=1 }' |perl -p -e "s/;(?![\"'])/;\n/g ; s/}(?![\"'])/}\n/g ; s/{(?![\"'])/{\n/g" > $<.middle.c
cat $<.first.c $<.middle.c $<.end.c > $<.c
$(CC) $(CPPFLAGS) -ftest-coverage -fprofile-arcs -O -g $<.c -o $<.exe $(LDFLAGS)
$(CC) $(CPPFLAGS) -DBUILD_COVERAGE -ftest-coverage -fprofile-arcs -O -g $<.c -o $<.exe $(LDFLAGS)
$(LOG_COMPILER) ./$<.exe
LANG=C gcov -b $<.gcno > `basename $< .c`.synt
cat `basename $< .c`.synt
+5 -2
View File
@@ -40,10 +40,9 @@
It'll contain the macro expanded & annotated.
*/
#ifdef WITHIN_COVERAGE
#if defined(WITHIN_COVERAGE) || defined (BUILD_COVERAGE)
/* For coverage build, expand the typical macros assert, avoid expanding then
to not disturb coverage measurement */
#undef assert
#undef M_ASSERT
#define M_ASSERT(...) (void)0
#undef M_ASSERT_SLOW
@@ -127,7 +126,11 @@
/* Overwrite M_UNLIKELY_NOMEM so that it can never fails, to avoid spurious coverage */
#undef M_UNLIKELY_NOMEM
#define M_UNLIKELY_NOMEM(...) 0
#endif
#ifdef WITHIN_COVERAGE
/* For coverage build, do not expand other likes NULL, etc. */
#undef assert
#undef M_STATIC_FAILURE
#undef NULL
#undef M_LIKELY
+2 -1
View File
@@ -21,8 +21,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include "m-string.h"
#include "coverage.h"
#include "m-bitset.h"
static void test1(void)
+2
View File
@@ -23,6 +23,8 @@
#include <stdio.h>
#include "m-thread.h"
#include "m-atomic.h"
#include "m-core.h"
#include "coverage.h"
#include "m-genint.h"
+3 -1
View File
@@ -20,12 +20,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "m-serial-bin.h"
#include "m-tuple.h"
#include "m-array.h"
#include "m-variant.h"
#include "m-list.h"
#include "m-dict.h"
#include "coverage.h"
#include "m-serial-bin.h"
// Serial bin is not supported for standard types if not C11
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+3 -1
View File
@@ -20,12 +20,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "m-serial-json.h"
#include "m-tuple.h"
#include "m-array.h"
#include "m-variant.h"
#include "m-list.h"
#include "m-dict.h"
#include "coverage.h"
#include "m-serial-json.h"
// Serial json is not supported for standard types if not C11
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
+3
View File
@@ -22,6 +22,9 @@
*/
#define M_USE_ADDITIONAL_CHECKS 1
#include "m-core.h"
#include "coverage.h"
#include "m-string.h"
BOUNDED_STRING_DEF(string16, 16)
+3 -2
View File
@@ -20,8 +20,9 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#include <assert.h>
#include "m-core.h"
#include "coverage.h"
#include "m-worker.h"
/* Compute Fibonacci number using thread systems. */