Обсуждение: [PATCH v1] Add a way to supply stdin to TAP tests
Folks, Our test coverage needs all the help it can get. This patch, extracted from another by Fabian Coelho, helps move things in that direction. I'd like to argue that it's not a new feature, and that it should be back-patched as far as possible. Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
Вложения
Hi. At Sun, 28 Apr 2019 17:07:16 +0200, David Fetter <david@fetter.org> wrote in <20190428150716.GP28936@fetter.org> > Our test coverage needs all the help it can get. > > This patch, extracted from another by Fabian Coelho, helps move things > in that direction. > > I'd like to argue that it's not a new feature, and that it should be > back-patched as far as possible. The comment for the parameter "in". +# - in: standard input Perhaps this is "string to be fed to standard input". This also can be a I/O reference but we don't care that? + $in = '' if not defined $in; run($cmd, '<', \undef) seems to work, maybe assuming "< /dev/null", which might be better? regards. -- Kyotaro Horiguchi NTT Open Source Software Center
On Tue, May 07, 2019 at 11:05:32AM +0900, Kyotaro HORIGUCHI wrote: > Hi. > > At Sun, 28 Apr 2019 17:07:16 +0200, David Fetter <david@fetter.org> wrote in <20190428150716.GP28936@fetter.org> > > Our test coverage needs all the help it can get. > > > > This patch, extracted from another by Fabian Coelho, helps move things > > in that direction. > > > > I'd like to argue that it's not a new feature, and that it should be > > back-patched as far as possible. > > The comment for the parameter "in". > > +# - in: standard input > > Perhaps this is "string to be fed to standard input". This also > can be a I/O reference but we don't care that? OK > + $in = '' if not defined $in; > > run($cmd, '<', \undef) seems to work, maybe assuming "< > /dev/null", which might be better? Is /dev/null a thing on Windows? Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
On 5/6/19 10:42 PM, David Fetter wrote: > On Tue, May 07, 2019 at 11:05:32AM +0900, Kyotaro HORIGUCHI wrote: >> Hi. >> >> At Sun, 28 Apr 2019 17:07:16 +0200, David Fetter <david@fetter.org> wrote in <20190428150716.GP28936@fetter.org> >>> Our test coverage needs all the help it can get. >>> >>> This patch, extracted from another by Fabian Coelho, helps move things >>> in that direction. >>> >>> I'd like to argue that it's not a new feature, and that it should be >>> back-patched as far as possible. >> The comment for the parameter "in". >> >> +# - in: standard input >> >> Perhaps this is "string to be fed to standard input". This also >> can be a I/O reference but we don't care that? > OK > >> + $in = '' if not defined $in; >> >> run($cmd, '<', \undef) seems to work, maybe assuming "< >> /dev/null", which might be better? > Is /dev/null a thing on Windows? Not as such, although there is NUL (see src/include/port.h). However, I don't think we should be faking anything here. I think it would be better to avoid setting $in if not supplied and then have this: if (defined($in)) { IPC::Run::run($cmd, '<', \$in, '>', \$stdout, '2>', \$stderr); } else { IPC::Run::run($cmd, >', \$stdout, '2>', \$stderr); } cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
On Tue, May 07, 2019 at 09:39:57AM -0400, Andrew Dunstan wrote: > > On 5/6/19 10:42 PM, David Fetter wrote: > > On Tue, May 07, 2019 at 11:05:32AM +0900, Kyotaro HORIGUCHI wrote: > >> Hi. > >> > >> At Sun, 28 Apr 2019 17:07:16 +0200, David Fetter <david@fetter.org> wrote in <20190428150716.GP28936@fetter.org> > >>> Our test coverage needs all the help it can get. > >>> > >>> This patch, extracted from another by Fabian Coelho, helps move things > >>> in that direction. > >>> > >>> I'd like to argue that it's not a new feature, and that it should be > >>> back-patched as far as possible. > >> The comment for the parameter "in". > >> > >> +# - in: standard input > >> > >> Perhaps this is "string to be fed to standard input". This also > >> can be a I/O reference but we don't care that? > > OK > > > >> + $in = '' if not defined $in; > >> > >> run($cmd, '<', \undef) seems to work, maybe assuming "< > >> /dev/null", which might be better? > > Is /dev/null a thing on Windows? > > However, I don't think we should be faking anything here. I think it > would be better to avoid setting $in if not supplied and then have this: > > if (defined($in)) > > { > > IPC::Run::run($cmd, '<', \$in, '>', \$stdout, '2>', \$stderr); > > } > > else > > { > > IPC::Run::run($cmd, >', \$stdout, '2>', \$stderr); > > } Done that way. Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate
Вложения
On Tue, May 07, 2019 at 06:47:59PM +0200, David Fetter wrote: > On Tue, May 07, 2019 at 09:39:57AM -0400, Andrew Dunstan wrote: > > > > On 5/6/19 10:42 PM, David Fetter wrote: > > > On Tue, May 07, 2019 at 11:05:32AM +0900, Kyotaro HORIGUCHI wrote: > > >> Hi. > > >> > > >> At Sun, 28 Apr 2019 17:07:16 +0200, David Fetter <david@fetter.org> wrote in <20190428150716.GP28936@fetter.org> > > >>> Our test coverage needs all the help it can get. > > >>> > > >>> This patch, extracted from another by Fabian Coelho, helps move things > > >>> in that direction. > > >>> > > >>> I'd like to argue that it's not a new feature, and that it should be > > >>> back-patched as far as possible. > > >> The comment for the parameter "in". > > >> > > >> +# - in: standard input > > >> > > >> Perhaps this is "string to be fed to standard input". This also > > >> can be a I/O reference but we don't care that? > > > OK > > > > > >> + $in = '' if not defined $in; > > >> > > >> run($cmd, '<', \undef) seems to work, maybe assuming "< > > >> /dev/null", which might be better? > > > Is /dev/null a thing on Windows? > > > > However, I don't think we should be faking anything here. I think it > > would be better to avoid setting $in if not supplied and then have this: > > > > if (defined($in)) > > > > { > > > > IPC::Run::run($cmd, '<', \$in, '>', \$stdout, '2>', \$stderr); > > > > } > > > > else > > > > { > > > > IPC::Run::run($cmd, >', \$stdout, '2>', \$stderr); > > > > } > > Done that way. It helps to commit the work before putting together the patch. Best, David. -- David Fetter <david(at)fetter(dot)org> http://fetter.org/ Phone: +1 415 235 3778 Remember to vote! Consider donating to Postgres: http://www.postgresql.org/about/donate