@@ -731,7 +731,7 @@ static void
731
731
initialize_environment (void )
732
732
{
733
733
/*
734
- * Set default application_name. (The test_function may choose to
734
+ * Set default application_name. (The test_start_function may choose to
735
735
* override this, but if it doesn't, we have something useful in place.)
736
736
*/
737
737
setenv ("PGAPPNAME" , "pg_regress" , 1 );
@@ -1616,7 +1616,8 @@ log_child_failure(int exitstatus)
1616
1616
* Run all the tests specified in one schedule file
1617
1617
*/
1618
1618
static void
1619
- run_schedule (const char * schedule , test_function tfunc )
1619
+ run_schedule (const char * schedule , test_start_function startfunc ,
1620
+ postprocess_result_function postfunc )
1620
1621
{
1621
1622
#define MAX_PARALLEL_TESTS 100
1622
1623
char * tests [MAX_PARALLEL_TESTS ];
@@ -1730,7 +1731,7 @@ run_schedule(const char *schedule, test_function tfunc)
1730
1731
if (num_tests == 1 )
1731
1732
{
1732
1733
status (_ ("test %-28s ... " ), tests [0 ]);
1733
- pids [0 ] = (tfunc ) (tests [0 ], & resultfiles [0 ], & expectfiles [0 ], & tags [0 ]);
1734
+ pids [0 ] = (startfunc ) (tests [0 ], & resultfiles [0 ], & expectfiles [0 ], & tags [0 ]);
1734
1735
INSTR_TIME_SET_CURRENT (starttimes [0 ]);
1735
1736
wait_for_tests (pids , statuses , stoptimes , NULL , 1 );
1736
1737
/* status line is finished below */
@@ -1756,7 +1757,7 @@ run_schedule(const char *schedule, test_function tfunc)
1756
1757
tests + oldest , i - oldest );
1757
1758
oldest = i ;
1758
1759
}
1759
- pids [i ] = (tfunc ) (tests [i ], & resultfiles [i ], & expectfiles [i ], & tags [i ]);
1760
+ pids [i ] = (startfunc ) (tests [i ], & resultfiles [i ], & expectfiles [i ], & tags [i ]);
1760
1761
INSTR_TIME_SET_CURRENT (starttimes [i ]);
1761
1762
}
1762
1763
wait_for_tests (pids + oldest , statuses + oldest ,
@@ -1769,7 +1770,7 @@ run_schedule(const char *schedule, test_function tfunc)
1769
1770
status (_ ("parallel group (%d tests): " ), num_tests );
1770
1771
for (i = 0 ; i < num_tests ; i ++ )
1771
1772
{
1772
- pids [i ] = (tfunc ) (tests [i ], & resultfiles [i ], & expectfiles [i ], & tags [i ]);
1773
+ pids [i ] = (startfunc ) (tests [i ], & resultfiles [i ], & expectfiles [i ], & tags [i ]);
1773
1774
INSTR_TIME_SET_CURRENT (starttimes [i ]);
1774
1775
}
1775
1776
wait_for_tests (pids , statuses , stoptimes , tests , num_tests );
@@ -1801,6 +1802,8 @@ run_schedule(const char *schedule, test_function tfunc)
1801
1802
{
1802
1803
bool newdiff ;
1803
1804
1805
+ if (postfunc )
1806
+ (* postfunc ) (rl -> str );
1804
1807
newdiff = results_differ (tests [i ], rl -> str , el -> str );
1805
1808
if (newdiff && tl )
1806
1809
{
@@ -1867,7 +1870,8 @@ run_schedule(const char *schedule, test_function tfunc)
1867
1870
* Run a single test
1868
1871
*/
1869
1872
static void
1870
- run_single_test (const char * test , test_function tfunc )
1873
+ run_single_test (const char * test , test_start_function startfunc ,
1874
+ postprocess_result_function postfunc )
1871
1875
{
1872
1876
PID_TYPE pid ;
1873
1877
instr_time starttime ;
@@ -1882,7 +1886,7 @@ run_single_test(const char *test, test_function tfunc)
1882
1886
bool differ = false;
1883
1887
1884
1888
status (_ ("test %-28s ... " ), test );
1885
- pid = (tfunc ) (test , & resultfiles , & expectfiles , & tags );
1889
+ pid = (startfunc ) (test , & resultfiles , & expectfiles , & tags );
1886
1890
INSTR_TIME_SET_CURRENT (starttime );
1887
1891
wait_for_tests (& pid , & exit_status , & stoptime , NULL , 1 );
1888
1892
@@ -1900,6 +1904,8 @@ run_single_test(const char *test, test_function tfunc)
1900
1904
{
1901
1905
bool newdiff ;
1902
1906
1907
+ if (postfunc )
1908
+ (* postfunc ) (rl -> str );
1903
1909
newdiff = results_differ (test , rl -> str , el -> str );
1904
1910
if (newdiff && tl )
1905
1911
{
@@ -2083,7 +2089,10 @@ help(void)
2083
2089
}
2084
2090
2085
2091
int
2086
- regression_main (int argc , char * argv [], init_function ifunc , test_function tfunc )
2092
+ regression_main (int argc , char * argv [],
2093
+ init_function ifunc ,
2094
+ test_start_function startfunc ,
2095
+ postprocess_result_function postfunc )
2087
2096
{
2088
2097
static struct option long_options [] = {
2089
2098
{"help" , no_argument , NULL , 'h' },
@@ -2554,12 +2563,12 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
2554
2563
2555
2564
for (sl = schedulelist ; sl != NULL ; sl = sl -> next )
2556
2565
{
2557
- run_schedule (sl -> str , tfunc );
2566
+ run_schedule (sl -> str , startfunc , postfunc );
2558
2567
}
2559
2568
2560
2569
for (sl = extra_tests ; sl != NULL ; sl = sl -> next )
2561
2570
{
2562
- run_single_test (sl -> str , tfunc );
2571
+ run_single_test (sl -> str , startfunc , postfunc );
2563
2572
}
2564
2573
2565
2574
/*
0 commit comments