@@ -78,6 +78,7 @@ char *launcher = NULL;
78
78
static _stringlist * loadlanguage = NULL ;
79
79
static _stringlist * loadextension = NULL ;
80
80
static int max_connections = 0 ;
81
+ static int max_concurrent_tests = 0 ;
81
82
static char * encoding = NULL ;
82
83
static _stringlist * schedulelist = NULL ;
83
84
static _stringlist * extra_tests = NULL ;
@@ -1592,9 +1593,9 @@ run_schedule(const char *schedule, test_function tfunc)
1592
1593
FILE * scf ;
1593
1594
int line_num = 0 ;
1594
1595
1595
- memset (resultfiles , 0 , sizeof (_stringlist * ) * MAX_PARALLEL_TESTS );
1596
- memset (expectfiles , 0 , sizeof (_stringlist * ) * MAX_PARALLEL_TESTS );
1597
- memset (tags , 0 , sizeof (_stringlist * ) * MAX_PARALLEL_TESTS );
1596
+ memset (resultfiles , 0 , sizeof (resultfiles ) );
1597
+ memset (expectfiles , 0 , sizeof (expectfiles ) );
1598
+ memset (tags , 0 , sizeof (tags ) );
1598
1599
1599
1600
scf = fopen (schedule , "r" );
1600
1601
if (!scf )
@@ -1614,6 +1615,7 @@ run_schedule(const char *schedule, test_function tfunc)
1614
1615
1615
1616
line_num ++ ;
1616
1617
1618
+ /* clear out string lists left over from previous line */
1617
1619
for (i = 0 ; i < MAX_PARALLEL_TESTS ; i ++ )
1618
1620
{
1619
1621
if (resultfiles [i ] == NULL )
@@ -1667,8 +1669,8 @@ run_schedule(const char *schedule, test_function tfunc)
1667
1669
if (num_tests >= MAX_PARALLEL_TESTS )
1668
1670
{
1669
1671
/* can't print scbuf here, it's already been trashed */
1670
- fprintf (stderr , _ ("too many parallel tests in schedule file \"%s\", line %d\n" ),
1671
- schedule , line_num );
1672
+ fprintf (stderr , _ ("too many parallel tests (more than %d) in schedule file \"%s\" line %d\n" ),
1673
+ MAX_PARALLEL_TESTS , schedule , line_num );
1672
1674
exit (2 );
1673
1675
}
1674
1676
tests [num_tests ] = c ;
@@ -1691,6 +1693,13 @@ run_schedule(const char *schedule, test_function tfunc)
1691
1693
wait_for_tests (pids , statuses , NULL , 1 );
1692
1694
/* status line is finished below */
1693
1695
}
1696
+ else if (max_concurrent_tests > 0 && max_concurrent_tests < num_tests )
1697
+ {
1698
+ /* can't print scbuf here, it's already been trashed */
1699
+ fprintf (stderr , _ ("too many parallel tests (more than %d) in schedule file \"%s\" line %d\n" ),
1700
+ max_concurrent_tests , schedule , line_num );
1701
+ exit (2 );
1702
+ }
1694
1703
else if (max_connections > 0 && max_connections < num_tests )
1695
1704
{
1696
1705
int oldest = 0 ;
@@ -1999,6 +2008,8 @@ help(void)
1999
2008
printf (_ (" tests; can appear multiple times\n" ));
2000
2009
printf (_ (" --max-connections=N maximum number of concurrent connections\n" ));
2001
2010
printf (_ (" (default is 0, meaning unlimited)\n" ));
2011
+ printf (_ (" --max-concurrent-tests=N maximum number of concurrent tests in schedule\n" ));
2012
+ printf (_ (" (default is 0, meaning unlimited)\n" ));
2002
2013
printf (_ (" --outputdir=DIR place output files in DIR (default \".\")\n" ));
2003
2014
printf (_ (" --schedule=FILE use test ordering schedule from FILE\n" ));
2004
2015
printf (_ (" (can be used multiple times to concatenate)\n" ));
@@ -2048,6 +2059,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
2048
2059
{"launcher" , required_argument , NULL , 21 },
2049
2060
{"load-extension" , required_argument , NULL , 22 },
2050
2061
{"config-auth" , required_argument , NULL , 24 },
2062
+ {"max-concurrent-tests" , required_argument , NULL , 25 },
2051
2063
{NULL , 0 , NULL , 0 }
2052
2064
};
2053
2065
@@ -2161,6 +2173,9 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
2161
2173
case 24 :
2162
2174
config_auth_datadir = pg_strdup (optarg );
2163
2175
break ;
2176
+ case 25 :
2177
+ max_concurrent_tests = atoi (optarg );
2178
+ break ;
2164
2179
default :
2165
2180
/* getopt_long already emitted a complaint */
2166
2181
fprintf (stderr , _ ("\nTry \"%s -h\" for more information.\n" ),
0 commit comments