Skip to content

Commit 8b0da0b

Browse files
committed
Merge branch 'pull-request/68'
By Davey Shafik via Davey Shafik * pull-request/68: Fix boolean casting and whitespace (@dsp / #68) Add curl extension config, uses cli-server to test Source all extension scripts for ENV vars Add extension configs, compile more extensions Reformat, setup MySQL DB, call run-tests directly Add support for Travis CI
2 parents 2c230fb + 5ef46fe commit 8b0da0b

File tree

9 files changed

+86
-6
lines changed

9 files changed

+86
-6
lines changed

.travis.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
language: php
2+
3+
php:
4+
# We only specify one version so we only get one worker
5+
- 5.4
6+
7+
env:
8+
- REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php
9+
10+
before_script:
11+
# Compile PHP
12+
- ./travis/compile.sh
13+
# Setup Extensions
14+
- . ./travis/ext/mysql/setup.sh
15+
- . ./travis/ext/mysqli/setup.sh
16+
- . ./travis/ext/pdo_mysql/setup.sh
17+
- . ./travis/ext/pgsql/setup.sh
18+
- . ./travis/ext/pdo_pgsql/setup.sh
19+
20+
# Run PHPs run-tests.php
21+
script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP"

run-tests.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,14 +311,15 @@ function write_information($show_html)
311311
define('PHP_QA_EMAIL', 'qa-reports@lists.php.net');
312312
define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php');
313313
define('QA_REPORTS_PAGE', 'http://qa.php.net/reports');
314+
define('TRAVIS_CI' , (bool) getenv('TRAVIS_PHP_VERSION'));
314315

315316
function save_or_mail_results()
316317
{
317318
global $sum_results, $just_save_results, $failed_test_summary,
318319
$PHP_FAILED_TESTS, $CUR_DIR, $php, $output_file, $compression;
319320

320321
/* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */
321-
if (!getenv('NO_INTERACTION')) {
322+
if (!getenv('NO_INTERACTION') && !TRAVIS_CI) {
322323
$fp = fopen("php://stdin", "r+");
323324
if ($sum_results['FAILED'] || $sum_results['BORKED'] || $sum_results['WARNED'] || $sum_results['LEAKED'] || $sum_results['XFAILED']) {
324325
echo "\nYou may have found a problem in PHP.";
@@ -335,8 +336,8 @@ function save_or_mail_results()
335336
$just_save_results = (strtolower($user_input[0]) == 's');
336337
}
337338

338-
if ($just_save_results || !getenv('NO_INTERACTION')) {
339-
if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
339+
if ($just_save_results || !getenv('NO_INTERACTION') || TRAVIS_CI) {
340+
if ($just_save_results || TRAVIS_CI || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') {
340341
/*
341342
* Collect information about the host system for our report
342343
* Fetch phpinfo() output so that we can see the PHP enviroment
@@ -348,7 +349,9 @@ function save_or_mail_results()
348349
}
349350

350351
/* Ask the user to provide an email address, so that QA team can contact the user */
351-
if (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) {
352+
if (TRAVIS_CI) {
353+
$user_email = 'travis at php dot net';
354+
} elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) {
352355
echo "\nPlease enter your email address.\n(Your address will be mangled so that it will not go out on any\nmailinglist in plain text): ";
353356
flush();
354357
$user_email = trim(fgets($fp, 1024));
@@ -424,15 +427,15 @@ function save_or_mail_results()
424427
$failed_tests_data .= $sep . "PHPINFO" . $sep;
425428
$failed_tests_data .= shell_exec($php . ' -ddisplay_errors=stderr -dhtml_errors=0 -i 2> /dev/null');
426429

427-
if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status)) {
430+
if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status) && !TRAVIS_CI) {
428431
file_put_contents($output_file, $failed_tests_data);
429432

430433
if (!$just_save_results) {
431434
echo "\nThe test script was unable to automatically send the report to PHP's QA Team\n";
432435
}
433436

434437
echo "Please send " . $output_file . " to " . PHP_QA_EMAIL . " manually, thank you.\n";
435-
} else {
438+
} elseif (!getenv('NO_INTERACTION') && !TRAVIS_CI) {
436439
fwrite($fp, "\nThank you for helping to make PHP better.\n");
437440
fclose($fp);
438441
}

travis/compile.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
./buildconf
3+
./configure \
4+
--with-pdo-mysql \
5+
--with-mysql \
6+
--with-mysqli \
7+
--with-pgsql \
8+
--with-pdo-pgsql \
9+
--with-pdo-sqlite \
10+
--enable-intl \
11+
--without-pear \
12+
--with-gd \
13+
--with-jpeg-dir=/usr \
14+
--with-png-dir=/usr \
15+
--enable-exif \
16+
--enable-zip \
17+
--with-zlib \
18+
--with-zlib-dir=/usr \
19+
--with-mcrypt=/usr \
20+
--enable-soap \
21+
--enable-xmlreader \
22+
--with-xsl \
23+
--with-curl=/usr \
24+
--with-tidy \
25+
--with-xmlrpc \
26+
--enable-sysvsem \
27+
--enable-sysvshm \
28+
--enable-shmop \
29+
--enable-pcntl \
30+
--with-readline \
31+
--enable-mbstring \
32+
--with-curl \
33+
--with-gettext \
34+
--enable-sockets \
35+
--with-bz2 \
36+
--enable-bcmath \
37+
--enable-fastcgi \
38+
--with-mime-magic
39+
make

travis/ext/curl/setup.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
export PHP_CURL_HTTP_REMOTE_SERVER="http://localhost"
3+
cd ./ext/curl/tests/responder
4+
sudo php -S localhost:80 &
5+
cd -

travis/ext/mysql/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
mysql -u root -e "CREATE DATABASE IF NOT EXISTS test"

travis/ext/mysqli/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
mysql -u root -e "CREATE DATABASE IF NOT EXISTS test"

travis/ext/pdo_mysql/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
mysql -u root -e "CREATE DATABASE IF NOT EXISTS test"

travis/ext/pdo_pgsql/setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
export PDO_PGSQL_TEST_DSN='pgsql:host=localhost port=5432 dbname=test user=postgres password='

travis/ext/pgsql/setup.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
echo '
3+
<?php $conn_str .= " user=postgres"; ?>' >> "./ext/pgsql/tests/config.inc"
4+
psql -c 'create database test;' -U postgres

0 commit comments

Comments
 (0)