Skip to content

Commit ef73a81

Browse files
committed
Enforce our convention about max number of parallel regression tests.
We have a very old rule that parallel_schedule should have no more than twenty tests in any one parallel group, so as to provide a bound on the number of concurrently running processes needed to pass the tests. But people keep forgetting the rule, so let's add a few lines of code to check it. Discussion: https://postgr.es/m/a37e9c57-22d4-1b82-1270-4501cd2e984e@2ndquadrant.com
1 parent 1fdab4d commit ef73a81

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

src/test/regress/GNUmakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ tablespace-setup:
124124
## Run tests
125125
##
126126

127-
REGRESS_OPTS = --dlpath=. $(EXTRA_REGRESS_OPTS)
127+
REGRESS_OPTS = --dlpath=. --max-concurrent-tests=20 $(EXTRA_REGRESS_OPTS)
128128

129129
check: all tablespace-setup
130130
$(pg_regress_check) $(REGRESS_OPTS) --schedule=$(srcdir)/parallel_schedule $(MAXCONNOPT) $(EXTRA_TESTS)

src/test/regress/pg_regress.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ char *launcher = NULL;
7878
static _stringlist *loadlanguage = NULL;
7979
static _stringlist *loadextension = NULL;
8080
static int max_connections = 0;
81+
static int max_concurrent_tests = 0;
8182
static char *encoding = NULL;
8283
static _stringlist *schedulelist = NULL;
8384
static _stringlist *extra_tests = NULL;
@@ -1592,9 +1593,9 @@ run_schedule(const char *schedule, test_function tfunc)
15921593
FILE *scf;
15931594
int line_num = 0;
15941595

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));
15981599

15991600
scf = fopen(schedule, "r");
16001601
if (!scf)
@@ -1614,6 +1615,7 @@ run_schedule(const char *schedule, test_function tfunc)
16141615

16151616
line_num++;
16161617

1618+
/* clear out string lists left over from previous line */
16171619
for (i = 0; i < MAX_PARALLEL_TESTS; i++)
16181620
{
16191621
if (resultfiles[i] == NULL)
@@ -1667,8 +1669,8 @@ run_schedule(const char *schedule, test_function tfunc)
16671669
if (num_tests >= MAX_PARALLEL_TESTS)
16681670
{
16691671
/* 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);
16721674
exit(2);
16731675
}
16741676
tests[num_tests] = c;
@@ -1691,6 +1693,13 @@ run_schedule(const char *schedule, test_function tfunc)
16911693
wait_for_tests(pids, statuses, NULL, 1);
16921694
/* status line is finished below */
16931695
}
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+
}
16941703
else if (max_connections > 0 && max_connections < num_tests)
16951704
{
16961705
int oldest = 0;
@@ -1999,6 +2008,8 @@ help(void)
19992008
printf(_(" tests; can appear multiple times\n"));
20002009
printf(_(" --max-connections=N maximum number of concurrent connections\n"));
20012010
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"));
20022013
printf(_(" --outputdir=DIR place output files in DIR (default \".\")\n"));
20032014
printf(_(" --schedule=FILE use test ordering schedule from FILE\n"));
20042015
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
20482059
{"launcher", required_argument, NULL, 21},
20492060
{"load-extension", required_argument, NULL, 22},
20502061
{"config-auth", required_argument, NULL, 24},
2062+
{"max-concurrent-tests", required_argument, NULL, 25},
20512063
{NULL, 0, NULL, 0}
20522064
};
20532065

@@ -2161,6 +2173,9 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
21612173
case 24:
21622174
config_auth_datadir = pg_strdup(optarg);
21632175
break;
2176+
case 25:
2177+
max_concurrent_tests = atoi(optarg);
2178+
break;
21642179
default:
21652180
/* getopt_long already emitted a complaint */
21662181
fprintf(stderr, _("\nTry \"%s -h\" for more information.\n"),

src/tools/msvc/vcregress.pl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ sub installcheck
104104
"--dlpath=.",
105105
"--bindir=../../../$Config/psql",
106106
"--schedule=${schedule}_schedule",
107+
"--max-concurrent-tests=20",
107108
"--encoding=SQL_ASCII",
108109
"--no-locale");
109110
push(@args, $maxconn) if $maxconn;
@@ -122,6 +123,7 @@ sub check
122123
"--dlpath=.",
123124
"--bindir=",
124125
"--schedule=${schedule}_schedule",
126+
"--max-concurrent-tests=20",
125127
"--encoding=SQL_ASCII",
126128
"--no-locale",
127129
"--temp-instance=./tmp_check");

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy