1 /*------------------------------------------------------------------------- 2 * 3 * isolationtester.h 4 * include file for isolation tests 5 * 6 * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group 7 * Portions Copyright (c) 1994, Regents of the University of California 8 * 9 * IDENTIFICATION 10 * src/test/isolation/isolationtester.h 11 * 12 *------------------------------------------------------------------------- 13 */ 14 #ifndef ISOLATIONTESTER_H 15 #define ISOLATIONTESTER_H 16 17 /* 18 * The structs declared here are used in the output of specparse.y. 19 * Except where noted, all fields are set in the grammar and not 20 * changed thereafter. 21 */ 22 typedef struct Step Step; 23 24 typedef struct 25 { 26 char *name; 27 char *setupsql; 28 char *teardownsql; 29 Step **steps; 30 int nsteps; 31 } Session; 32 33 struct Step 34 { 35 char *name; 36 char *sql; 37 /* These fields are filled by check_testspec(): */ 38 int session; /* identifies owning session */ 39 bool used; /* has step been used in a permutation? */ 40 }; 41 42 typedef enum 43 { 44 PSB_ONCE, /* force step to wait once */ 45 PSB_OTHER_STEP, /* wait for another step to complete first */ 46 PSB_NUM_NOTICES /* wait for N notices from another session */ 47 } PermutationStepBlockerType; 48 49 typedef struct 50 { 51 char *stepname; 52 PermutationStepBlockerType blocktype; 53 int num_notices; /* only used for PSB_NUM_NOTICES */ 54 /* These fields are filled by check_testspec(): */ 55 Step *step; /* link to referenced step (if any) */ 56 /* These fields are runtime workspace: */ 57 int target_notices; /* total notices needed from other session */ 58 } PermutationStepBlocker; 59 60 typedef struct 61 { 62 char *name; /* name of referenced Step */ 63 PermutationStepBlocker **blockers; 64 int nblockers; 65 /* These fields are filled by check_testspec(): */ 66 Step *step; /* link to referenced Step */ 67 } PermutationStep; 68 69 typedef struct 70 { 71 int nsteps; 72 PermutationStep **steps; 73 } Permutation; 74 75 typedef struct 76 { 77 char **setupsqls; 78 int nsetupsqls; 79 char *teardownsql; 80 Session **sessions; 81 int nsessions; 82 Permutation **permutations; 83 int npermutations; 84 } TestSpec; 85 86 extern TestSpec parseresult; 87 88 extern int spec_yyparse(void); 89 90 extern int spec_yylex(void); 91 extern void spec_yyerror(const char *str); 92 93 #endif /* ISOLATIONTESTER_H */ 94