diff --git a/src/test/regress/pg_regress.c b/src/test/regress/pg_regress.c index caae3f05de..0de1af6f8a 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); /*