@@ -3,10 +3,13 @@ use warnings;
33use Test::More;
44use version;
55
6+ my $image_name = $ENV {TEST_IMAGE };
7+
8+ diag " \n Checking $image_name " ;
9+
610my %prereqs = (
711 ' Archive::Tar' => ' ' ,
812 ' Archive::Zip' => ' <= 1.65?(cloud6|cloud7|addons)' ,
9- ' DBD::mysql' => ' 4.000' ,
1013 ' DBI' => ' 1.633' ,
1114 ' GD' => 0,
1215 ' Graphics::Magick' => 0,
@@ -18,9 +21,11 @@ my %prereqs = (
1821 ' IO::Socket::SSL' => ' 2.058' ,
1922);
2023
21- my $image_name = $ENV {TEST_IMAGE };
22-
23- diag " \n Checking $image_name " ;
24+ if ($image_name eq ' postgresql' ) {
25+ $prereqs {' DBD::Pg' } = 0;
26+ } else {
27+ $prereqs {' DBD::mysql' } = ' 4.000' ;
28+ }
2429
2530# temporary files
2631
@@ -139,19 +144,23 @@ ok $phpinfo =~ /(?:
139144 Zend[ ]Multibyte[ ]Support[ ]=>[ ]provided[ ]by[ ]mbstring |
140145 mbstring[ ]extension[ ]makes[ ]use[ ]of[ ]"streamable[ ]kanji[ ]code[ ]filter[ ]and[ ]converter"
141146)/x , " $image_name : PHP has mbstring" ;
142- ok $phpinfo =~ / PDO drivers => .*?mysql/ , " $image_name : PHP has PDO mysql driver" ;
143- ok $phpinfo =~ / GD Support => enabled/ , " $image_name : PHP has GD" ;
147+ if ($image_name eq ' postgresql' ) {
148+ ok $phpinfo =~ / PDO drivers => .*?pgsql/ , " $image_name : PHP has PDO pgsql driver" ;
149+ } else {
150+ ok $phpinfo =~ / PDO drivers => .*?mysql/ , " $image_name : PHP has PDO mysql driver" ;
151+ }
152+ ok $phpinfo =~ / GD Support => enabled/ , " $image_name : PHP has GD" ;
144153SKIP: {
145154 local $TODO = ' php for CentOS6 does not support DOM/XML' if $image_name =~ / centos6/ ;
146- ok $phpinfo =~ / DOM.XML => enabled/ , " $image_name : PHP has DOM/XML" ;
155+ ok $phpinfo =~ / DOM.XML => enabled/ , " $image_name : PHP has DOM/XML" ;
147156}
148157ok $phpinfo =~ / GIF Read Support => enabled/ , " $image_name : PHP supports GIF read" ;
149158ok $phpinfo =~ / GIF Create Support => enabled/ , " $image_name : PHP supports GIF create" ;
150159ok $phpinfo =~ / JPEG Support => enabled/ , " $image_name : PHP supports JPEG" ;
151160ok $phpinfo =~ / PNG Support => enabled/ , " $image_name : PHP supports PNG" ;
152161SKIP: {
153162 local $TODO = ' php for CentOS6 does not support WebP' if $image_name =~ / centos6/ ;
154- ok $phpinfo =~ / WebP Support => enabled/ , " $image_name : PHP supports WebP" ;
163+ ok $phpinfo =~ / WebP Support => enabled/ , " $image_name : PHP supports WebP" ;
155164}
156165SKIP: {
157166 local $TODO = ' Memcache may not be supported' if $image_name =~ / amazonlinux|oracle|centos8/ ;
@@ -192,40 +201,45 @@ SKIP: {
192201 my ($phpunit ) = (` phpunit --version` // ' ' ) =~ / PHPUnit (\d +\.\d +\.\d +)/ ;
193202 ok $phpunit , " $image_name : phpunit exists ($phpunit )" ;
194203 if ($php_version_number >= 8.2) {
195- is substr ($phpunit , 0, 2) => 11, " phpunit 11 (11.x.x) for php >= 8.2 ($php_version )" ;
204+ is substr ($phpunit , 0, 2) => 11, " $image_name : phpunit 11 (11.x.x) for php >= 8.2 ($php_version )" ;
196205 } elsif ($php_version_number >= 8.1) {
197- is substr ($phpunit , 0, 2) => 10, " phpunit 10 (10.x.x) for php >= 8.1 ($php_version )" ;
206+ is substr ($phpunit , 0, 2) => 10, " $image_name : phpunit 10 (10.x.x) for php >= 8.1 ($php_version )" ;
198207 } elsif ($php_version_number >= 7.3) {
199- is substr ($phpunit , 0, 1) => 9, " phpunit 9 (9.5.x) for php >= 7.3 ($php_version )" ;
208+ is substr ($phpunit , 0, 1) => 9, " $image_name : phpunit 9 (9.5.x) for php >= 7.3 ($php_version )" ;
200209 } elsif ($php_version_number >= 7.2) {
201- is substr ($phpunit , 0, 1) => 8, " phpunit 8 (8.5.21) for php >= 7.2 ($php_version )" ;
210+ is substr ($phpunit , 0, 1) => 8, " $image_name : phpunit 8 (8.5.21) for php >= 7.2 ($php_version )" ;
202211 } elsif ($php_version_number >= 7.1) {
203- is substr ($phpunit , 0, 1) => 7, " phpunit 7 (7.5.20) for php >= 7.1 ($php_version )" ;
212+ is substr ($phpunit , 0, 1) => 7, " $image_name : phpunit 7 (7.5.20) for php >= 7.1 ($php_version )" ;
204213 } elsif ($php_version_number >= 7.0) {
205- is substr ($phpunit , 0, 1) => 6, " phpunit 6 (6.5.14) for php >= 7.0 ($php_version )" ;
214+ is substr ($phpunit , 0, 1) => 6, " $image_name : phpunit 6 (6.5.14) for php >= 7.0 ($php_version )" ;
206215 } elsif ($php_version_number >= 5.6) {
207- is substr ($phpunit , 0, 1) => 5, " phpunit 5 (5.7.27) for php >= 5.6 ($php_version )" ;
216+ is substr ($phpunit , 0, 1) => 5, " $image_name : phpunit 5 (5.7.27) for php >= 5.6 ($php_version )" ;
208217 } else {
209- is substr ($phpunit , 0, 1) => 4, " phpunit 4 (4.8.36) for php >= 5.3 ($php_version )" ;
218+ is substr ($phpunit , 0, 1) => 4, " $image_name : phpunit 4 (4.8.36) for php >= 5.3 ($php_version )" ;
210219 }
211220}
212221
213- my ($mysql_version , $is_maria ) = ` mysql --verbose --help 2>/dev/null` =~ / mysql\s +(?:from|Ver).+?(\d +\.\d +\.\d +).+?(MariaDB)?/ ;
214- my $mysql = $is_maria ? " MariaDB" : " MySQL" ;
215- ok $mysql_version , " $image_name : $mysql exists ($mysql_version )" ;
216- my $sql_mode = ` mysql -Nse 'select \@\@ sql_mode' 2>&1` ;
217- note " SQL mode: $sql_mode " ;
218- if ($sql_mode =~ / Can't connect to local MySQL/ ) {
219- fail " $image_name : failed to connect to local mysql" if $entrypoint_is_executed ;
220- }
221- if ($mysql_version =~ / ^5\. [567]\. / or $mysql_version =~ / ^10\. [0123]\. / ) {
222- my ($file_format ) = ` mysql -Nse 'select \@\@ innodb_file_format'` =~ / (\w +)/ ;
223- my ($file_per_table ) = ` mysql -Nse 'select \@\@ innodb_file_per_table'` =~ / (\w +)/ ;
224- my ($large_prefix ) = ` mysql -Nse 'select \@\@ innodb_large_prefix'` =~ / (\w +)/ ;
225- $file_format //= ' ' ;
226- $file_per_table //= ' ' ;
227- $large_prefix //= ' ' ;
228- note " InnoDB: file format $file_format , file per table $file_per_table , large prefix $large_prefix " ;
222+ if ($image_name eq ' postgresql' ) {
223+ my ($postgresql_version ) = ` su -c 'postgres --version' postgres 2>/dev/null` =~ / postgres .+?(\d +\.\d +)/ ;
224+ ok $postgresql_version , " $image_name : postgresql exists ($postgresql_version )" ;
225+ } else {
226+ my ($mysql_version , $is_maria ) = ` mysql --verbose --help 2>/dev/null` =~ / mysql\s +(?:from|Ver).+?(\d +\.\d +\.\d +).+?(MariaDB)?/ ;
227+ my $mysql = $is_maria ? " MariaDB" : " MySQL" ;
228+ ok $mysql_version , " $image_name : $mysql exists ($mysql_version )" ;
229+ my $sql_mode = ` mysql -Nse 'select \@\@ sql_mode' 2>&1` ;
230+ note " SQL mode: $sql_mode " ;
231+ if ($sql_mode =~ / Can't connect to local MySQL/ ) {
232+ fail " $image_name : failed to connect to local mysql" if $entrypoint_is_executed ;
233+ }
234+ if ($mysql_version =~ / ^5\. [567]\. / or $mysql_version =~ / ^10\. [0123]\. / ) {
235+ my ($file_format ) = ` mysql -Nse 'select \@\@ innodb_file_format'` =~ / (\w +)/ ;
236+ my ($file_per_table ) = ` mysql -Nse 'select \@\@ innodb_file_per_table'` =~ / (\w +)/ ;
237+ my ($large_prefix ) = ` mysql -Nse 'select \@\@ innodb_large_prefix'` =~ / (\w +)/ ;
238+ $file_format //= ' ' ;
239+ $file_per_table //= ' ' ;
240+ $large_prefix //= ' ' ;
241+ note " InnoDB: file format $file_format , file per table $file_per_table , large prefix $large_prefix " ;
242+ }
229243}
230244
231245my ($ruby_version ) = ` ruby --version 2>&1` =~ / ruby (\d +\.\d +.\d +)/ ;
0 commit comments