Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb235d41

Browse files
committed
Support new perl module namespace in stable branches
Commitb3b4d8e moved our perl test modules to a better namespacestructure, but this has made life hard for people wishing to backpatchimprovements in the TAP tests. Here we alleviate much of that difficultyby implementing the new module names on top of the old modules, mostlyby using a little perl typeglob aliasing magic, so that we don't have adual maintenance burden. This should work both for the case where a newtest is backpatched and the case where a fix to an existing test thatuses the new namespace is backpatched.Reviewed by Michael PaquierPer complaint from Andres FreundDiscussion:https://postgr.es/m/20220418141530.nfxtkohefvwnzncl@alap3.anarazel.deApplied to branches 10 through 14
1 parent89d349b commitb235d41

File tree

4 files changed

+119
-0
lines changed

4 files changed

+119
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
2+
# Copyright (c) 2022, PostgreSQL Global Development Group
3+
4+
# allow use of release 15+ perl namespace in older branches
5+
# just 'use' the older module name.
6+
# See PostgresNode.pm for function implementations
7+
8+
packagePostgreSQL::Test::Cluster;
9+
10+
use strict;
11+
use warnings;
12+
13+
use PostgresNode;
14+
15+
1;
16+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Copyright (c) 2022, PostgreSQL Global Development Group
2+
3+
# allow use of release 15+ perl namespace in older branches
4+
# just 'use' the older module name.
5+
# We export the same names as the v15 module.
6+
# See TestLib.pm for alias assignment that makes this all work.
7+
8+
packagePostgreSQL::Test::Utils;
9+
10+
use strict;
11+
use warnings;
12+
13+
use Exporter'import';
14+
15+
use TestLib;
16+
17+
our@EXPORT =qw(
18+
generate_ascii_string
19+
slurp_dir
20+
slurp_file
21+
append_to_file
22+
check_mode_recursive
23+
chmod_recursive
24+
check_pg_config
25+
dir_symlink
26+
system_or_bail
27+
system_log
28+
run_log
29+
run_command
30+
31+
command_ok
32+
command_fails
33+
command_exit_is
34+
program_help_ok
35+
program_version_ok
36+
program_options_handling_ok
37+
command_like
38+
command_like_safe
39+
command_fails_like
40+
command_checks_all
41+
42+
$windows_os
43+
$is_msys2
44+
$use_unix_sockets
45+
);
46+
47+
1;

‎src/test/perl/PostgresNode.pm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2761,4 +2761,18 @@ sub corrupt_page_checksum
27612761
27622762
=cut
27632763

2764+
# support release 15+ perl module namespace
2765+
2766+
packagePostgreSQL::Test::Cluster;## no critic (ProhibitMultiplePackages)
2767+
2768+
subnew
2769+
{
2770+
shift;# remove class param from args
2771+
return PostgresNode->get_new_node(@_);
2772+
}
2773+
2774+
no warnings'once';
2775+
2776+
*get_free_port = *PostgresNode::get_free_port;
2777+
27642778
1;

‎src/test/perl/TestLib.pm

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,4 +948,46 @@ sub command_checks_all
948948
949949
=cut
950950

951+
# support release 15+ perl module namespace
952+
953+
packagePostgreSQL::Test::Utils;## no critic (ProhibitMultiplePackages)
954+
955+
# we don't want to export anything here, but we want to support things called
956+
# via this package name explicitly.
957+
958+
# use typeglobs to alias these functions and variables
959+
960+
no warningsqw(once);
961+
962+
*generate_ascii_string = *TestLib::generate_ascii_string;
963+
*slurp_dir = *TestLib::slurp_dir;
964+
*slurp_file = *TestLib::slurp_file;
965+
*append_to_file = *TestLib::append_to_file;
966+
*check_mode_recursive = *TestLib::check_mode_recursive;
967+
*chmod_recursive = *TestLib::chmod_recursive;
968+
*check_pg_config = *TestLib::check_pg_config;
969+
*dir_symlink = *TestLib::dir_symlink;
970+
*system_or_bail = *TestLib::system_or_bail;
971+
*system_log = *TestLib::system_log;
972+
*run_log = *TestLib::run_log;
973+
*run_command = *TestLib::run_command;
974+
*command_ok = *TestLib::command_ok;
975+
*command_fails = *TestLib::command_fails;
976+
*command_exit_is = *TestLib::command_exit_is;
977+
*program_help_ok = *TestLib::program_help_ok;
978+
*program_version_ok = *TestLib::program_version_ok;
979+
*program_options_handling_ok = *TestLib::program_options_handling_ok;
980+
*command_like = *TestLib::command_like;
981+
*command_like_safe = *TestLib::command_like_safe;
982+
*command_fails_like = *TestLib::command_fails_like;
983+
*command_checks_all = *TestLib::command_checks_all;
984+
985+
*windows_os = *TestLib::windows_os;
986+
*is_msys2 = *TestLib::is_msys2;
987+
*use_unix_sockets = *TestLib::use_unix_sockets;
988+
*timeout_default = *TestLib::timeout_default;
989+
*tmp_check = *TestLib::tmp_check;
990+
*log_path = *TestLib::log_path;
991+
*test_logfile = *TestLib::test_log_file;
992+
951993
1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp