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

Commit17bdba3

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 parent5487585 commit17bdba3

File tree

4 files changed

+113
-0
lines changed

4 files changed

+113
-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: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
system_or_bail
26+
system_log
27+
run_log
28+
run_command
29+
30+
command_ok
31+
command_fails
32+
command_exit_is
33+
program_help_ok
34+
program_version_ok
35+
program_options_handling_ok
36+
command_like
37+
command_like_safe
38+
command_fails_like
39+
command_checks_all
40+
41+
$windows_os
42+
);
43+
44+
1;

‎src/test/perl/PostgresNode.pm

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2272,4 +2272,18 @@ sub corrupt_page_checksum
22722272
22732273
=cut
22742274

2275+
# support release 15+ perl module namespace
2276+
2277+
packagePostgreSQL::Test::Cluster;## no critic (ProhibitMultiplePackages)
2278+
2279+
subnew
2280+
{
2281+
shift;# remove class param from args
2282+
return PostgresNode->get_new_node(@_);
2283+
}
2284+
2285+
no warnings'once';
2286+
2287+
*get_free_port = *PostgresNode::get_free_port;
2288+
22752289
1;

‎src/test/perl/TestLib.pm

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -621,4 +621,43 @@ sub command_checks_all
621621
return;
622622
}
623623

624+
# support release 15+ perl module namespace
625+
626+
packagePostgreSQL::Test::Utils;## no critic (ProhibitMultiplePackages)
627+
628+
# we don't want to export anything here, but we want to support things called
629+
# via this package name explicitly.
630+
631+
# use typeglobs to alias these functions and variables
632+
633+
no warningsqw(once);
634+
635+
*generate_ascii_string = *TestLib::generate_ascii_string;
636+
*slurp_dir = *TestLib::slurp_dir;
637+
*slurp_file = *TestLib::slurp_file;
638+
*append_to_file = *TestLib::append_to_file;
639+
*check_mode_recursive = *TestLib::check_mode_recursive;
640+
*chmod_recursive = *TestLib::chmod_recursive;
641+
*check_pg_config = *TestLib::check_pg_config;
642+
*system_or_bail = *TestLib::system_or_bail;
643+
*system_log = *TestLib::system_log;
644+
*run_log = *TestLib::run_log;
645+
*run_command = *TestLib::run_command;
646+
*command_ok = *TestLib::command_ok;
647+
*command_fails = *TestLib::command_fails;
648+
*command_exit_is = *TestLib::command_exit_is;
649+
*program_help_ok = *TestLib::program_help_ok;
650+
*program_version_ok = *TestLib::program_version_ok;
651+
*program_options_handling_ok = *TestLib::program_options_handling_ok;
652+
*command_like = *TestLib::command_like;
653+
*command_like_safe = *TestLib::command_like_safe;
654+
*command_fails_like = *TestLib::command_fails_like;
655+
*command_checks_all = *TestLib::command_checks_all;
656+
657+
*windows_os = *TestLib::windows_os;
658+
*timeout_default = *TestLib::timeout_default;
659+
*tmp_check = *TestLib::tmp_check;
660+
*log_path = *TestLib::log_path;
661+
*test_logfile = *TestLib::test_log_file;
662+
624663
1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp