Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxbaV-0007zh-6z for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Nov 2022 22:17:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oxbaU-0001IW-1d for pgsql-hackers@arkaria.postgresql.org; Tue, 22 Nov 2022 22:17:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxbaT-0001IN-BC for pgsql-hackers@lists.postgresql.org; Tue, 22 Nov 2022 22:17:53 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxbaP-0005Wv-K6 for pgsql-hackers@lists.postgresql.org; Tue, 22 Nov 2022 22:17:52 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id C9D0F2F7EECF for ; Tue, 22 Nov 2022 23:17:45 +0100 (CET) Received: from s979.loopia.se (unknown [172.22.191.6]) by s807.loopia.se (Postfix) with ESMTP id B80CA2E28294; Tue, 22 Nov 2022 23:17:45 +0100 (CET) Received: from s475.loopia.se (unknown [172.22.191.5]) by s979.loopia.se (Postfix) with ESMTP id B319F10BC3AB; Tue, 22 Nov 2022 23:17:45 +0100 (CET) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s899.loopia.se ([172.22.191.6]) by s475.loopia.se (s475.loopia.se [172.22.190.15]) (amavisd-new, port 10024) with LMTP id ka7xFgS1LyN1; Tue, 22 Nov 2022 23:17:45 +0100 (CET) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s899.loopia.se (Postfix) with ESMTPSA id E6E222C8BA35; Tue, 22 Nov 2022 23:17:44 +0100 (CET) From: Daniel Gustafsson Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_AA42F73D-E7F8-4657-8745-84EA12EF9272" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: TAP output format in pg_regress Date: Tue, 22 Nov 2022 23:17:44 +0100 In-Reply-To: <87leo4ifum.fsf@wibble.ilmari.org> Cc: Andres Freund , Nikolay Shaplov , PostgreSQL Developers , Andrew Dunstan , Tom Lane , Peter Eisentraut To: =?utf-8?Q?Dagfinn_Ilmari_Manns=C3=A5ker?= References: <5e6bc6a6-0a4e-109d-2b7d-c286dc58d609@enterprisedb.com> <664EA416-9C16-40F6-84B2-80E8542AFF43@yesql.se> <20221002010153.k5rvcmlqczksdujq@awork3.anarazel.de> <3651868.BXJB8xsqyR@thinkpad-pgpro> <20221117183749.qw6yogvc6k46hknb@awork3.anarazel.de> <87leo4ifum.fsf@wibble.ilmari.org> X-Mailer: Apple Mail (2.3696.100.31) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_AA42F73D-E7F8-4657-8745-84EA12EF9272 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On 21 Nov 2022, at 14:42, Dagfinn Ilmari Manns=C3=A5ker = wrote: >=20 > Andres Freund writes: >=20 >> But either way, it seems nicer to output the # inside a helper = function? >=20 > Note that the helper function should inject '# ' at the start of every > line in the message, not just the first line. It might also be worth > having two separate functions: one that prints to stdout, so is only > shown by the harness is in verbose mode, and another which prints to > stderr, so is always shown. Perl's Test::More calls these note() and > diag(), respectively. >=20 >>> + /* >>> + * In order for this information (or any error information) to = be shown >>> + * when running pg_regress test suites under prove it needs to = be emitted >>> + * stderr instead of stdout. >>> + */ >>> if (file_size(difffilename) > 0) >>> { >>> - printf(_("The differences that caused some tests to fail = can be viewed in the\n" >>> - "file \"%s\". A copy of the test = summary that you see\n" >>> - "above is saved in the file = \"%s\".\n\n"), >>> + status(_("\n# The differences that caused some tests to = fail can be viewed in the\n" >>> + "# file \"%s\". A copy of the test = summary that you see\n" >>> + "# above is saved in the file = \"%s\".\n\n"), >>> difffilename, logfilename); >>=20 >> The comment about needing to print to stderr is correct - but the = patch >> doesn't do so (anymore)? >>=20 >> The count of failed tests also should go to stderr (but not the = report of all >> tests having passed). >>=20 >> bail() probably also ought to print the error to stderr, so the most = important >> detail is immediately visible when looking at the failed test result. >=20 > Agreed on all three points. The attached v10 attempts to address the points raised above. Notes and diagnostics are printed to stdout/stderr respectively and the TAP = emitter is changed to move more of the syntax into it making it less painful on the translators. -- Daniel Gustafsson https://vmware.com/ --Apple-Mail=_AA42F73D-E7F8-4657-8745-84EA12EF9272 Content-Disposition: attachment; filename=v10-0002-Experimental-meson-treat-regress-tests-as-TAP.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="v10-0002-Experimental-meson-treat-regress-tests-as-TAP.patch" Content-Transfer-Encoding: quoted-printable =46rom=205cc2653505e01eab72c7dd7ca084bb322ce9175c=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Gustafsson=20= =0ADate:=20Thu,=2017=20Nov=202022=2011:28:13=20= +0100=0ASubject:=20[PATCH=20v10=202/2]=20Experimental:=20meson:=20treat=20= regress=20tests=20as=20TAP=0A=0AMark=20regress=20tests=20as=20emitting=20= TAP=20protocol=20output=20in=20order=20to=20make=0Athe=20meson=20= testrunner=20able=20to=20parse=20them.=0A---=0A=20meson.build=20|=201=20= +=0A=201=20file=20changed,=201=20insertion(+)=0A=0Adiff=20--git=20= a/meson.build=20b/meson.build=0Aindex=20058382046e..557b3b6798=20100644=0A= ---=20a/meson.build=0A+++=20b/meson.build=0A@@=20-2968,6=20+2968,7=20@@=20= foreach=20test_dir=20:=20tests=0A=20=20=20=20=20=20=20= env.prepend('PATH',=20temp_install_bindir,=20test_dir['bd'])=0A=20=0A=20=20= =20=20=20=20=20test_kwargs=20=3D=20{=0A+=20=20=20=20=20=20=20=20= 'protocol':=20'tap',=0A=20=20=20=20=20=20=20=20=20'suite':=20= [test_dir['name']],=0A=20=20=20=20=20=20=20=20=20'priority':=2010,=0A=20=20= =20=20=20=20=20=20=20'timeout':=201000,=0A--=20=0A2.32.1=20(Apple=20= Git-133)=0A=0A= --Apple-Mail=_AA42F73D-E7F8-4657-8745-84EA12EF9272 Content-Disposition: attachment; filename=v10-0001-Make-pg_regress-output-format-TAP-compliant.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="v10-0001-Make-pg_regress-output-format-TAP-compliant.patch" Content-Transfer-Encoding: quoted-printable =46rom=20d4e8a0bd5860be3ae3c8a288ca2a8ec895486017=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Daniel=20Gustafsson=20= =0ADate:=20Wed,=2016=20Nov=202022=2015:13:35=20= +0100=0ASubject:=20[PATCH=20v10=201/2]=20=20Make=20pg_regress=20output=20= format=20TAP=20compliant=0A=0AThis=20converts=20pg_regress=20output=20= format=20to=20emit=20TAP=20complient=20output=0Awhile=20keeping=20it=20= as=20human=20readable=20as=20possible=20for=20use=20without=20TAP=0Atest=20= harnesses.=20As=20verbose=20harness=20related=20information=20isn't=20= really=0Asupported=20by=20TAP=20this=20also=20reduces=20the=20verbosity=20= of=20pg_regress=20runs=0Awhich=20makes=20scrolling=20through=20log=20= output=20in=20buildfarm/CI=20runs=20a=20bit=0Aeasier=20as=20well.=0A=0A= As=20all=20output=20from=20pg_regress=20had=20to=20be=20addressed,=20=20= the=20frontend=20log=0Aframework=20was=20also=20brought=20to=20use=20as=20= it=20was=20already=20being=20set=20up=20but=0Anot=20used.=0A=0A= Discussion:=20= https://postgr.es/m/BD4B107D-7E53-4794-ACBA-275BEB4327C9@yesql.se=0A---=0A= =20src/test/regress/pg_regress.c=20|=20561=20= +++++++++++++++++++---------------=0A=201=20file=20changed,=20309=20= insertions(+),=20252=20deletions(-)=0A=0Adiff=20--git=20= a/src/test/regress/pg_regress.c=20b/src/test/regress/pg_regress.c=0A= index=20dda076847a..3ba123a0b4=20100644=0A---=20= a/src/test/regress/pg_regress.c=0A+++=20b/src/test/regress/pg_regress.c=0A= @@=20-68,6=20+68,26=20@@=20const=20char=20*basic_diff_opts=20=3D=20"-w";=0A= =20const=20char=20*pretty_diff_opts=20=3D=20"-w=20-U3";=0A=20#endif=0A=20= =0A+/*=20For=20parallel=20tests,=20testnames=20are=20indented=20when=20= printed=20for=20grouping=20*/=0A+#define=20PARALLEL_INDENT=20"=20=20=20=20= =20=20=20"=0A+/*=0A+=20*=20The=20width=20of=20the=20testname=20field=20= when=20printing=20to=20ensure=20vertical=20alignment=0A+=20*=20of=20test=20= runtimes.=20Thius=20number=20is=20somewhat=20arbitrarily=20chosen=20to=20= match=20the=0A+=20*=20older=20pre-TAP=20output=20format.=0A+=20*/=0A= +#define=20TESTNAME_WIDTH=2036=0A+=0A+typedef=20enum=20TAPtype=0A+{=0A+=09= DIAG=20=3D=200,=0A+=09BAIL,=0A+=09NOTE,=0A+=09DETAIL,=0A+=09TEST_STATUS,=0A= +=09PLAN,=0A+=09NONE=0A+}=20TAPtype;=0A+=0A=20/*=20options=20settable=20= from=20command=20line=20*/=0A=20_stringlist=20*dblist=20=3D=20NULL;=0A=20= bool=09=09debug=20=3D=20false;=0A@@=20-116,8=20+136,13=20@@=20static=20= int=09fail_ignore_count=20=3D=200;=0A=20static=20bool=20= directory_exists(const=20char=20*dir);=0A=20static=20void=20= make_directory(const=20char=20*dir);=0A=20=0A-static=20void=20= header(const=20char=20*fmt,...)=20pg_attribute_printf(1,=202);=0A-static=20= void=20status(const=20char=20*fmt,...)=20pg_attribute_printf(1,=202);=0A= +static=20void=20test_status_print(bool=20ok,=20const=20char=20= *testname,=20double=20runtime,=20bool=20parallel,=20bool=20ignore);=0A= +static=20void=20test_status_ok(const=20char=20*testname,=20double=20= runtime,=20bool=20parallel);=0A+static=20void=20test_status_failed(const=20= char=20*testname,=20bool=20ignore,=20char=20*tags,=20double=20runtime,=20= bool=20parallel);=0A+static=20void=20bail_out(bool=20non_rec,=20const=20= char=20*fmt,...)=20pg_attribute_printf(2,=203);=0A+static=20void=20= emit_tap_output(TAPtype=20type,=20const=20char=20*fmt,...);=0A+static=20= void=20emit_tap_output_v(TAPtype=20type,=20const=20char=20*fmt,=20= va_list=20argp);=0A+=0A=20static=20StringInfo=20= psql_start_command(void);=0A=20static=20void=20= psql_add_command(StringInfo=20buf,=20const=20char=20*query,...)=20= pg_attribute_printf(2,=203);=0A=20static=20void=20= psql_end_command(StringInfo=20buf,=20const=20char=20*database);=0A@@=20= -134,9=20+159,7=20@@=20unlimit_core_size(void)=0A=20=09= getrlimit(RLIMIT_CORE,=20&lim);=0A=20=09if=20(lim.rlim_max=20=3D=3D=200)=0A= =20=09{=0A-=09=09fprintf(stderr,=0A-=09=09=09=09_("%s:=20could=20not=20= set=20core=20size:=20disallowed=20by=20hard=20limit\n"),=0A-=09=09=09=09= progname);=0A+=09=09pg_log_error(_("could=20not=20set=20core=20size:=20= disallowed=20by=20hard=20limit"));=0A=20=09=09return;=0A=20=09}=0A=20=09= else=20if=20(lim.rlim_max=20=3D=3D=20RLIM_INFINITY=20||=20lim.rlim_cur=20= <=20lim.rlim_max)=0A@@=20-202,55=20+225,160=20@@=20= split_to_stringlist(const=20char=20*s,=20const=20char=20*delim,=20= _stringlist=20**listhead)=0A=20}=0A=20=0A=20/*=0A-=20*=20Print=20a=20= progress=20banner=20on=20stdout.=0A+=20*=20Bailing=20out=20is=20for=20= unrecoverable=20errors=20which=20prevents=20further=20testing=20to=0A+=20= *=20occur=20and=20after=20which=20the=20test=20run=20should=20be=20= aborted.=20By=20passing=20non_rec=0A+=20*=20as=20true=20the=20process=20= will=20exit=20with=20_exit(2)=20and=20skipping=20registered=20exit=0A+=20= *=20handlers.=0A=20=20*/=0A=20static=20void=0A-header(const=20char=20= *fmt,...)=0A+bail_out(bool=20non_rec,=20const=20char=20*fmt,...)=0A=20{=0A= -=09char=09=09tmp[64];=0A=20=09va_list=09=09ap;=0A=20=0A=20=09= va_start(ap,=20fmt);=0A-=09vsnprintf(tmp,=20sizeof(tmp),=20fmt,=20ap);=0A= +=09emit_tap_output_v(BAIL,=20fmt,=20ap);=0A=20=09va_end(ap);=0A=20=0A-=09= fprintf(stdout,=20"=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20%-38s=20= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D\n",=20tmp);=0A-=09= fflush(stdout);=0A+=09if=20(non_rec)=0A+=09=09_exit(2);=0A+=0A+=09= exit(2);=0A=20}=0A=20=0A-/*=0A-=20*=20Print=20"doing=20something=20..."=20= ---=20supplied=20text=20should=20not=20end=20with=20newline=0A-=20*/=0A= +#define=20_bail(...)=09bail_out(true,=20__VA_ARGS__)=0A+#define=20= bail(...)=09bail_out(false,=20__VA_ARGS__)=0A+=0A=20static=20void=0A= -status(const=20char=20*fmt,...)=0A+test_status_print(bool=20ok,=20const=20= char=20*testname,=20double=20runtime,=20bool=20parallel,=20bool=20= ignore)=0A=20{=0A-=09va_list=09=09ap;=0A+=09int=09=09testnumber;=0A+=09= int=09=09padding;=0A=20=0A-=09va_start(ap,=20fmt);=0A-=09= vfprintf(stdout,=20fmt,=20ap);=0A-=09fflush(stdout);=0A-=09va_end(ap);=0A= +=09testnumber=20=3D=20fail_count=20+=20fail_ignore_count=20+=20= success_count;=0A+=09padding=20=3D=20TESTNAME_WIDTH;=0A=20=0A-=09if=20= (logfile)=0A+=09/*=0A+=09=20*=20Calculate=20the=20width=20for=20the=20= testname=20field=20required=20to=20align=20runtimes=0A+=09=20*=20= vertically.=0A+=09=20*/=0A+=09if=20(parallel)=0A+=09=09padding=20-=3D=20= strlen(PARALLEL_INDENT);=0A+=0A+=09/*=0A+=09=20*=20There=20is=20no=20NLS=20= translation=20here=20as=20"(not)=20ok"=20and=20"SKIP"=20are=20protocol.=0A= +=09=20*=20Testnumbers=20are=20padded=20to=205=20characters=20to=20= ensure=20that=20testnames=20align=0A+=09=20*=20vertically=20(assuming=20= at=20most=209999=20tests).=20=20Testnames=20are=20indented=208=0A+=09=20= *=20spaces=20in=20case=20they=20run=20as=20part=20of=20a=20parallel=20= group.=20The=20position=20for=0A+=09=20*=20the=20runtime=20is=20offset=20= based=20on=20that=20indentation.=0A+=09=20*/=0A+=09if=20(ok=20||=20= ignore)=0A+=09{=0A+=09=09emit_tap_output(TEST_STATUS,=20"ok=20%-5i=20=20=20= =20=20%s%-*s=20%8.0f=20ms%s\n",=0A+=09=09=09=09=09=09testnumber,=0A+=09=09= =09=09=09=09(parallel=20?=20PARALLEL_INDENT=20:=20""),=0A+=09=09=09=09=09= =09padding,=20testname,=0A+=09=09=09=09=09=09runtime,=0A+=09=09=09=09=09=09= (ignore=20?=20"=20#=20SKIP=20(ignored)":=20""));=0A+=09}=0A+=09else=0A=20= =09{=0A-=09=09va_start(ap,=20fmt);=0A-=09=09vfprintf(logfile,=20fmt,=20= ap);=0A-=09=09va_end(ap);=0A+=09=09emit_tap_output(TEST_STATUS,=20"not=20= ok=20%-5i=20%s%-*s=20%8.0f=20ms\n",=0A+=09=09=09=09=09=09testnumber,=0A+=09= =09=09=09=09=09(parallel=20?=20PARALLEL_INDENT=20:=20""),=0A+=09=09=09=09= =09=09padding,=20testname,=0A+=09=09=09=09=09=09runtime);=0A=20=09}=0A=20= }=0A=20=0A-/*=0A-=20*=20Done=20"doing=20something=20..."=0A-=20*/=0A=20= static=20void=0A-status_end(void)=0A+test_status_ok(const=20char=20= *testname,=20double=20runtime,=20bool=20parallel)=0A=20{=0A-=09= fprintf(stdout,=20"\n");=0A-=09fflush(stdout);=0A+=09success_count++;=0A= +=0A+=09test_status_print(true,=20testname,=20runtime,=20parallel,=20= false);=0A+}=0A+=0A+static=20void=0A+test_status_failed(const=20char=20= *testname,=20bool=20ignore,=20char=20*tags,=20double=20runtime,=20bool=20= parallel)=0A+{=0A+=09if=20(ignore)=0A+=09=09fail_ignore_count++;=0A+=09= else=0A+=09=09fail_count++;=0A+=0A+=09test_status_print(false,=20= testname,=20runtime,=20parallel,=20ignore);=0A+=0A+=09if=20(tags=20&&=20= strlen(tags)=20>=200)=0A+=09=09emit_tap_output(NOTE,=20"tags:=20%s",=20= tags);=0A+}=0A+=0A+=0A+static=20void=0A+emit_tap_output(TAPtype=20type,=20= const=20char=20*fmt,...)=0A+{=0A+=09va_list=09=09argp;=0A+=0A+=09= va_start(argp,=20fmt);=0A+=09emit_tap_output_v(type,=20fmt,=20argp);=0A+=09= va_end(argp);=0A+}=0A+=0A+static=20void=0A+emit_tap_output_v(TAPtype=20= type,=20const=20char=20*fmt,=20va_list=20argp)=0A+{=0A+=09va_list=09=09= argp_logfile;=0A+=09FILE=09=20=20=20*fp=20=3D=20stdout;=0A+=0A+=09/*=20= We=20only=20need=20to=20copy=20the=20arg=20array=20in=20case=20we=20= actually=20need=20it=20*/=0A=20=09if=20(logfile)=0A-=09=09= fprintf(logfile,=20"\n");=0A+=09=09va_copy(argp_logfile,=20argp);=0A+=0A= +=09/*=0A+=09=20*=20Diagnostic=20output=20will=20be=20hidden=20by=20= prove=20unless=20printed=20to=20stderr.=0A+=09=20*=20The=20Bail=20= message=20is=20also=20printed=20to=20stderr=20to=20aid=20debugging=20= under=20a=0A+=09=20*=20harness=20which=20might=20otherwise=20not=20emit=20= such=20an=20important=20message.=0A+=09=20*/=0A+=09if=20(type=20=3D=3D=20= DIAG=20||=20type=20=3D=3D=20BAIL)=0A+=09=09fp=20=3D=20stderr;=0A+=0A+=09= /*=0A+=09=20*=20Non-protocol=20output=20such=20as=20diagnostics=20or=20= notes=20must=20be=20prefixed=20by=0A+=09=20*=20a=20'#'=20character.=20We=20= print=20the=20Bail=20message=20like=20this=20too.=0A+=09=20*/=0A+=09if=20= (type=20=3D=3D=20NOTE=20||=20type=20=3D=3D=20DIAG=20||=20type=20=3D=3D=20= BAIL)=0A+=09{=0A+=09=09fprintf(fp,=20"#=20");=0A+=09=09if=20(logfile)=0A= +=09=09=09fprintf(logfile,=20"#=20");=0A+=09}=0A+=09vfprintf(fp,=20fmt,=20= argp);=0A+=09if=20(logfile)=0A+=09=09vfprintf(logfile,=20fmt,=20= argp_logfile);=0A+=0A+=09/*=0A+=09=20*=20If=20this=20was=20a=20Bail=20= message,=20the=20bail=20protocol=20message=20must=20go=20to=0A+=09=20*=20= stdout=20separately.=0A+=09=20*/=0A+=09if=20(type=20=3D=3D=20BAIL)=0A+=09= {=0A+=09=09fprintf(stdout,=20"Bail=20Out!");=0A+=09=09if=20(logfile)=0A+=09= =09=09fprintf(logfile,=20"Bail=20Out!");=0A+=09}=0A+=0A+=09fflush(NULL);=0A= =20}=0A=20=0A+/*=0A+=20*=20Convenience=20macros=20for=20printing=20TAP=20= output=20with=20a=20more=20shorthand=20syntax=0A+=20*=20aimed=20at=20= making=20the=20code=20more=20readable.=0A+=20*/=0A+#define=20plan(x)=09=09= =09=09emit_tap_output(PLAN,=20"1..%i\n",=20(x))=0A+#define=20note(...)=09= =09=09emit_tap_output(NOTE,=20__VA_ARGS__)=0A+#define=20note_detail(...)=09= emit_tap_output(DETAIL,=20__VA_ARGS__)=0A+#define=20diag(...)=09=09=09= emit_tap_output(DIAG,=20__VA_ARGS__)=0A+#define=20note_end()=09=09=09= emit_tap_output(NONE,=20"\n");=0A+=0A=20/*=0A=20=20*=20shut=20down=20= temp=20postmaster=0A=20=20*/=0A@@=20-272,9=20+400,8=20@@=20= stop_postmaster(void)=0A=20=09=09r=20=3D=20system(buf);=0A=20=09=09if=20= (r=20!=3D=200)=0A=20=09=09{=0A-=09=09=09fprintf(stderr,=20_("\n%s:=20= could=20not=20stop=20postmaster:=20exit=20code=20was=20%d\n"),=0A-=09=09=09= =09=09progname,=20r);=0A-=09=09=09_exit(2);=09=09=09/*=20not=20exit(),=20= that=20could=20be=20recursive=20*/=0A+=09=09=09/*=20Not=20using=20the=20= normal=20bail()=20as=20we=20want=20_exit=20*/=0A+=09=09=09_bail(_("could=20= not=20stop=20postmaster:=20exit=20code=20was=20%d\n"),=20r);=0A=20=09=09= }=0A=20=0A=20=09=09postmaster_running=20=3D=20false;=0A@@=20-332,9=20= +459,8=20@@=20make_temp_sockdir(void)=0A=20=09temp_sockdir=20=3D=20= mkdtemp(template);=0A=20=09if=20(temp_sockdir=20=3D=3D=20NULL)=0A=20=09{=0A= -=09=09fprintf(stderr,=20_("%s:=20could=20not=20create=20directory=20= \"%s\":=20%s\n"),=0A-=09=09=09=09progname,=20template,=20= strerror(errno));=0A-=09=09exit(2);=0A+=09=09bail(_("could=20not=20= create=20directory=20\"%s\":=20%s\n"),=0A+=09=09=09=20template,=20= strerror(errno));=0A=20=09}=0A=20=0A=20=09/*=20Stage=20file=20names=20= for=20remove_temp().=20=20Unsafe=20in=20a=20signal=20handler.=20*/=0A@@=20= -456,9=20+582,8=20@@=20load_resultmap(void)=0A=20=09=09/*=20OK=20if=20it=20= doesn't=20exist,=20else=20complain=20*/=0A=20=09=09if=20(errno=20=3D=3D=20= ENOENT)=0A=20=09=09=09return;=0A-=09=09fprintf(stderr,=20_("%s:=20could=20= not=20open=20file=20\"%s\"=20for=20reading:=20%s\n"),=0A-=09=09=09=09= progname,=20buf,=20strerror(errno));=0A-=09=09exit(2);=0A+=09=09= bail(_("could=20not=20open=20file=20\"%s\"=20for=20reading:=20%s\n"),=0A= +=09=09=09=20buf,=20strerror(errno));=0A=20=09}=0A=20=0A=20=09while=20= (fgets(buf,=20sizeof(buf),=20f))=0A@@=20-477,26=20+602,20=20@@=20= load_resultmap(void)=0A=20=09=09file_type=20=3D=20strchr(buf,=20':');=0A=20= =09=09if=20(!file_type)=0A=20=09=09{=0A-=09=09=09fprintf(stderr,=20= _("incorrectly=20formatted=20resultmap=20entry:=20%s\n"),=0A-=09=09=09=09= =09buf);=0A-=09=09=09exit(2);=0A+=09=09=09bail(_("incorrectly=20= formatted=20resultmap=20entry:=20%s\n"),=20buf);=0A=20=09=09}=0A=20=09=09= *file_type++=20=3D=20'\0';=0A=20=0A=20=09=09platform=20=3D=20= strchr(file_type,=20':');=0A=20=09=09if=20(!platform)=0A=20=09=09{=0A-=09= =09=09fprintf(stderr,=20_("incorrectly=20formatted=20resultmap=20entry:=20= %s\n"),=0A-=09=09=09=09=09buf);=0A-=09=09=09exit(2);=0A+=09=09=09= bail(_("incorrectly=20formatted=20resultmap=20entry:=20%s\n"),=20buf);=0A= =20=09=09}=0A=20=09=09*platform++=20=3D=20'\0';=0A=20=09=09expected=20=3D=20= strchr(platform,=20'=3D');=0A=20=09=09if=20(!expected)=0A=20=09=09{=0A-=09= =09=09fprintf(stderr,=20_("incorrectly=20formatted=20resultmap=20entry:=20= %s\n"),=0A-=09=09=09=09=09buf);=0A-=09=09=09exit(2);=0A+=09=09=09= bail(_("incorrectly=20formatted=20resultmap=20entry:=20%s\n"),=20buf);=0A= =20=09=09}=0A=20=09=09*expected++=20=3D=20'\0';=0A=20=0A@@=20-742,13=20= +861,13=20@@=20initialize_environment(void)=0A=20=09=09}=0A=20=0A=20=09=09= if=20(pghost=20&&=20pgport)=0A-=09=09=09printf(_("(using=20postmaster=20= on=20%s,=20port=20%s)\n"),=20pghost,=20pgport);=0A+=09=09=09= note(_("(using=20postmaster=20on=20%s,=20port=20%s)\n"),=20pghost,=20= pgport);=0A=20=09=09if=20(pghost=20&&=20!pgport)=0A-=09=09=09= printf(_("(using=20postmaster=20on=20%s,=20default=20port)\n"),=20= pghost);=0A+=09=09=09note(_("(using=20postmaster=20on=20%s,=20default=20= port)\n"),=20pghost);=0A=20=09=09if=20(!pghost=20&&=20pgport)=0A-=09=09=09= printf(_("(using=20postmaster=20on=20Unix=20socket,=20port=20%s)\n"),=20= pgport);=0A+=09=09=09note(_("(using=20postmaster=20on=20Unix=20socket,=20= port=20%s)\n"),=20pgport);=0A=20=09=09if=20(!pghost=20&&=20!pgport)=0A-=09= =09=09printf(_("(using=20postmaster=20on=20Unix=20socket,=20default=20= port)\n"));=0A+=09=09=09note(_("(using=20postmaster=20on=20Unix=20= socket,=20default=20port)\n"));=0A=20=09}=0A=20=0A=20=09= load_resultmap();=0A@@=20-797,34=20+916,30=20@@=20= current_windows_user(const=20char=20**acct,=20const=20char=20**dom)=0A=20= =0A=20=09if=20(!OpenProcessToken(GetCurrentProcess(),=20TOKEN_READ,=20= &token))=0A=20=09{=0A-=09=09fprintf(stderr,=0A-=09=09=09=09_("%s:=20= could=20not=20open=20process=20token:=20error=20code=20%lu\n"),=0A-=09=09= =09=09progname,=20GetLastError());=0A+=09=09pg_log_error("could=20not=20= open=20process=20token:=20error=20code=20%lu",=0A+=09=09=09=09=09=20= GetLastError());=0A=20=09=09exit(2);=0A=20=09}=0A=20=0A=20=09if=20= (!GetTokenInformation(token,=20TokenUser,=20NULL,=200,=20&retlen)=20&&=20= GetLastError()=20!=3D=20122)=0A=20=09{=0A-=09=09fprintf(stderr,=0A-=09=09= =09=09_("%s:=20could=20not=20get=20token=20information=20buffer=20size:=20= error=20code=20%lu\n"),=0A-=09=09=09=09progname,=20GetLastError());=0A+=09= =09pg_log_error("could=20not=20get=20token=20information=20buffer=20= size:=20error=20code=20%lu",=0A+=09=09=09=09=09=20GetLastError());=0A=20=09= =09exit(2);=0A=20=09}=0A=20=09tokenuser=20=3D=20pg_malloc(retlen);=0A=20=09= if=20(!GetTokenInformation(token,=20TokenUser,=20tokenuser,=20retlen,=20= &retlen))=0A=20=09{=0A-=09=09fprintf(stderr,=0A-=09=09=09=09_("%s:=20= could=20not=20get=20token=20information:=20error=20code=20%lu\n"),=0A-=09= =09=09=09progname,=20GetLastError());=0A+=09=09pg_log_error("could=20not=20= get=20token=20information:=20error=20code=20%lu",=0A+=09=09=09=09=09=20= GetLastError());=0A=20=09=09exit(2);=0A=20=09}=0A=20=0A=20=09if=20= (!LookupAccountSid(NULL,=20tokenuser->User.Sid,=20accountname,=20= &accountnamesize,=0A=20=09=09=09=09=09=09=20=20domainname,=20= &domainnamesize,=20&accountnameuse))=0A=20=09{=0A-=09=09fprintf(stderr,=0A= -=09=09=09=09_("%s:=20could=20not=20look=20up=20account=20SID:=20error=20= code=20%lu\n"),=0A-=09=09=09=09progname,=20GetLastError());=0A+=09=09= pg_log_error("could=20not=20look=20up=20account=20SID:=20error=20code=20= %lu",=0A+=09=09=09=09=09=20GetLastError());=0A=20=09=09exit(2);=0A=20=09= }=0A=20=0A@@=20-974,7=20+1089,7=20@@=20psql_start_command(void)=0A=20=09= StringInfo=09buf=20=3D=20makeStringInfo();=0A=20=0A=20=09= appendStringInfo(buf,=0A-=09=09=09=09=09=20"\"%s%spsql\"=20-X",=0A+=09=09= =09=09=09=20"\"%s%spsql\"=20-X=20-q",=0A=20=09=09=09=09=09=20bindir=20?=20= bindir=20:=20"",=0A=20=09=09=09=09=09=20bindir=20?=20"/"=20:=20"");=0A=20= =09return=20buf;=0A@@=20-1030,8=20+1145,7=20@@=20= psql_end_command(StringInfo=20buf,=20const=20char=20*database)=0A=20=09= if=20(system(buf->data)=20!=3D=200)=0A=20=09{=0A=20=09=09/*=20psql=20= probably=20already=20reported=20the=20error=20*/=0A-=09=09= fprintf(stderr,=20_("command=20failed:=20%s\n"),=20buf->data);=0A-=09=09= exit(2);=0A+=09=09bail(_("command=20failed:=20%s\n"),=20buf->data);=0A=20= =09}=0A=20=0A=20=09/*=20Clean=20up=20*/=0A@@=20-1072,9=20+1186,7=20@@=20= spawn_process(const=20char=20*cmdline)=0A=20=09pid=20=3D=20fork();=0A=20=09= if=20(pid=20=3D=3D=20-1)=0A=20=09{=0A-=09=09fprintf(stderr,=20_("%s:=20= could=20not=20fork:=20%s\n"),=0A-=09=09=09=09progname,=20= strerror(errno));=0A-=09=09exit(2);=0A+=09=09bail(_("could=20not=20fork:=20= %s\n"),=20strerror(errno));=0A=20=09}=0A=20=09if=20(pid=20=3D=3D=200)=0A=20= =09{=0A@@=20-1089,9=20+1201,8=20@@=20spawn_process(const=20char=20= *cmdline)=0A=20=0A=20=09=09cmdline2=20=3D=20psprintf("exec=20%s",=20= cmdline);=0A=20=09=09execl(shellprog,=20shellprog,=20"-c",=20cmdline2,=20= (char=20*)=20NULL);=0A-=09=09fprintf(stderr,=20_("%s:=20could=20not=20= exec=20\"%s\":=20%s\n"),=0A-=09=09=09=09progname,=20shellprog,=20= strerror(errno));=0A-=09=09_exit(1);=09=09=09=09/*=20not=20exit()=20= here...=20*/=0A+=09=09/*=20Not=20using=20the=20normal=20bail()=20here=20= as=20we=20want=20_exit=20*/=0A+=09=09_bail(_("could=20not=20exec=20= \"%s\":=20%s\n"),=20shellprog,=20strerror(errno));=0A=20=09}=0A=20=09/*=20= in=20parent=20*/=0A=20=09return=20pid;=0A@@=20-1129,8=20+1240,8=20@@=20= file_size(const=20char=20*file)=0A=20=0A=20=09if=20(!f)=0A=20=09{=0A-=09=09= fprintf(stderr,=20_("%s:=20could=20not=20open=20file=20\"%s\"=20for=20= reading:=20%s\n"),=0A-=09=09=09=09progname,=20file,=20strerror(errno));=0A= +=09=09pg_log_error(_("#=20could=20not=20open=20file=20\"%s\"=20for=20= reading:=20%s"),=0A+=09=09=09=09=09=20file,=20strerror(errno));=0A=20=09=09= return=20-1;=0A=20=09}=0A=20=09fseek(f,=200,=20SEEK_END);=0A@@=20-1151,8=20= +1262,8=20@@=20file_line_count(const=20char=20*file)=0A=20=0A=20=09if=20= (!f)=0A=20=09{=0A-=09=09fprintf(stderr,=20_("%s:=20could=20not=20open=20= file=20\"%s\"=20for=20reading:=20%s\n"),=0A-=09=09=09=09progname,=20= file,=20strerror(errno));=0A+=09=09pg_log_error(_("#=20could=20not=20= open=20file=20\"%s\"=20for=20reading:=20%s"),=0A+=09=09=09=09file,=20= strerror(errno));=0A=20=09=09return=20-1;=0A=20=09}=0A=20=09while=20((c=20= =3D=20fgetc(f))=20!=3D=20EOF)=0A@@=20-1193,9=20+1304,8=20@@=20= make_directory(const=20char=20*dir)=0A=20{=0A=20=09if=20(mkdir(dir,=20= S_IRWXU=20|=20S_IRWXG=20|=20S_IRWXO)=20<=200)=0A=20=09{=0A-=09=09= fprintf(stderr,=20_("%s:=20could=20not=20create=20directory=20\"%s\":=20= %s\n"),=0A-=09=09=09=09progname,=20dir,=20strerror(errno));=0A-=09=09= exit(2);=0A+=09=09bail(_("could=20not=20create=20directory=20\"%s\":=20= %s\n"),=0A+=09=09=09=20dir,=20strerror(errno));=0A=20=09}=0A=20}=0A=20=0A= @@=20-1245,8=20+1355,7=20@@=20run_diff(const=20char=20*cmd,=20const=20= char=20*filename)=0A=20=09r=20=3D=20system(cmd);=0A=20=09if=20= (!WIFEXITED(r)=20||=20WEXITSTATUS(r)=20>=201)=0A=20=09{=0A-=09=09= fprintf(stderr,=20_("diff=20command=20failed=20with=20status=20%d:=20= %s\n"),=20r,=20cmd);=0A-=09=09exit(2);=0A+=09=09bail(_("diff=20command=20= failed=20with=20status=20%d:=20%s\n"),=20r,=20cmd);=0A=20=09}=0A=20= #ifdef=20WIN32=0A=20=0A@@=20-1256,8=20+1365,7=20@@=20run_diff(const=20= char=20*cmd,=20const=20char=20*filename)=0A=20=09=20*/=0A=20=09if=20= (WEXITSTATUS(r)=20=3D=3D=201=20&&=20file_size(filename)=20<=3D=200)=0A=20= =09{=0A-=09=09fprintf(stderr,=20_("diff=20command=20not=20found:=20= %s\n"),=20cmd);=0A-=09=09exit(2);=0A+=09=09bail(_("diff=20command=20not=20= found:=20%s\n"),=20cmd);=0A=20=09}=0A=20#endif=0A=20=0A@@=20-1328,9=20= +1436,8=20@@=20results_differ(const=20char=20*testname,=20const=20char=20= *resultsfile,=20const=20char=20*defaul=0A=20=09=09alt_expectfile=20=3D=20= get_alternative_expectfile(expectfile,=20i);=0A=20=09=09if=20= (!alt_expectfile)=0A=20=09=09{=0A-=09=09=09fprintf(stderr,=20_("Unable=20= to=20check=20secondary=20comparison=20files:=20%s\n"),=0A-=09=09=09=09=09= strerror(errno));=0A-=09=09=09exit(2);=0A+=09=09=09bail(_("Unable=20to=20= check=20secondary=20comparison=20files:=20%s\n"),=0A+=09=09=09=09=20= strerror(errno));=0A=20=09=09}=0A=20=0A=20=09=09if=20= (!file_exists(alt_expectfile))=0A@@=20-1445,9=20+1552,8=20@@=20= wait_for_tests(PID_TYPE=20*=20pids,=20int=20*statuses,=20instr_time=20= *stoptimes,=0A=20=0A=20=09=09if=20(p=20=3D=3D=20INVALID_PID)=0A=20=09=09= {=0A-=09=09=09fprintf(stderr,=20_("failed=20to=20wait=20for=20= subprocesses:=20%s\n"),=0A-=09=09=09=09=09strerror(errno));=0A-=09=09=09= exit(2);=0A+=09=09=09bail(_("failed=20to=20wait=20for=20subprocesses:=20= %s\n"),=0A+=09=09=09=09=20strerror(errno));=0A=20=09=09}=0A=20#else=0A=20= =09=09DWORD=09=09exit_status;=0A@@=20-1456,9=20+1562,8=20@@=20= wait_for_tests(PID_TYPE=20*=20pids,=20int=20*statuses,=20instr_time=20= *stoptimes,=0A=20=09=09r=20=3D=20WaitForMultipleObjects(tests_left,=20= active_pids,=20FALSE,=20INFINITE);=0A=20=09=09if=20(r=20<=20= WAIT_OBJECT_0=20||=20r=20>=3D=20WAIT_OBJECT_0=20+=20tests_left)=0A=20=09=09= {=0A-=09=09=09fprintf(stderr,=20_("failed=20to=20wait=20for=20= subprocesses:=20error=20code=20%lu\n"),=0A-=09=09=09=09=09= GetLastError());=0A-=09=09=09exit(2);=0A+=09=09=09bail(_("failed=20to=20= wait=20for=20subprocesses:=20error=20code=20%lu\n"),=0A+=09=09=09=09=20= GetLastError());=0A=20=09=09}=0A=20=09=09p=20=3D=20active_pids[r=20-=20= WAIT_OBJECT_0];=0A=20=09=09/*=20compact=20the=20active_pids=20array=20*/=0A= @@=20-1477,7=20+1582,7=20@@=20wait_for_tests(PID_TYPE=20*=20pids,=20int=20= *statuses,=20instr_time=20*stoptimes,=0A=20=09=09=09=09statuses[i]=20=3D=20= (int)=20exit_status;=0A=20=09=09=09=09= INSTR_TIME_SET_CURRENT(stoptimes[i]);=0A=20=09=09=09=09if=20(names)=0A-=09= =09=09=09=09status("=20%s",=20names[i]);=0A+=09=09=09=09=09note_detail("=20= %s",=20names[i]);=0A=20=09=09=09=09tests_left--;=0A=20=09=09=09=09break;=0A= =20=09=09=09}=0A@@=20-1496,21=20+1601,21=20@@=20static=20void=0A=20= log_child_failure(int=20exitstatus)=0A=20{=0A=20=09if=20= (WIFEXITED(exitstatus))=0A-=09=09status(_("=20(test=20process=20exited=20= with=20exit=20code=20%d)"),=0A-=09=09=09=20=20=20= WEXITSTATUS(exitstatus));=0A+=09=09diag(_("(test=20process=20exited=20= with=20exit=20code=20%d)"),=0A+=09=09=09=20=20WEXITSTATUS(exitstatus));=0A= =20=09else=20if=20(WIFSIGNALED(exitstatus))=0A=20=09{=0A=20#if=20= defined(WIN32)=0A-=09=09status(_("=20(test=20process=20was=20terminated=20= by=20exception=200x%X)"),=0A-=09=09=09=20=20=20WTERMSIG(exitstatus));=0A= +=09=09diag(_("(test=20process=20was=20terminated=20by=20exception=20= 0x%X)"),=0A+=09=09=09=20=20WTERMSIG(exitstatus));=0A=20#else=0A-=09=09= status(_("=20(test=20process=20was=20terminated=20by=20signal=20%d:=20= %s)"),=0A-=09=09=09=20=20=20WTERMSIG(exitstatus),=20= pg_strsignal(WTERMSIG(exitstatus)));=0A+=09=09diag(_("(test=20process=20= was=20terminated=20by=20signal=20%d:=20%s)"),=0A+=09=09=09=20=20= WTERMSIG(exitstatus),=20pg_strsignal(WTERMSIG(exitstatus)));=0A=20#endif=0A= =20=09}=0A=20=09else=0A-=09=09status(_("=20(test=20process=20exited=20= with=20unrecognized=20status=20%d)"),=0A-=09=09=09=20=20=20exitstatus);=0A= +=09=09diag(_("(test=20process=20exited=20with=20unrecognized=20status=20= %d)"),=0A+=09=09=09=20=20exitstatus);=0A=20}=0A=20=0A=20/*=0A@@=20= -1533,18=20+1638,20=20@@=20run_schedule(const=20char=20*schedule,=20= test_start_function=20startfunc,=0A=20=09char=09=09scbuf[1024];=0A=20=09= FILE=09=20=20=20*scf;=0A=20=09int=09=09=09line_num=20=3D=200;=0A+=09= StringInfoData=20tagbuf;=0A=20=0A=20=09memset(tests,=200,=20= sizeof(tests));=0A=20=09memset(resultfiles,=200,=20sizeof(resultfiles));=0A= =20=09memset(expectfiles,=200,=20sizeof(expectfiles));=0A=20=09= memset(tags,=200,=20sizeof(tags));=0A=20=0A+=09initStringInfo(&tagbuf);=0A= +=0A=20=09scf=20=3D=20fopen(schedule,=20"r");=0A=20=09if=20(!scf)=0A=20=09= {=0A-=09=09fprintf(stderr,=20_("%s:=20could=20not=20open=20file=20\"%s\"=20= for=20reading:=20%s\n"),=0A-=09=09=09=09progname,=20schedule,=20= strerror(errno));=0A-=09=09exit(2);=0A+=09=09bail(_("could=20not=20open=20= file=20\"%s\"=20for=20reading:=20%s\n"),=0A+=09=09=09=20schedule,=20= strerror(errno));=0A=20=09}=0A=20=0A=20=09while=20(fgets(scbuf,=20= sizeof(scbuf),=20scf))=0A@@=20-1582,9=20+1689,8=20@@=20= run_schedule(const=20char=20*schedule,=20test_start_function=20= startfunc,=0A=20=09=09}=0A=20=09=09else=0A=20=09=09{=0A-=09=09=09= fprintf(stderr,=20_("syntax=20error=20in=20schedule=20file=20\"%s\"=20= line=20%d:=20%s\n"),=0A-=09=09=09=09=09schedule,=20line_num,=20scbuf);=0A= -=09=09=09exit(2);=0A+=09=09=09bail(_("syntax=20error=20in=20schedule=20= file=20\"%s\"=20line=20%d:=20%s\n"),=0A+=09=09=09=09=20schedule,=20= line_num,=20scbuf);=0A=20=09=09}=0A=20=0A=20=09=09num_tests=20=3D=200;=0A= @@=20-1600,9=20+1706,8=20@@=20run_schedule(const=20char=20*schedule,=20= test_start_function=20startfunc,=0A=20=0A=20=09=09=09=09=09if=20= (num_tests=20>=3D=20MAX_PARALLEL_TESTS)=0A=20=09=09=09=09=09{=0A-=09=09=09= =09=09=09fprintf(stderr,=20_("too=20many=20parallel=20tests=20(more=20= than=20%d)=20in=20schedule=20file=20\"%s\"=20line=20%d:=20%s\n"),=0A-=09=09= =09=09=09=09=09=09MAX_PARALLEL_TESTS,=20schedule,=20line_num,=20scbuf);=0A= -=09=09=09=09=09=09exit(2);=0A+=09=09=09=09=09=09bail(_("too=20many=20= parallel=20tests=20(more=20than=20%d)=20in=20schedule=20file=20\"%s\"=20= line=20%d:=20%s\n"),=0A+=09=09=09=09=09=09=09=20MAX_PARALLEL_TESTS,=20= schedule,=20line_num,=20scbuf);=0A=20=09=09=09=09=09}=0A=20=09=09=09=09=09= sav=20=3D=20*c;=0A=20=09=09=09=09=09*c=20=3D=20'\0';=0A@@=20-1624,14=20= +1729,12=20@@=20run_schedule(const=20char=20*schedule,=20= test_start_function=20startfunc,=0A=20=0A=20=09=09if=20(num_tests=20=3D=3D= =200)=0A=20=09=09{=0A-=09=09=09fprintf(stderr,=20_("syntax=20error=20in=20= schedule=20file=20\"%s\"=20line=20%d:=20%s\n"),=0A-=09=09=09=09=09= schedule,=20line_num,=20scbuf);=0A-=09=09=09exit(2);=0A+=09=09=09= bail(_("syntax=20error=20in=20schedule=20file=20\"%s\"=20line=20%d:=20= %s\n"),=0A+=09=09=09=09=20schedule,=20line_num,=20scbuf);=0A=20=09=09}=0A= =20=0A=20=09=09if=20(num_tests=20=3D=3D=201)=0A=20=09=09{=0A-=09=09=09= status(_("test=20%-28s=20...=20"),=20tests[0]);=0A=20=09=09=09pids[0]=20= =3D=20(startfunc)=20(tests[0],=20&resultfiles[0],=20&expectfiles[0],=20= &tags[0]);=0A=20=09=09=09INSTR_TIME_SET_CURRENT(starttimes[0]);=0A=20=09=09= =09wait_for_tests(pids,=20statuses,=20stoptimes,=20NULL,=201);=0A@@=20= -1639,16=20+1742,15=20@@=20run_schedule(const=20char=20*schedule,=20= test_start_function=20startfunc,=0A=20=09=09}=0A=20=09=09else=20if=20= (max_concurrent_tests=20>=200=20&&=20max_concurrent_tests=20<=20= num_tests)=0A=20=09=09{=0A-=09=09=09fprintf(stderr,=20_("too=20many=20= parallel=20tests=20(more=20than=20%d)=20in=20schedule=20file=20\"%s\"=20= line=20%d:=20%s\n"),=0A-=09=09=09=09=09max_concurrent_tests,=20schedule,=20= line_num,=20scbuf);=0A-=09=09=09exit(2);=0A+=09=09=09bail(_("too=20many=20= parallel=20tests=20(more=20than=20%d)=20in=20schedule=20file=20\"%s\"=20= line=20%d:=20%s\n"),=0A+=09=09=09=09=20max_concurrent_tests,=20schedule,=20= line_num,=20scbuf);=0A=20=09=09}=0A=20=09=09else=20if=20(max_connections=20= >=200=20&&=20max_connections=20<=20num_tests)=0A=20=09=09{=0A=20=09=09=09= int=09=09=09oldest=20=3D=200;=0A=20=0A-=09=09=09status(_("parallel=20= group=20(%d=20tests,=20in=20groups=20of=20%d):=20"),=0A-=09=09=09=09=20=20= =20num_tests,=20max_connections);=0A+=09=09=09note(_("parallel=20group=20= (%d=20tests,=20in=20groups=20of=20%d):=20"),=0A+=09=09=09=09=09=20=20=20= num_tests,=20max_connections);=0A=20=09=09=09for=20(i=20=3D=200;=20i=20<=20= num_tests;=20i++)=0A=20=09=09=09{=0A=20=09=09=09=09if=20(i=20-=20oldest=20= >=3D=20max_connections)=0A@@=20-1664,18=20+1766,18=20@@=20= run_schedule(const=20char=20*schedule,=20test_start_function=20= startfunc,=0A=20=09=09=09wait_for_tests(pids=20+=20oldest,=20statuses=20= +=20oldest,=0A=20=09=09=09=09=09=09=20=20=20stoptimes=20+=20oldest,=0A=20= =09=09=09=09=09=09=20=20=20tests=20+=20oldest,=20i=20-=20oldest);=0A-=09=09= =09status_end();=0A+=09=09=09note_end();=0A=20=09=09}=0A=20=09=09else=0A=20= =09=09{=0A-=09=09=09status(_("parallel=20group=20(%d=20tests):=20"),=20= num_tests);=0A+=09=09=09note(_("parallel=20group=20(%d=20tests):=20"),=20= num_tests);=0A=20=09=09=09for=20(i=20=3D=200;=20i=20<=20num_tests;=20= i++)=0A=20=09=09=09{=0A=20=09=09=09=09pids[i]=20=3D=20(startfunc)=20= (tests[i],=20&resultfiles[i],=20&expectfiles[i],=20&tags[i]);=0A=20=09=09= =09=09INSTR_TIME_SET_CURRENT(starttimes[i]);=0A=20=09=09=09}=0A=20=09=09=09= wait_for_tests(pids,=20statuses,=20stoptimes,=20tests,=20num_tests);=0A-=09= =09=09status_end();=0A+=09=09=09note_end();=0A=20=09=09}=0A=20=0A=20=09=09= /*=20Check=20results=20for=20all=20tests=20*/=0A@@=20-1686,8=20+1788,9=20= @@=20run_schedule(const=20char=20*schedule,=20test_start_function=20= startfunc,=0A=20=09=09=09=09=09=20=20=20*tl;=0A=20=09=09=09bool=09=09= differ=20=3D=20false;=0A=20=0A-=09=09=09if=20(num_tests=20>=201)=0A-=09=09= =09=09status(_("=20=20=20=20=20%-28s=20...=20"),=20tests[i]);=0A+=09=09=09= resetStringInfo(&tagbuf);=0A+=0A+=09=09=09= INSTR_TIME_SUBTRACT(stoptimes[i],=20starttimes[i]);=0A=20=0A=20=09=09=09= /*=0A=20=09=09=09=20*=20Advance=20over=20all=20three=20lists=20= simultaneously.=0A@@=20-1708,7=20+1811,7=20@@=20run_schedule(const=20= char=20*schedule,=20test_start_function=20startfunc,=0A=20=09=09=09=09= newdiff=20=3D=20results_differ(tests[i],=20rl->str,=20el->str);=0A=20=09=09= =09=09if=20(newdiff=20&&=20tl)=0A=20=09=09=09=09{=0A-=09=09=09=09=09= printf("%s=20",=20tl->str);=0A+=09=09=09=09=09appendStringInfo(&tagbuf,=20= "%s=20",=20tl->str);=0A=20=09=09=09=09}=0A=20=09=09=09=09differ=20|=3D=20= newdiff;=0A=20=09=09=09}=0A@@=20-1726,30=20+1829,14=20@@=20= run_schedule(const=20char=20*schedule,=20test_start_function=20= startfunc,=0A=20=09=09=09=09=09=09break;=0A=20=09=09=09=09=09}=0A=20=09=09= =09=09}=0A-=09=09=09=09if=20(ignore)=0A-=09=09=09=09{=0A-=09=09=09=09=09= status(_("failed=20(ignored)"));=0A-=09=09=09=09=09fail_ignore_count++;=0A= -=09=09=09=09}=0A-=09=09=09=09else=0A-=09=09=09=09{=0A-=09=09=09=09=09= status(_("FAILED"));=0A-=09=09=09=09=09fail_count++;=0A-=09=09=09=09}=0A= +=0A+=09=09=09=09test_status_failed(tests[i],=20ignore,=20tagbuf.data,=20= INSTR_TIME_GET_MILLISEC(stoptimes[i]),=20(num_tests=20>=201));=0A=20=09=09= =09}=0A=20=09=09=09else=0A-=09=09=09{=0A-=09=09=09=09status(_("ok=20=20=20= =20"));=09/*=20align=20with=20FAILED=20*/=0A-=09=09=09=09= success_count++;=0A-=09=09=09}=0A+=09=09=09=09test_status_ok(tests[i],=20= INSTR_TIME_GET_MILLISEC(stoptimes[i]),=20(num_tests=20>=201));=0A=20=0A=20= =09=09=09if=20(statuses[i]=20!=3D=200)=0A=20=09=09=09=09= log_child_failure(statuses[i]);=0A-=0A-=09=09=09= INSTR_TIME_SUBTRACT(stoptimes[i],=20starttimes[i]);=0A-=09=09=09= status(_("=20%8.0f=20ms"),=20INSTR_TIME_GET_MILLISEC(stoptimes[i]));=0A-=0A= -=09=09=09status_end();=0A=20=09=09}=0A=20=0A=20=09=09for=20(i=20=3D=20= 0;=20i=20<=20num_tests;=20i++)=0A@@=20-1762,6=20+1849,7=20@@=20= run_schedule(const=20char=20*schedule,=20test_start_function=20= startfunc,=0A=20=09=09}=0A=20=09}=0A=20=0A+=09pg_free(tagbuf.data);=0A=20= =09free_stringlist(&ignorelist);=0A=20=0A=20=09fclose(scf);=0A@@=20= -1785,11=20+1873,12=20@@=20run_single_test(const=20char=20*test,=20= test_start_function=20startfunc,=0A=20=09=09=09=20=20=20*el,=0A=20=09=09=09= =20=20=20*tl;=0A=20=09bool=09=09differ=20=3D=20false;=0A+=09= StringInfoData=20tagbuf;=0A=20=0A-=09status(_("test=20%-28s=20...=20"),=20= test);=0A=20=09pid=20=3D=20(startfunc)=20(test,=20&resultfiles,=20= &expectfiles,=20&tags);=0A=20=09INSTR_TIME_SET_CURRENT(starttime);=0A=20=09= wait_for_tests(&pid,=20&exit_status,=20&stoptime,=20NULL,=201);=0A+=09= initStringInfo(&tagbuf);=0A=20=0A=20=09/*=0A=20=09=20*=20Advance=20over=20= all=20three=20lists=20simultaneously.=0A@@=20-1810,29=20+1899,22=20@@=20= run_single_test(const=20char=20*test,=20test_start_function=20startfunc,=0A= =20=09=09newdiff=20=3D=20results_differ(test,=20rl->str,=20el->str);=0A=20= =09=09if=20(newdiff=20&&=20tl)=0A=20=09=09{=0A-=09=09=09printf("%s=20",=20= tl->str);=0A+=09=09=09appendStringInfo(&tagbuf,=20"%s=20",=20tl->str);=0A= =20=09=09}=0A=20=09=09differ=20|=3D=20newdiff;=0A=20=09}=0A=20=0A+=09= INSTR_TIME_SUBTRACT(stoptime,=20starttime);=0A+=0A=20=09if=20(differ)=0A= -=09{=0A-=09=09status(_("FAILED"));=0A-=09=09fail_count++;=0A-=09}=0A+=09= =09test_status_failed(test,=20false,=20tagbuf.data,=20= INSTR_TIME_GET_MILLISEC(stoptime),=20false);=0A=20=09else=0A-=09{=0A-=09=09= status(_("ok=20=20=20=20"));=09/*=20align=20with=20FAILED=20*/=0A-=09=09= success_count++;=0A-=09}=0A+=09=09test_status_ok(test,=20= INSTR_TIME_GET_MILLISEC(stoptime),=20false);=0A=20=0A=20=09if=20= (exit_status=20!=3D=200)=0A=20=09=09log_child_failure(exit_status);=0A=20= =0A-=09INSTR_TIME_SUBTRACT(stoptime,=20starttime);=0A-=09status(_("=20= %8.0f=20ms"),=20INSTR_TIME_GET_MILLISEC(stoptime));=0A-=0A-=09= status_end();=0A+=09pg_free(tagbuf.data);=0A=20}=0A=20=0A=20/*=0A@@=20= -1854,9=20+1936,8=20@@=20open_result_files(void)=0A=20=09logfile=20=3D=20= fopen(logfilename,=20"w");=0A=20=09if=20(!logfile)=0A=20=09{=0A-=09=09= fprintf(stderr,=20_("%s:=20could=20not=20open=20file=20\"%s\"=20for=20= writing:=20%s\n"),=0A-=09=09=09=09progname,=20logfilename,=20= strerror(errno));=0A-=09=09exit(2);=0A+=09=09bail(_("%s:=20could=20not=20= open=20file=20\"%s\"=20for=20writing:=20%s"),=0A+=09=09=09=20progname,=20= logfilename,=20strerror(errno));=0A=20=09}=0A=20=0A=20=09/*=20create=20= the=20diffs=20file=20as=20empty=20*/=0A@@=20-1865,9=20+1946,8=20@@=20= open_result_files(void)=0A=20=09difffile=20=3D=20fopen(difffilename,=20= "w");=0A=20=09if=20(!difffile)=0A=20=09{=0A-=09=09fprintf(stderr,=20= _("%s:=20could=20not=20open=20file=20\"%s\"=20for=20writing:=20%s\n"),=0A= -=09=09=09=09progname,=20difffilename,=20strerror(errno));=0A-=09=09= exit(2);=0A+=09=09bail(_("%s:=20could=20not=20open=20file=20\"%s\"=20for=20= writing:=20%s"),=0A+=09=09=09=20progname,=20difffilename,=20= strerror(errno));=0A=20=09}=0A=20=09/*=20we=20don't=20keep=20the=20diffs=20= file=20open=20continuously=20*/=0A=20=09fclose(difffile);=0A@@=20-1883,7=20= +1963,6=20@@=20drop_database_if_exists(const=20char=20*dbname)=0A=20{=0A=20= =09StringInfo=09buf=20=3D=20psql_start_command();=0A=20=0A-=09= header(_("dropping=20database=20\"%s\""),=20dbname);=0A=20=09/*=20Set=20= warning=20level=20so=20we=20don't=20see=20chatter=20about=20nonexistent=20= DB=20*/=0A=20=09psql_add_command(buf,=20"SET=20client_min_messages=20=3D=20= warning");=0A=20=09psql_add_command(buf,=20"DROP=20DATABASE=20IF=20= EXISTS=20\"%s\"",=20dbname);=0A@@=20-1900,7=20+1979,6=20@@=20= create_database(const=20char=20*dbname)=0A=20=09=20*=20We=20use=20= template0=20so=20that=20any=20installation-local=20cruft=20in=20= template1=20will=0A=20=09=20*=20not=20mess=20up=20the=20tests.=0A=20=09=20= */=0A-=09header(_("creating=20database=20\"%s\""),=20dbname);=0A=20=09if=20= (encoding)=0A=20=09=09psql_add_command(buf,=20"CREATE=20DATABASE=20= \"%s\"=20TEMPLATE=3Dtemplate0=20ENCODING=3D'%s'%s",=20dbname,=20= encoding,=0A=20=09=09=09=09=09=09=20(nolocale)=20?=20"=20LC_COLLATE=3D'C'=20= LC_CTYPE=3D'C'"=20:=20"");=0A@@=20-1922,10=20+2000,7=20@@=20= create_database(const=20char=20*dbname)=0A=20=09=20*=20this=20will=20= work=20whether=20or=20not=20the=20extension=20is=20preinstalled.=0A=20=09= =20*/=0A=20=09for=20(sl=20=3D=20loadextension;=20sl=20!=3D=20NULL;=20sl=20= =3D=20sl->next)=0A-=09{=0A-=09=09header(_("installing=20%s"),=20= sl->str);=0A=20=09=09psql_command(dbname,=20"CREATE=20EXTENSION=20IF=20= NOT=20EXISTS=20\"%s\"",=20sl->str);=0A-=09}=0A=20}=0A=20=0A=20static=20= void=0A@@=20-1933,7=20+2008,6=20@@=20drop_role_if_exists(const=20char=20= *rolename)=0A=20{=0A=20=09StringInfo=09buf=20=3D=20psql_start_command();=0A= =20=0A-=09header(_("dropping=20role=20\"%s\""),=20rolename);=0A=20=09/*=20= Set=20warning=20level=20so=20we=20don't=20see=20chatter=20about=20= nonexistent=20role=20*/=0A=20=09psql_add_command(buf,=20"SET=20= client_min_messages=20=3D=20warning");=0A=20=09psql_add_command(buf,=20= "DROP=20ROLE=20IF=20EXISTS=20\"%s\"",=20rolename);=0A@@=20-1945,7=20= +2019,6=20@@=20create_role(const=20char=20*rolename,=20const=20= _stringlist=20*granted_dbs)=0A=20{=0A=20=09StringInfo=09buf=20=3D=20= psql_start_command();=0A=20=0A-=09header(_("creating=20role=20\"%s\""),=20= rolename);=0A=20=09psql_add_command(buf,=20"CREATE=20ROLE=20\"%s\"=20= WITH=20LOGIN",=20rolename);=0A=20=09for=20(;=20granted_dbs=20!=3D=20= NULL;=20granted_dbs=20=3D=20granted_dbs->next)=0A=20=09{=0A@@=20-2167,7=20= +2240,7=20@@=20regression_main(int=20argc,=20char=20*argv[],=0A=20=09=09=09= =09break;=0A=20=09=09=09default:=0A=20=09=09=09=09/*=20getopt_long=20= already=20emitted=20a=20complaint=20*/=0A-=09=09=09=09fprintf(stderr,=20= _("\nTry=20\"%s=20-h\"=20for=20more=20information.\n"),=0A+=09=09=09=09= pg_log_error_hint("Try=20\"%s=20--help\"=20for=20more=20information.",=0A= =20=09=09=09=09=09=09progname);=0A=20=09=09=09=09exit(2);=0A=20=09=09}=0A= @@=20-2230,17=20+2303,13=20@@=20regression_main(int=20argc,=20char=20= *argv[],=0A=20=0A=20=09=09if=20(directory_exists(temp_instance))=0A=20=09= =09{=0A-=09=09=09header(_("removing=20existing=20temp=20instance"));=0A=20= =09=09=09if=20(!rmtree(temp_instance,=20true))=0A=20=09=09=09{=0A-=09=09=09= =09fprintf(stderr,=20_("\n%s:=20could=20not=20remove=20temp=20instance=20= \"%s\"\n"),=0A-=09=09=09=09=09=09progname,=20temp_instance);=0A-=09=09=09= =09exit(2);=0A+=09=09=09=09bail(_("%s:=20could=20not=20remove=20temp=20= instance=20\"%s\""),=0A+=09=09=09=09=09=09=09=20progname,=20= temp_instance);=0A=20=09=09=09}=0A=20=09=09}=0A=20=0A-=09=09= header(_("creating=20temporary=20instance"));=0A-=0A=20=09=09/*=20make=20= the=20temp=20instance=20top=20directory=20*/=0A=20=09=09= make_directory(temp_instance);=0A=20=0A@@=20-2250,7=20+2319,6=20@@=20= regression_main(int=20argc,=20char=20*argv[],=0A=20=09=09=09= make_directory(buf);=0A=20=0A=20=09=09/*=20initdb=20*/=0A-=09=09= header(_("initializing=20database=20system"));=0A=20=09=09snprintf(buf,=20= sizeof(buf),=0A=20=09=09=09=09=20"\"%s%sinitdb\"=20-D=20\"%s/data\"=20= --no-clean=20--no-sync%s%s=20>=20\"%s/log/initdb.log\"=202>&1",=0A=20=09=09= =09=09=20bindir=20?=20bindir=20:=20"",=0A@@=20-2262,8=20+2330,8=20@@=20= regression_main(int=20argc,=20char=20*argv[],=0A=20=09=09fflush(NULL);=0A= =20=09=09if=20(system(buf))=0A=20=09=09{=0A-=09=09=09fprintf(stderr,=20= _("\n%s:=20initdb=20failed\nExamine=20%s/log/initdb.log=20for=20the=20= reason.\nCommand=20was:=20%s\n"),=20progname,=20outputdir,=20buf);=0A-=09= =09=09exit(2);=0A+=09=09=09bail(_("%s:=20initdb=20failed\nExamine=20= %s/log/initdb.log=20for=20the=20reason.\nCommand=20was:=20%s"),=0A+=09=09= =09=09=20progname,=20outputdir,=20buf);=0A=20=09=09}=0A=20=0A=20=09=09/*=0A= @@=20-2278,8=20+2346,8=20@@=20regression_main(int=20argc,=20char=20= *argv[],=0A=20=09=09pg_conf=20=3D=20fopen(buf,=20"a");=0A=20=09=09if=20= (pg_conf=20=3D=3D=20NULL)=0A=20=09=09{=0A-=09=09=09fprintf(stderr,=20= _("\n%s:=20could=20not=20open=20\"%s\"=20for=20adding=20extra=20config:=20= %s\n"),=20progname,=20buf,=20strerror(errno));=0A-=09=09=09exit(2);=0A+=09= =09=09bail(=20_("%s:=20could=20not=20open=20\"%s\"=20for=20adding=20= extra=20config:=20%s"),=0A+=09=09=09=09=20progname,=20buf,=20= strerror(errno));=0A=20=09=09}=0A=20=09=09fputs("\n#=20Configuration=20= added=20by=20pg_regress\n\n",=20pg_conf);=0A=20=09=09= fputs("log_autovacuum_min_duration=20=3D=200\n",=20pg_conf);=0A@@=20= -2298,8=20+2366,8=20@@=20regression_main(int=20argc,=20char=20*argv[],=0A= =20=09=09=09extra_conf=20=3D=20fopen(temp_config,=20"r");=0A=20=09=09=09= if=20(extra_conf=20=3D=3D=20NULL)=0A=20=09=09=09{=0A-=09=09=09=09= fprintf(stderr,=20_("\n%s:=20could=20not=20open=20\"%s\"=20to=20read=20= extra=20config:=20%s\n"),=20progname,=20temp_config,=20strerror(errno));=0A= -=09=09=09=09exit(2);=0A+=09=09=09=09bail(_("%s:=20could=20not=20open=20= \"%s\"=20to=20read=20extra=20config:=20%s"),=0A+=09=09=09=09=09=20= progname,=20temp_config,=20strerror(errno));=0A=20=09=09=09}=0A=20=09=09=09= while=20(fgets(line_buf,=20sizeof(line_buf),=20extra_conf)=20!=3D=20= NULL)=0A=20=09=09=09=09fputs(line_buf,=20pg_conf);=0A@@=20-2338,14=20= +2406,14=20@@=20regression_main(int=20argc,=20char=20*argv[],=0A=20=0A=20= =09=09=09=09if=20(port_specified_by_user=20||=20i=20=3D=3D=2015)=0A=20=09= =09=09=09{=0A-=09=09=09=09=09fprintf(stderr,=20_("port=20%d=20apparently=20= in=20use\n"),=20port);=0A+=09=09=09=09=09note(_("port=20%d=20apparently=20= in=20use\n"),=20port);=0A=20=09=09=09=09=09if=20= (!port_specified_by_user)=0A-=09=09=09=09=09=09fprintf(stderr,=20_("%s:=20= could=20not=20determine=20an=20available=20port\n"),=20progname);=0A-=09=09= =09=09=09fprintf(stderr,=20_("Specify=20an=20unused=20port=20using=20the=20= --port=20option=20or=20shut=20down=20any=20conflicting=20PostgreSQL=20= servers.\n"));=0A-=09=09=09=09=09exit(2);=0A+=09=09=09=09=09=09= note(_("could=20not=20determine=20an=20available=20port\n"));=0A+=09=09=09= =09=09bail(_("Specify=20an=20unused=20port=20using=20the=20--port=20= option=20or=20shut=20down=20any=20conflicting=20PostgreSQL=20= servers."));=0A=20=09=09=09=09}=0A=20=0A-=09=09=09=09fprintf(stderr,=20= _("port=20%d=20apparently=20in=20use,=20trying=20%d\n"),=20port,=20port=20= +=201);=0A+=09=09=09=09note(_("port=20%d=20apparently=20in=20use,=20= trying=20%d\n"),=0A+=09=09=09=09=09=09=20=20=20port,=20port=20+=201);=0A=20= =09=09=09=09port++;=0A=20=09=09=09=09sprintf(s,=20"%d",=20port);=0A=20=09= =09=09=09setenv("PGPORT",=20s,=201);=0A@@=20-2357,7=20+2425,6=20@@=20= regression_main(int=20argc,=20char=20*argv[],=0A=20=09=09/*=0A=20=09=09=20= *=20Start=20the=20temp=20postmaster=0A=20=09=09=20*/=0A-=09=09= header(_("starting=20postmaster"));=0A=20=09=09snprintf(buf,=20= sizeof(buf),=0A=20=09=09=09=09=20"\"%s%spostgres\"=20-D=20\"%s/data\"=20= -F%s=20"=0A=20=09=09=09=09=20"-c=20\"listen_addresses=3D%s\"=20-k=20= \"%s\"=20"=0A@@=20-2369,11=20+2436,7=20@@=20regression_main(int=20argc,=20= char=20*argv[],=0A=20=09=09=09=09=20outputdir);=0A=20=09=09= postmaster_pid=20=3D=20spawn_process(buf);=0A=20=09=09if=20= (postmaster_pid=20=3D=3D=20INVALID_PID)=0A-=09=09{=0A-=09=09=09= fprintf(stderr,=20_("\n%s:=20could=20not=20spawn=20postmaster:=20%s\n"),=0A= -=09=09=09=09=09progname,=20strerror(errno));=0A-=09=09=09exit(2);=0A-=09= =09}=0A+=09=09=09bail(_("could=20not=20spawn=20postmaster:=20%s\n"),=20= strerror(errno));=0A=20=0A=20=09=09/*=0A=20=09=09=20*=20Wait=20till=20= postmaster=20is=20able=20to=20accept=20connections;=20normally=20this=0A= @@=20-2408,16=20+2471,16=20@@=20regression_main(int=20argc,=20char=20= *argv[],=0A=20=09=09=09if=20(WaitForSingleObject(postmaster_pid,=200)=20= =3D=3D=20WAIT_OBJECT_0)=0A=20#endif=0A=20=09=09=09{=0A-=09=09=09=09= fprintf(stderr,=20_("\n%s:=20postmaster=20failed\nExamine=20= %s/log/postmaster.log=20for=20the=20reason\n"),=20progname,=20= outputdir);=0A-=09=09=09=09exit(2);=0A+=09=09=09=09bail(_("postmaster=20= failed,=20examine=20%s/log/postmaster.log=20for=20the=20reason\n"),=0A+=09= =09=09=09=09=20outputdir);=0A=20=09=09=09}=0A=20=0A=20=09=09=09= pg_usleep(1000000L);=0A=20=09=09}=0A=20=09=09if=20(i=20>=3D=20= wait_seconds)=0A=20=09=09{=0A-=09=09=09fprintf(stderr,=20_("\n%s:=20= postmaster=20did=20not=20respond=20within=20%d=20seconds\nExamine=20= %s/log/postmaster.log=20for=20the=20reason\n"),=0A-=09=09=09=09=09= progname,=20wait_seconds,=20outputdir);=0A+=09=09=09diag(_("postmaster=20= did=20not=20respond=20within=20%d=20seconds,=20examine=20= %s/log/postmaster.log=20for=20the=20reason\n"),=0A+=09=09=09=09=20= wait_seconds,=20outputdir);=0A=20=0A=20=09=09=09/*=0A=20=09=09=09=20*=20= If=20we=20get=20here,=20the=20postmaster=20is=20probably=20wedged=20= somewhere=20in=0A@@=20-2426,17=20+2489,14=20@@=20regression_main(int=20= argc,=20char=20*argv[],=0A=20=09=09=09=20*=20attempts.=0A=20=09=09=09=20= */=0A=20#ifndef=20WIN32=0A-=09=09=09if=20(kill(postmaster_pid,=20= SIGKILL)=20!=3D=200=20&&=0A-=09=09=09=09errno=20!=3D=20ESRCH)=0A-=09=09=09= =09fprintf(stderr,=20_("\n%s:=20could=20not=20kill=20failed=20= postmaster:=20%s\n"),=0A-=09=09=09=09=09=09progname,=20strerror(errno));=0A= +=09=09=09if=20(kill(postmaster_pid,=20SIGKILL)=20!=3D=200=20&&=20errno=20= !=3D=20ESRCH)=0A+=09=09=09=09bail(_("could=20not=20kill=20failed=20= postmaster:=20%s"),=20strerror(errno));=0A=20#else=0A=20=09=09=09if=20= (TerminateProcess(postmaster_pid,=20255)=20=3D=3D=200)=0A-=09=09=09=09= fprintf(stderr,=20_("\n%s:=20could=20not=20kill=20failed=20postmaster:=20= error=20code=20%lu\n"),=0A-=09=09=09=09=09=09progname,=20= GetLastError());=0A+=09=09=09=09bail(_("could=20not=20kill=20failed=20= postmaster:=20error=20code=20%lu"),=0A+=09=09=09=09=09=20= GetLastError());=0A=20#endif=0A-=0A-=09=09=09exit(2);=0A+=09=09=09= bail(_("postmaster=20failed"));=0A=20=09=09}=0A=20=0A=20=09=09= postmaster_running=20=3D=20true;=0A@@=20-2447,8=20+2507,8=20@@=20= regression_main(int=20argc,=20char=20*argv[],=0A=20#else=0A=20#define=20= ULONGPID(x)=20(unsigned=20long)=20(x)=0A=20#endif=0A-=09=09= printf(_("running=20on=20port=20%d=20with=20PID=20%lu\n"),=0A-=09=09=09=20= =20=20port,=20ULONGPID(postmaster_pid));=0A+=09=09note(_("running=20on=20= port=20%d=20with=20PID=20%lu\n"),=0A+=09=09=09=09=20=20=20port,=20= ULONGPID(postmaster_pid));=0A=20=09}=0A=20=09else=0A=20=09{=0A@@=20= -2479,8=20+2539,6=20@@=20regression_main(int=20argc,=20char=20*argv[],=0A= =20=09/*=0A=20=09=20*=20Ready=20to=20run=20the=20tests=0A=20=09=20*/=0A-=09= header(_("running=20regression=20test=20queries"));=0A-=0A=20=09for=20= (sl=20=3D=20schedulelist;=20sl=20!=3D=20NULL;=20sl=20=3D=20sl->next)=0A=20= =09{=0A=20=09=09run_schedule(sl->str,=20startfunc,=20postfunc);=0A@@=20= -2496,7=20+2554,6=20@@=20regression_main(int=20argc,=20char=20*argv[],=0A= =20=09=20*/=0A=20=09if=20(temp_instance)=0A=20=09{=0A-=09=09= header(_("shutting=20down=20postmaster"));=0A=20=09=09stop_postmaster();=0A= =20=09}=0A=20=0A@@=20-2507,62=20+2564,62=20@@=20regression_main(int=20= argc,=20char=20*argv[],=0A=20=09=20*/=0A=20=09if=20(temp_instance=20&&=20= fail_count=20=3D=3D=200=20&&=20fail_ignore_count=20=3D=3D=200)=0A=20=09{=0A= -=09=09header(_("removing=20temporary=20instance"));=0A=20=09=09if=20= (!rmtree(temp_instance,=20true))=0A-=09=09=09fprintf(stderr,=20_("\n%s:=20= could=20not=20remove=20temp=20instance=20\"%s\"\n"),=0A-=09=09=09=09=09= progname,=20temp_instance);=0A+=09=09=09pg_log_error("could=20not=20= remove=20temp=20instance=20\"%s\"",=0A+=09=09=09=09=09=09=20= temp_instance);=0A=20=09}=0A=20=0A-=09fclose(logfile);=0A+=0A+=0A+=09/*=0A= +=09=20*=20Emit=20a=20TAP=20compliant=20Plan=0A+=09=20*/=0A+=09= plan((fail_count=20+=20fail_ignore_count=20+=20success_count));=0A=20=0A=20= =09/*=0A=20=09=20*=20Emit=20nice-looking=20summary=20message=0A=20=09=20= */=0A=20=09if=20(fail_count=20=3D=3D=200=20&&=20fail_ignore_count=20=3D=3D= =200)=0A-=09=09snprintf(buf,=20sizeof(buf),=0A-=09=09=09=09=20_("=20All=20= %d=20tests=20passed.=20"),=0A-=09=09=09=09=20success_count);=0A-=09else=20= if=20(fail_count=20=3D=3D=200)=09/*=20fail_count=3D0,=20= fail_ignore_count>0=20*/=0A-=09=09snprintf(buf,=20sizeof(buf),=0A-=09=09=09= =09=20_("=20%d=20of=20%d=20tests=20passed,=20%d=20failed=20test(s)=20= ignored.=20"),=0A-=09=09=09=09=20success_count,=0A-=09=09=09=09=20= success_count=20+=20fail_ignore_count,=0A-=09=09=09=09=20= fail_ignore_count);=0A-=09else=20if=20(fail_ignore_count=20=3D=3D=200)=09= /*=20fail_count>0=20&&=20fail_ignore_count=3D0=20*/=0A-=09=09= snprintf(buf,=20sizeof(buf),=0A-=09=09=09=09=20_("=20%d=20of=20%d=20= tests=20failed.=20"),=0A-=09=09=09=09=20fail_count,=0A-=09=09=09=09=20= success_count=20+=20fail_count);=0A+=09=09note(_("All=20%d=20tests=20= passed.\n"),=20success_count);=0A+=09/*=20fail_count=3D0,=20= fail_ignore_count>0=20*/=0A+=09else=20if=20(fail_count=20=3D=3D=200)=0A+=09= =09note(_("%d=20of=20%d=20tests=20passed,=20%d=20failed=20test(s)=20= ignored.\n"),=0A+=09=09=09=20success_count,=0A+=09=09=09=20success_count=20= +=20fail_ignore_count,=0A+=09=09=09=20fail_ignore_count);=0A+=09/*=20= fail_count>0=20&&=20fail_ignore_count=3D0=20*/=0A+=09else=20if=20= (fail_ignore_count=20=3D=3D=200)=0A+=09=09diag(_("%d=20of=20%d=20tests=20= failed.\n"),=0A+=09=09=09=20fail_count,=0A+=09=09=09=20success_count=20+=20= fail_count);=0A+=09/*=20fail_count>0=20&&=20fail_ignore_count>0=20*/=0A=20= =09else=0A-=09=09/*=20fail_count>0=20&&=20fail_ignore_count>0=20*/=0A-=09= =09snprintf(buf,=20sizeof(buf),=0A-=09=09=09=09=20_("=20%d=20of=20%d=20= tests=20failed,=20%d=20of=20these=20failures=20ignored.=20"),=0A-=09=09=09= =09=20fail_count=20+=20fail_ignore_count,=0A-=09=09=09=09=20= success_count=20+=20fail_count=20+=20fail_ignore_count,=0A-=09=09=09=09=20= fail_ignore_count);=0A-=0A-=09putchar('\n');=0A-=09for=20(i=20=3D=20= strlen(buf);=20i=20>=200;=20i--)=0A-=09=09putchar('=3D');=0A-=09= printf("\n%s\n",=20buf);=0A-=09for=20(i=20=3D=20strlen(buf);=20i=20>=20= 0;=20i--)=0A-=09=09putchar('=3D');=0A-=09putchar('\n');=0A-=09= putchar('\n');=0A+=09=09diag(_("%d=20of=20%d=20tests=20failed,=20%d=20of=20= these=20failures=20ignored.\n"),=0A+=09=09=09=20fail_count=20+=20= fail_ignore_count,=0A+=09=09=09=20success_count=20+=20fail_count=20+=20= fail_ignore_count,=0A+=09=09=09=20fail_ignore_count);=0A=20=0A=20=09if=20= (file_size(difffilename)=20>=200)=0A=20=09{=0A-=09=09printf(_("The=20= differences=20that=20caused=20some=20tests=20to=20fail=20can=20be=20= viewed=20in=20the\n"=0A-=09=09=09=09=20"file=20\"%s\".=20=20A=20copy=20= of=20the=20test=20summary=20that=20you=20see\n"=0A-=09=09=09=09=20"above=20= is=20saved=20in=20the=20file=20\"%s\".\n\n"),=0A-=09=09=09=20=20=20= difffilename,=20logfilename);=0A+=09=09diag(_("The=20differences=20that=20= caused=20some=20tests=20to=20fail=20can=20be=20viewed=20in=20the=20file=20= \"%s\".\n"),=0A+=09=09=09=20difffilename);=0A+=09=09diag(_("A=20copy=20= of=20the=20test=20summary=20that=20you=20see=20above=20is=20saved=20in=20= the=20file=20\"%s\".\n"),=0A+=09=09=09=20logfilename);=0A=20=09}=0A=20=09= else=0A=20=09{=0A=20=09=09unlink(difffilename);=0A=20=09=09= unlink(logfilename);=0A+=0A+=09=09free(difffilename);=0A+=09=09= difffilename=20=3D=20NULL;=0A+=09=09free(logfilename);=0A+=09=09= logfilename=20=3D=20NULL;=0A=20=09}=0A=20=0A+=09fclose(logfile);=0A+=09= logfile=20=3D=20NULL;=0A+=0A=20=09if=20(fail_count=20!=3D=200)=0A=20=09=09= exit(1);=0A=20=0A--=20=0A2.32.1=20(Apple=20Git-133)=0A=0A= --Apple-Mail=_AA42F73D-E7F8-4657-8745-84EA12EF9272--