Skip to content

Commit ca3f43a

Browse files
committed
Change TAP test framework to not rely on having a chmod executable.
This might not work at all on Windows, and is not ever efficient. Michael Paquier
1 parent b76e76b commit ca3f43a

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/test/ssl/ServerSetup.pm

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,20 @@ sub copy_files
4343
}
4444
}
4545

46+
# Perform chmod on a set of files, taking into account wildcards
47+
sub chmod_files
48+
{
49+
my $mode = shift;
50+
my $file_expr = shift;
51+
52+
my @all_files = glob $file_expr;
53+
foreach my $file_entry (@all_files)
54+
{
55+
chmod $mode, $file_entry
56+
or die "Could not run chmod with mode $mode on $file_entry";
57+
}
58+
}
59+
4660
sub configure_test_server_for_ssl
4761
{
4862
my $tempdir = $_[0];
@@ -68,7 +82,7 @@ sub configure_test_server_for_ssl
6882
# Copy all server certificates and keys, and client root cert, to the data dir
6983
copy_files("ssl/server-*.crt", "$tempdir/pgdata");
7084
copy_files("ssl/server-*.key", "$tempdir/pgdata");
71-
system_or_bail "chmod 0600 '$tempdir'/pgdata/server-*.key";
85+
chmod_files(0600, "$tempdir/pgdata/server-*.key");
7286
copy_files("ssl/root+client_ca.crt", "$tempdir/pgdata");
7387
copy_files("ssl/root+client.crl", "$tempdir/pgdata");
7488

src/test/ssl/t/001_ssltests.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ sub test_connect_fails
7878
# The client's private key must not be world-readable. Git doesn't track
7979
# permissions (except for the executable bit), so they might be wrong after
8080
# a checkout.
81-
system_or_bail "chmod 0600 ssl/client.key";
81+
chmod 0600, "ssl/client.key";
8282

8383
#### Part 0. Set up the server.
8484

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy