1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Exclude flex-generated code from coverage testing

Flex generates a lot of functions that are not actually used.  In order
to avoid coverage figures being ruined by that, mark up the part of the
.l files where the generated code appears by lcov exclusion markers.
That way, lcov will typically only reported on coverage for the .l file,
which is under our control, but not for the .c file.

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
This commit is contained in:
Peter Eisentraut
2017-08-10 23:33:47 -04:00
parent cf5ba7c30c
commit 4211673622
12 changed files with 47 additions and 1 deletions

View File

@@ -38,6 +38,7 @@
/* Not needed now that this file is compiled as part of bootparse. */
/* #include "bootparse.h" */
/* LCOV_EXCL_START */
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
#undef fprintf
@@ -134,6 +135,8 @@ insert { return INSERT_TUPLE; }
%%
/* LCOV_EXCL_STOP */
void
yyerror(const char *message)
{

View File

@@ -41,6 +41,9 @@
}
%{
/* LCOV_EXCL_START */
/* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
#undef fprintf
#define fprintf(file, fmt, msg) fprintf_to_ereport(fmt, msg)
@@ -1011,6 +1014,8 @@ other .
%%
/* LCOV_EXCL_STOP */
/*
* Arrange access to yyextra for subroutines of the main yylex() function.
* We expect each subroutine to have a yyscanner parameter. Rather than

View File

@@ -38,6 +38,8 @@ static char *litbufdup(void);
static void addlit(char *ytext, int yleng);
static void addlitchar(unsigned char ychar);
/* LCOV_EXCL_START */
%}
%option 8bit
@@ -186,6 +188,7 @@ WAIT { return K_WAIT; }
}
%%
/* LCOV_EXCL_STOP */
static void
startlit(void)

View File

@@ -32,6 +32,8 @@ static YY_BUFFER_STATE scanbufhandle;
static StringInfoData xdbuf;
/* LCOV_EXCL_START */
%}
%option 8bit
@@ -112,6 +114,7 @@ xdinside [^"]+
. { return JUNK; }
%%
/* LCOV_EXCL_STOP */
/* Needs to be here for access to yytext */
void

View File

@@ -57,6 +57,8 @@ static void record_config_file_error(const char *errmsg,
static int GUC_flex_fatal(const char *msg);
static char *GUC_scanstr(const char *s);
/* LCOV_EXCL_START */
%}
%option 8bit
@@ -107,7 +109,7 @@ STRING \'([^'\\\n]|\\.|\'\')*\'
%%
/* LCOV_EXCL_STOP */
/*
* Exported function to read and process the configuration file. The