/
TestICU.pm
129 lines (98 loc) · 3.11 KB
/
TestICU.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Package Namespace is hardcoded. Modules must live in
# PGBuild::Modules
=comment
Copyright (c) 2003-2017, Andrew Dunstan
See accompanying License file for license details
=cut
package PGBuild::Modules::TestICU;
use PGBuild::Options;
use PGBuild::SCM;
use PGBuild::Utils;
use Fcntl qw(:seek);
use strict;
use vars qw($VERSION); $VERSION = 'REL_4.19';
my $hooks = {'installcheck' => \&installcheck,};
sub setup
{
my $class = __PACKAGE__;
my $buildroot = shift; # where we're building
my $branch = shift; # The branch of Postgres that's being built.
my $conf = shift; # ref to the whole config object
my $pgsql = shift; # postgres build dir
return unless grep {$_ eq '--with-icu' } @{$conf->{config_opts}},
# could even set up several of these (e.g. for different branches)
my $self = {
buildroot => $buildroot,
pgbranch=> $branch,
bfconf => $conf,
pgsql => $pgsql
};
bless($self, $class);
# for each instance you create, do:
main::register_module_hooks($self,$hooks);
}
sub installcheck
{
my $self = shift;
my $locale = shift;
return unless $locale =~ /utf8/i;
my $pgsql = $self->{pgsql};
my $branch = $self->{pgbranch};
my $buildroot = "$self->{buildroot}/$branch";
my $binswitch = 'bindir';
my $installdir = "$buildroot/inst";
return unless $locale =~ /utf8$/i;
return unless main::step_wanted("installcheck-icu");
print main::time_str(), "installchecking ICU-$locale\n"
if $verbose;
(my $buildport = $ENV{EXTRA_REGRESS_OPTS}) =~ s/--port=//;
my $inputdir = "";
if ($self->{bfconf}->{use_vpath})
{
if ($from_source)
{
$inputdir = "--inputdir=$from_source/src/test/regress";
}
else
{
$inputdir = "--inputdir=$buildroot/pgsql/src/test/regress";
}
}
my $logpos = -s "$installdir/logfile" || 0;
my @checklog;
my $cmd ="./pg_regress --$binswitch=$installdir/bin --dlpath=. "
."$inputdir --port=$buildport collate.icu.utf8";
@checklog = run_log("cd $pgsql/src/test/regress && $cmd");
my $status = $? >>8;
my @logfiles =
("$pgsql/src/test/regress/regression.diffs","$installdir/logfile");
foreach my $logfile(@logfiles)
{
next unless (-e $logfile );
push(@checklog,"\n\n================== $logfile ==================\n");
my $handle;
open($handle,$logfile);
seek($handle, $logpos, SEEK_SET) if $logfile =~ m!/logfile$!;
while(<$handle>)
{
push(@checklog,$_);
}
close($handle);
}
if ($status)
{
my @trace =
main::get_stack_trace("$installdir/bin","$installdir/data-$locale");
push(@checklog,@trace);
}
main::writelog("install-check-ICU-$locale",\@checklog);
print "======== make installcheck -ICU-$locale log ========\n",@checklog
if ($verbose > 1);
main::send_result("InstallCheck-ICU-$locale",$status,\@checklog)
if $status;
{
no warnings 'once';
$main::steps_completed .= " InstallCheck-ICU-$locale";
}
}
1;