deparse: pg_regress support generate_files_only
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 12 Feb 2015 18:17:19 +0000 (15:17 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 7 Apr 2015 17:09:41 +0000 (14:09 -0300)
src/test/regress/GNUmakefile
src/test/regress/pg_regress.c

index 110eb8080de859f474a35f11ca398f9955b8207b..9eafcd870a207a2719ac0125d915bd3b564f1680 100644 (file)
@@ -127,6 +127,12 @@ tablespace-setup:
    rm -rf ./testtablespace
    mkdir ./testtablespace
 
+# DDL-deparse setup
+
+.PHONY: generate-files
+generate-files:
+   $(top_builddir)/src/test/regress/pg_regress --generate-files-only --inputdir=$(srcdir)/input
+
 
 ##
 ## Run tests
index 97d5d23ed9256b4b30e062f65d5e781f2ae1405a..67cf727a3f062c38ffb97752880b38ac5c85fa0b 100644 (file)
@@ -108,6 +108,7 @@ static char *user = NULL;
 static _stringlist *extraroles = NULL;
 static _stringlist *extra_install = NULL;
 static char *config_auth_datadir = NULL;
+static bool generate_files_only = false;
 
 /* internal variables */
 static const char *progname;
@@ -2107,6 +2108,7 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
        {"extra-install", required_argument, NULL, 23},
        {"config-auth", required_argument, NULL, 24},
        {"dbname-deparse", required_argument, NULL, 25},
+       {"generate-files-only", no_argument, NULL, 26},
        {NULL, 0, NULL, 0}
    };
 
@@ -2235,6 +2237,9 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
            case 25:
                strncpy(deparse_test_db, optarg, sizeof(deparse_test_db));
                break;
+           case 26:
+               generate_files_only = true;
+               break;
            default:
                /* getopt_long already emitted a complaint */
                fprintf(stderr, _("\nTry \"%s -h\" for more information.\n"),
@@ -2275,6 +2280,12 @@ regression_main(int argc, char *argv[], init_function ifunc, test_function tfunc
    outputdir = make_absolute_path(outputdir);
    dlpath = make_absolute_path(dlpath);
 
+   if (generate_files_only)
+   {
+       convert_sourcefiles();
+       exit(0);
+   }
+
    /*
     * Initialization
     */