LCOV - differential code coverage report
Current view: top level - src/test/isolation - specparse.y Coverage Total Hit UNC UBC GNC CBC DUB DCB
Current: 0e5ff9b9b45a657aea12440478dc002e9b01f138 vs 0123ce131fca454009439dfa3b2266d1d40737d7 Lines: 96.7 % 92 89 1 2 18 71 2 23
Current Date: 2026-03-14 14:10:32 -0400 Functions: - 0 0
Baseline: lcov-20260315-024220-baseline Line coverage date bins:
Baseline Date: 2026-03-14 15:27:56 +0100 (7,30] days: 94.7 % 19 18 1 18
Legend: Lines:     hit not hit (360..) days: 97.3 % 73 71 2 71

 Age         Owner                  TLA  Line data    Source code
                                  1                 : %{
                                  2                 : /*-------------------------------------------------------------------------
                                  3                 :  *
                                  4                 :  * specparse.y
                                  5                 :  *    bison grammar for the isolation test file format
                                  6                 :  *
                                  7                 :  * Portions Copyright (c) 1996-2026, PostgreSQL Global Development Group
                                  8                 :  * Portions Copyright (c) 1994, Regents of the University of California
                                  9                 :  *
                                 10                 :  *-------------------------------------------------------------------------
                                 11                 :  */
                                 12                 : 
                                 13                 : #include "postgres_fe.h"
                                 14                 : 
                                 15                 : #include "isolationtester.h"
                                 16                 : #include "specparse.h"
                                 17                 : 
                                 18                 : /* silence -Wmissing-variable-declarations */
                                 19                 : extern int spec_yychar;
                                 20                 : extern int spec_yynerrs;
                                 21                 : 
                                 22                 : TestSpec        parseresult;            /* result of parsing is left here */
                                 23                 : 
                                 24                 : %}
                                 25                 : 
                                 26                 : %expect 0
                                 27                 : %name-prefix="spec_yy"
                                 28                 : 
                                 29                 : %union
                                 30                 : {
                                 31                 :     char       *str;
                                 32                 :     int         integer;
                                 33                 :     Session    *session;
                                 34                 :     Step       *step;
                                 35                 :     Permutation *permutation;
                                 36                 :     PermutationStep *permutationstep;
                                 37                 :     PermutationStepBlocker *blocker;
                                 38                 :     struct
                                 39                 :     {
                                 40                 :         void  **elements;
                                 41                 :         int     nelements;
                                 42                 :     }           ptr_list;
                                 43                 : }
                                 44                 : 
                                 45                 : %type <ptr_list> setup_list
                                 46                 : %type <str>  opt_setup opt_teardown
                                 47                 : %type <str> setup
                                 48                 : %type <ptr_list> step_list session_list permutation_list opt_permutation_list
                                 49                 : %type <ptr_list> permutation_step_list blocker_list
                                 50                 : %type <session> session
                                 51                 : %type <step> step
                                 52                 : %type <permutation> permutation
                                 53                 : %type <permutationstep> permutation_step
                                 54                 : %type <blocker> blocker
                                 55                 : 
                                 56                 : %token <str> sqlblock identifier
                                 57                 : %token <integer> INTEGER
                                 58                 : %token NOTICES PERMUTATION SESSION SETUP STEP TEARDOWN TEST
                                 59                 : 
                                 60                 : %%
                                 61                 : 
                                 62                 : TestSpec:
                                 63                 :             setup_list
                                 64                 :             opt_teardown
                                 65                 :             session_list
                                 66                 :             opt_permutation_list
                                 67                 :             {
 4940 kgrittn@postgresql.o       68 CBC         152 :                 parseresult.setupsqls = (char **) $1.elements;
                                 69             152 :                 parseresult.nsetupsqls = $1.nelements;
 5515 heikki.linnakangas@i       70             152 :                 parseresult.teardownsql = $2;
                                 71             152 :                 parseresult.sessions = (Session **) $3.elements;
                                 72             152 :                 parseresult.nsessions = $3.nelements;
                                 73             152 :                 parseresult.permutations = (Permutation **) $4.elements;
                                 74             152 :                 parseresult.npermutations = $4.nelements;
                                 75                 :             }
                                 76                 :         ;
                                 77                 : 
                                 78                 : setup_list:
                                 79                 :             /* EMPTY */
                                 80                 :             {
 4940 kgrittn@postgresql.o       81             152 :                 $$.elements = NULL;
                                 82             152 :                 $$.nelements = 0;
                                 83                 :             }
                                 84                 :             | setup_list setup
                                 85                 :             {
   16 michael@paquier.xyz        86 GNC         160 :                 $$.elements = pg_realloc_array($1.elements, void *,
                                 87                 :                                                $1.nelements + 1);
 4940 kgrittn@postgresql.o       88 CBC         160 :                 $$.elements[$1.nelements] = $2;
                                 89             160 :                 $$.nelements = $1.nelements + 1;
                                 90                 :             }
                                 91                 :         ;
                                 92                 : 
                                 93                 : opt_setup:
 5515 heikki.linnakangas@i       94             151 :             /* EMPTY */         { $$ = NULL; }
 4940 kgrittn@postgresql.o       95             224 :             | setup             { $$ = $1; }
                                 96                 :         ;
                                 97                 : 
                                 98                 : setup:
                                 99             384 :             SETUP sqlblock      { $$ = $2; }
                                100                 :         ;
                                101                 : 
                                102                 : opt_teardown:
 5515 heikki.linnakangas@i      103             360 :             /* EMPTY */         { $$ = NULL; }
                                104             167 :             | TEARDOWN sqlblock { $$ = $2; }
                                105                 :         ;
                                106                 : 
                                107                 : session_list:
                                108                 :             session_list session
                                109                 :             {
   16 michael@paquier.xyz       110 GNC         223 :                 $$.elements = pg_realloc_array($1.elements, void *,
                                111                 :                                                $1.nelements + 1);
 5515 heikki.linnakangas@i      112 CBC         223 :                 $$.elements[$1.nelements] = $2;
                                113             223 :                 $$.nelements = $1.nelements + 1;
                                114                 :             }
                                115                 :             | session
                                116                 :             {
                                117             152 :                 $$.nelements = 1;
   16 michael@paquier.xyz       118 GNC         152 :                 $$.elements = pg_malloc_object(void *);
 5515 heikki.linnakangas@i      119 CBC         152 :                 $$.elements[0] = $1;
                                120                 :             }
                                121                 :         ;
                                122                 : 
                                123                 : session:
                                124                 :             SESSION identifier opt_setup step_list opt_teardown
                                125                 :             {
   16 michael@paquier.xyz       126 GNC         375 :                 $$ = pg_malloc_object(Session);
 5515 heikki.linnakangas@i      127 CBC         375 :                 $$->name = $2;
                                128             375 :                 $$->setupsql = $3;
                                129             375 :                 $$->steps = (Step **) $4.elements;
                                130             375 :                 $$->nsteps = $4.nelements;
                                131             375 :                 $$->teardownsql = $5;
                                132                 :             }
                                133                 :         ;
                                134                 : 
                                135                 : step_list:
                                136                 :             step_list step
                                137                 :             {
   16 michael@paquier.xyz       138 GNC        1217 :                 $$.elements = pg_realloc_array($1.elements, void *,
                                139                 :                                                $1.nelements + 1);
 5515 heikki.linnakangas@i      140 CBC        1217 :                 $$.elements[$1.nelements] = $2;
                                141            1217 :                 $$.nelements = $1.nelements + 1;
                                142                 :             }
                                143                 :             | step
                                144                 :             {
                                145             375 :                 $$.nelements = 1;
   16 michael@paquier.xyz       146 GNC         375 :                 $$.elements = pg_malloc_object(void *);
 5515 heikki.linnakangas@i      147 CBC         375 :                 $$.elements[0] = $1;
                                148                 :             }
                                149                 :         ;
                                150                 : 
                                151                 : 
                                152                 : step:
                                153                 :             STEP identifier sqlblock
                                154                 :             {
   16 michael@paquier.xyz       155 GNC        1592 :                 $$ = pg_malloc_object(Step);
 5515 heikki.linnakangas@i      156 CBC        1592 :                 $$->name = $2;
                                157            1592 :                 $$->sql = $3;
 1727 tgl@sss.pgh.pa.us         158            1592 :                 $$->session = -1; /* until filled */
 2395 michael@paquier.xyz       159            1592 :                 $$->used = false;
                                160                 :             }
                                161                 :         ;
                                162                 : 
                                163                 : 
                                164                 : opt_permutation_list:
                                165                 :             permutation_list
                                166                 :             {
 5515 heikki.linnakangas@i      167             138 :                 $$ = $1;
                                168                 :             }
                                169                 :             | /* EMPTY */
                                170                 :             {
                                171              14 :                 $$.elements = NULL;
                                172              14 :                 $$.nelements = 0;
                                173                 :             }
                                174                 : 
                                175                 : permutation_list:
                                176                 :             permutation_list permutation
                                177                 :             {
   16 michael@paquier.xyz       178 GNC        1160 :                 $$.elements = pg_realloc_array($1.elements, void *,
                                179                 :                                                $1.nelements + 1);
 5515 heikki.linnakangas@i      180 CBC        1160 :                 $$.elements[$1.nelements] = $2;
                                181            1160 :                 $$.nelements = $1.nelements + 1;
                                182                 :             }
                                183                 :             | permutation
                                184                 :             {
                                185             138 :                 $$.nelements = 1;
   16 michael@paquier.xyz       186 GNC         138 :                 $$.elements = pg_malloc_object(void *);
 5515 heikki.linnakangas@i      187 CBC         138 :                 $$.elements[0] = $1;
                                188                 :             }
                                189                 :         ;
                                190                 : 
                                191                 : 
                                192                 : permutation:
                                193                 :             PERMUTATION permutation_step_list
                                194                 :             {
   16 michael@paquier.xyz       195 GNC        1298 :                 $$ = pg_malloc_object(Permutation);
 5515 heikki.linnakangas@i      196 CBC        1298 :                 $$->nsteps = $2.nelements;
 1727 tgl@sss.pgh.pa.us         197            1298 :                 $$->steps = (PermutationStep **) $2.elements;
                                198                 :             }
                                199                 :         ;
                                200                 : 
                                201                 : permutation_step_list:
                                202                 :             permutation_step_list permutation_step
                                203                 :             {
   16 michael@paquier.xyz       204 GNC        8322 :                 $$.elements = pg_realloc_array($1.elements, void *,
                                205                 :                                                $1.nelements + 1);
 5515 heikki.linnakangas@i      206 CBC        8322 :                 $$.elements[$1.nelements] = $2;
                                207            8322 :                 $$.nelements = $1.nelements + 1;
                                208                 :             }
                                209                 :             | permutation_step
                                210                 :             {
                                211            1298 :                 $$.nelements = 1;
   16 michael@paquier.xyz       212 GNC        1298 :                 $$.elements = pg_malloc_object(void *);
 5515 heikki.linnakangas@i      213 CBC        1298 :                 $$.elements[0] = $1;
                                214                 :             }
                                215                 :         ;
                                216                 : 
                                217                 : permutation_step:
                                218                 :             identifier
                                219                 :             {
   16 michael@paquier.xyz       220 GNC        9545 :                 $$ = pg_malloc_object(PermutationStep);
 1727 tgl@sss.pgh.pa.us         221 CBC        9545 :                 $$->name = $1;
                                222            9545 :                 $$->blockers = NULL;
                                223            9545 :                 $$->nblockers = 0;
                                224            9545 :                 $$->step = NULL;
                                225                 :             }
                                226                 :             | identifier '(' blocker_list ')'
                                227                 :             {
   16 michael@paquier.xyz       228 GNC          75 :                 $$ = pg_malloc_object(PermutationStep);
 1727 tgl@sss.pgh.pa.us         229 CBC          75 :                 $$->name = $1;
                                230              75 :                 $$->blockers = (PermutationStepBlocker **) $3.elements;
                                231              75 :                 $$->nblockers = $3.nelements;
                                232              75 :                 $$->step = NULL;
                                233                 :             }
                                234                 :         ;
                                235                 : 
                                236                 : blocker_list:
                                237                 :             blocker_list ',' blocker
                                238                 :             {
   16 michael@paquier.xyz       239 UNC           0 :                 $$.elements = pg_realloc_array($1.elements, void *,
                                240                 :                                                $1.nelements + 1);
 1727 tgl@sss.pgh.pa.us         241 UBC           0 :                 $$.elements[$1.nelements] = $3;
                                242               0 :                 $$.nelements = $1.nelements + 1;
                                243                 :             }
                                244                 :             | blocker
                                245                 :             {
 1727 tgl@sss.pgh.pa.us         246 CBC          75 :                 $$.nelements = 1;
   16 michael@paquier.xyz       247 GNC          75 :                 $$.elements = pg_malloc_object(void *);
 1727 tgl@sss.pgh.pa.us         248 CBC          75 :                 $$.elements[0] = $1;
                                249                 :             }
                                250                 :         ;
                                251                 : 
                                252                 : blocker:
                                253                 :             identifier
                                254                 :             {
   16 michael@paquier.xyz       255 GNC          62 :                 $$ = pg_malloc_object(PermutationStepBlocker);
 1727 tgl@sss.pgh.pa.us         256 CBC          62 :                 $$->stepname = $1;
                                257              62 :                 $$->blocktype = PSB_OTHER_STEP;
                                258              62 :                 $$->num_notices = -1;
                                259              62 :                 $$->step = NULL;
                                260              62 :                 $$->target_notices = -1;
                                261                 :             }
                                262                 :             | identifier NOTICES INTEGER
                                263                 :             {
   16 michael@paquier.xyz       264 GNC           1 :                 $$ = pg_malloc_object(PermutationStepBlocker);
 1727 tgl@sss.pgh.pa.us         265 CBC           1 :                 $$->stepname = $1;
                                266               1 :                 $$->blocktype = PSB_NUM_NOTICES;
                                267               1 :                 $$->num_notices = $3;
                                268               1 :                 $$->step = NULL;
                                269               1 :                 $$->target_notices = -1;
                                270                 :             }
                                271                 :             | '*'
                                272                 :             {
   16 michael@paquier.xyz       273 GNC          12 :                 $$ = pg_malloc_object(PermutationStepBlocker);
 1727 tgl@sss.pgh.pa.us         274 CBC          12 :                 $$->stepname = NULL;
                                275              12 :                 $$->blocktype = PSB_ONCE;
                                276              12 :                 $$->num_notices = -1;
                                277              12 :                 $$->step = NULL;
                                278              12 :                 $$->target_notices = -1;
                                279                 :             }
                                280                 :         ;
                                281                 : 
                                282                 : %%
        

Generated by: LCOV version 2.4-beta