[ redirected from a thread in pgsql-committers[1] ] As of commit eb9812f27 you can run a manual check-world with stdout dumped to /dev/null, and get fairly clean results:
$ time make check-world -j10 >/dev/null NOTICE: database "regression" does not exist, skipping real 1m43.875s user 2m50.659s sys 1m22.518s $ This is a productive way to work because if you do get a failure, make's bleating gives you enough context to see which subdirectory to check the log files in; so you don't really need to see all the noise that goes to stdout. (OTOH, if you don't discard stdout, it's a mess; if you get a failure it could easily scroll off the screen before you ever see it, leaving you with a false impression that the test succeeded.) However ... there is that one NOTICE, which is annoying just because it's the only one left. That's coming from the pg_upgrade test's invocation of "make installcheck" in the instance it's just built. (Every other test lets pg_regress build its own temp instance, and then pg_regress knows it needn't bother with "DROP DATABASE regression".) I experimented with the attached quick-hack patch to make pg_regress suppress notices from its various initial DROP/CREATE IF [NOT] EXISTS commands. I'm not entirely convinced whether suppressing them is a good idea though. Perhaps some hack with effects confined to pg_upgrade's test would be better. I don't have a good idea what that would look like, however. Or we could just say this isn't annoying enough to fix. Thoughts? regards, tom lane [1] https://postgr.es/m/e1hsk9c-0002hh...@gemulon.postgresql.org
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index a1a3d48..57a154c 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -1087,6 +1087,7 @@ psql_command(const char *database, const char *query,...) char query_formatted[1024]; char query_escaped[2048]; char psql_cmd[MAXPGPATH + 2048]; + const char *quiet; va_list args; char *s; char *d; @@ -1106,11 +1107,23 @@ psql_command(const char *database, const char *query,...) } *d = '\0'; + /* + * If the query uses IF EXISTS or IF NOT EXISTS, suppress useless + * "skipping" notices. We intentionally consider only the constant + * "query" string, not what was interpolated into it. + */ + if (strstr(query, "IF EXISTS") != NULL || + strstr(query, "IF NOT EXISTS") != NULL) + quiet = " -c \"SET client_min_messages = warning\""; + else + quiet = ""; + /* And now we can build and execute the shell command */ snprintf(psql_cmd, sizeof(psql_cmd), - "\"%s%spsql\" -X -c \"%s\" \"%s\"", + "\"%s%spsql\" -X%s -c \"%s\" \"%s\"", bindir ? bindir : "", bindir ? "/" : "", + quiet, query_escaped, database);