Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "pg_regress.h"
00014
00015
00016
00017
00018
00019 static PID_TYPE
00020 isolation_start_test(const char *testname,
00021 _stringlist ** resultfiles,
00022 _stringlist ** expectfiles,
00023 _stringlist ** tags)
00024 {
00025 PID_TYPE pid;
00026 char infile[MAXPGPATH];
00027 char outfile[MAXPGPATH];
00028 char expectfile[MAXPGPATH];
00029 char psql_cmd[MAXPGPATH * 3];
00030 size_t offset = 0;
00031
00032
00033
00034
00035
00036
00037
00038 snprintf(infile, sizeof(infile), "%s/specs/%s.spec",
00039 outputdir, testname);
00040 if (!file_exists(infile))
00041 snprintf(infile, sizeof(infile), "%s/specs/%s.spec",
00042 inputdir, testname);
00043
00044 snprintf(outfile, sizeof(outfile), "%s/results/%s.out",
00045 outputdir, testname);
00046
00047 snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out",
00048 outputdir, testname);
00049 if (!file_exists(expectfile))
00050 snprintf(expectfile, sizeof(expectfile), "%s/expected/%s.out",
00051 inputdir, testname);
00052
00053 add_stringlist_item(resultfiles, outfile);
00054 add_stringlist_item(expectfiles, expectfile);
00055
00056 if (launcher)
00057 offset += snprintf(psql_cmd + offset, sizeof(psql_cmd) - offset,
00058 "%s ", launcher);
00059
00060 snprintf(psql_cmd + offset, sizeof(psql_cmd) - offset,
00061 SYSTEMQUOTE "\"./isolationtester\" \"dbname=%s\" < \"%s\" > \"%s\" 2>&1" SYSTEMQUOTE,
00062 dblist->str,
00063 infile,
00064 outfile);
00065
00066 pid = spawn_process(psql_cmd);
00067
00068 if (pid == INVALID_PID)
00069 {
00070 fprintf(stderr, _("could not start process for test %s\n"),
00071 testname);
00072 exit(2);
00073 }
00074
00075 return pid;
00076 }
00077
00078 static void
00079 isolation_init(void)
00080 {
00081
00082 add_stringlist_item(&dblist, "isolationtest");
00083 }
00084
00085 int
00086 main(int argc, char *argv[])
00087 {
00088 return regression_main(argc, argv, isolation_init, isolation_start_test);
00089 }