Making src/test/ssl more robust

Started by Michael Paquierabout 11 years ago4 messageshackers
Jump to latest
#1Michael Paquier
michael@paquier.xyz

Hi all,

I noticed two things while looking at the SSL test suite:
1) When running the tests, some logs are generated in client-log, but
this log file has no entry in .gitignore... A patch is attached.
2) cp is used with a wildcard and system_or_bail in ServerSetup.pm:
system_or_bail "cp ssl/server-*.crt '$tempdir'/pgdata";
system_or_bail "cp ssl/server-*.key '$tempdir'/pgdata";
system_or_bail "chmod 0600 '$tempdir'/pgdata/server-*.key";
system_or_bail "cp ssl/root+client_ca.crt '$tempdir'/pgdata";
system_or_bail "cp ssl/root+client.crl '$tempdir'/pgdata";
This does not look very portable to me. Wouldn't it be better to use
glob to get a list of the files and then copy each matching entry?
Thoughts?
--
Michael

Attachments:

20150408_ssl_tap_gitignore.patchtext/x-patch; charset=US-ASCII; name=20150408_ssl_tap_gitignore.patchDownload+2-0
#2Michael Paquier
michael@paquier.xyz
In reply to: Michael Paquier (#1)
Re: Making src/test/ssl more robust

On Wed, Apr 8, 2015 at 9:57 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:

I noticed two things while looking at the SSL test suite:
1) When running the tests, some logs are generated in client-log, but
this log file has no entry in .gitignore... A patch is attached.
2) cp is used with a wildcard and system_or_bail in ServerSetup.pm:
system_or_bail "cp ssl/server-*.crt '$tempdir'/pgdata";
system_or_bail "cp ssl/server-*.key '$tempdir'/pgdata";
system_or_bail "chmod 0600 '$tempdir'/pgdata/server-*.key";
system_or_bail "cp ssl/root+client_ca.crt '$tempdir'/pgdata";
system_or_bail "cp ssl/root+client.crl '$tempdir'/pgdata";
This does not look very portable to me. Wouldn't it be better to use
glob to get a list of the files and then copy each matching entry?
Thoughts?

Here are patches on top of those words. Instead of cp, glob is used
with File::Copy and File::Basename to make the code more portable,
something useful for Windows for example where cp is not directly
available.
--
Michael

Attachments:

0001-Ignore-content-generated-by-TAP-test-suite-of-SSL.patchtext/x-patch; charset=US-ASCII; name=0001-Ignore-content-generated-by-TAP-test-suite-of-SSL.patchDownload+3-1
0002-Make-TAP-tests-of-SSL-more-portable-by-avoiding-cp.patchtext/x-patch; charset=US-ASCII; name=0002-Make-TAP-tests-of-SSL-more-portable-by-avoiding-cp.patchDownload+20-6
#3Heikki Linnakangas
heikki.linnakangas@enterprisedb.com
In reply to: Michael Paquier (#2)
Re: Making src/test/ssl more robust

On 04/09/2015 10:06 AM, Michael Paquier wrote:

On Wed, Apr 8, 2015 at 9:57 PM, Michael Paquier
<michael.paquier@gmail.com> wrote:

I noticed two things while looking at the SSL test suite:
1) When running the tests, some logs are generated in client-log, but
this log file has no entry in .gitignore... A patch is attached.
2) cp is used with a wildcard and system_or_bail in ServerSetup.pm:
system_or_bail "cp ssl/server-*.crt '$tempdir'/pgdata";
system_or_bail "cp ssl/server-*.key '$tempdir'/pgdata";
system_or_bail "chmod 0600 '$tempdir'/pgdata/server-*.key";
system_or_bail "cp ssl/root+client_ca.crt '$tempdir'/pgdata";
system_or_bail "cp ssl/root+client.crl '$tempdir'/pgdata";
This does not look very portable to me. Wouldn't it be better to use
glob to get a list of the files and then copy each matching entry?
Thoughts?

Here are patches on top of those words. Instead of cp, glob is used
with File::Copy and File::Basename to make the code more portable,
something useful for Windows for example where cp is not directly
available.

Pushed, thanks!

- Heikki

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#4Michael Paquier
michael@paquier.xyz
In reply to: Heikki Linnakangas (#3)
Re: Making src/test/ssl more robust

On Fri, Apr 10, 2015 at 4:08 AM, Heikki Linnakangas wrote:

Pushed, thanks!

Thanks.
--
Michael

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers