diff options
author | Tom Lane | 2015-01-20 04:44:19 +0000 |
---|---|---|
committer | Tom Lane | 2015-01-20 04:44:19 +0000 |
commit | aa719391d5537d30068109e1f96991d0e2c7dfc5 (patch) | |
tree | ac79357fa41d855ba23c7351e7ff22905356bcfb | |
parent | 75b48e1fff8a4dedd3ddd7b76f6360b5cc9bb741 (diff) |
In pg_regress, remove the temporary installation upon successful exit.
This results in a very substantial reduction in disk space usage during
"make check-world", since that sequence involves creation of numerous
temporary installations. It should also help a bit in the buildfarm, even
though the buildfarm script doesn't create as many temp installations,
because the current script misses deleting some of them; and anyway it
seems better to do this once in one place rather than expecting that
script to get it right every time.
In 9.4 and HEAD, also undo the unwise choice in commit b1aebbb6a86e96d7
to report strerror(errno) after a rmtree() failure. rmtree has already
reported that, possibly for multiple failures with distinct errnos; and
what's more, by the time it returns there is no good reason to assume
that errno still reflects the last reportable error. So reporting errno
here is at best redundant and at worst badly misleading.
Back-patch to all supported branches, so that future revisions of the
buildfarm script can rely on this behavior.
-rw-r--r-- | src/test/regress/pg_regress.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index caae3f05de6..0de1af6f8a5 100644 --- a/src/test/regress/pg_regress.c +++ b/src/test/regress/pg_regress.c @@ -537,8 +537,8 @@ convert_sourcefiles_in(char *source_subdir, char *dest_dir, char *dest_subdir, c if (directory_exists(testtablespace)) if (!rmtree(testtablespace, true)) { - fprintf(stderr, _("\n%s: could not remove test tablespace \"%s\": %s\n"), - progname, testtablespace, strerror(errno)); + fprintf(stderr, _("\n%s: could not remove test tablespace \"%s\"\n"), + progname, testtablespace); exit(2); } make_directory(testtablespace); @@ -2392,7 +2392,8 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc header(_("removing existing temp installation")); if (!rmtree(temp_install, true)) { - fprintf(stderr, _("\n%s: could not remove temp installation \"%s\": %s\n"), progname, temp_install, strerror(errno)); + fprintf(stderr, _("\n%s: could not remove temp installation \"%s\"\n"), + progname, temp_install); exit(2); } } @@ -2668,6 +2669,19 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc stop_postmaster(); } + /* + * If there were no errors, remove the temp installation immediately to + * conserve disk space. (If there were errors, we leave the installation + * in place for possible manual investigation.) + */ + if (temp_install && fail_count == 0 && fail_ignore_count == 0) + { + header(_("removing temporary installation")); + if (!rmtree(temp_install, true)) + fprintf(stderr, _("\n%s: could not remove temp installation \"%s\"\n"), + progname, temp_install); + } + fclose(logfile); /* |