From 3966df7fc83093766e5e6862b18b8ef03ef58e09 Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Thu, 26 Apr 2012 07:48:49 -0400 Subject: [PATCH 1/6] Add support for Travis CI --- .travis.yml | 11 +++++++++++ run-tests.php | 15 +++++++++------ travis/compile.sh | 4 ++++ 3 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 .travis.yml create mode 100755 travis/compile.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000000..feff37ecc454 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: php +# We only specify one version so we only get one worker +php: + - 5.4 +# Compile PHP +before_script: + - ./travis/compile.sh +# Return 1 with failed testso +env: REPORT_EXIT_STATUS=1 +# Run PHP's make test +script: make test diff --git a/run-tests.php b/run-tests.php index 2b37ec4f4af6..4af9a4f3a630 100755 --- a/run-tests.php +++ b/run-tests.php @@ -311,6 +311,7 @@ function write_information($show_html) define('PHP_QA_EMAIL', 'qa-reports@lists.php.net'); define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php'); define('QA_REPORTS_PAGE', 'http://qa.php.net/reports'); +define('TRAVIS_CI' , !!getenv('TRAVIS_PHP_VERSION')); function save_or_mail_results() { @@ -318,7 +319,7 @@ function save_or_mail_results() $PHP_FAILED_TESTS, $CUR_DIR, $php, $output_file, $compression; /* We got failed Tests, offer the user to send an e-mail to QA team, unless NO_INTERACTION is set */ - if (!getenv('NO_INTERACTION')) { + if (!getenv('NO_INTERACTION') && !TRAVIS_CI) { $fp = fopen("php://stdin", "r+"); if ($sum_results['FAILED'] || $sum_results['BORKED'] || $sum_results['WARNED'] || $sum_results['LEAKED'] || $sum_results['XFAILED']) { echo "\nYou may have found a problem in PHP."; @@ -335,8 +336,8 @@ function save_or_mail_results() $just_save_results = (strtolower($user_input[0]) == 's'); } - if ($just_save_results || !getenv('NO_INTERACTION')) { - if ($just_save_results || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') { + if ($just_save_results || !getenv('NO_INTERACTION') || TRAVIS_CI) { + if ($just_save_results || TRAVIS_CI || strlen(trim($user_input)) == 0 || strtolower($user_input[0]) == 'y') { /* * Collect information about the host system for our report * Fetch phpinfo() output so that we can see the PHP enviroment @@ -348,7 +349,9 @@ function save_or_mail_results() } /* Ask the user to provide an email address, so that QA team can contact the user */ - if (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { + if (TRAVIS_CI) { + $user_email = 'travis at php dot net'; + } elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { 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): "; flush(); $user_email = trim(fgets($fp, 1024)); @@ -424,7 +427,7 @@ function save_or_mail_results() $failed_tests_data .= $sep . "PHPINFO" . $sep; $failed_tests_data .= shell_exec($php . ' -ddisplay_errors=stderr -dhtml_errors=0 -i 2> /dev/null'); - if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status)) { + if ($just_save_results || !mail_qa_team($failed_tests_data, $compression, $status) && !TRAVIS_CI) { file_put_contents($output_file, $failed_tests_data); if (!$just_save_results) { @@ -432,7 +435,7 @@ function save_or_mail_results() } echo "Please send " . $output_file . " to " . PHP_QA_EMAIL . " manually, thank you.\n"; - } else { + } elseif (!getenv('NO_INTERACTION') && !TRAVIS_CI) { fwrite($fp, "\nThank you for helping to make PHP better.\n"); fclose($fp); } diff --git a/travis/compile.sh b/travis/compile.sh new file mode 100755 index 000000000000..f80cc6bd0b6f --- /dev/null +++ b/travis/compile.sh @@ -0,0 +1,4 @@ +#!/bin/bash +./buildconf +./configure --with-pdo-mysql --with-mysql --with-sqlite --with-pdo-sqlite +make From f15beda158a8fbb16823baf3801409356b79cb4f Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Fri, 27 Apr 2012 10:36:33 -0400 Subject: [PATCH 2/6] Reformat, setup MySQL DB, call run-tests directly --- .travis.yml | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index feff37ecc454..9bc335b05862 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,17 @@ language: php -# We only specify one version so we only get one worker + php: + # We only specify one version so we only get one worker - 5.4 -# Compile PHP + +env: + - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php DB=mysql + before_script: + # Compile PHP - ./travis/compile.sh -# Return 1 with failed testso -env: REPORT_EXIT_STATUS=1 -# Run PHP's make test -script: make test + # Create the MySQL test DB + - mysql -u root -e "CREATE DATABASE test" + +# Run PHPs run-tests.php +script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" From 0fe8b495add557251519050bb94b5dd451d9f7cb Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Fri, 27 Apr 2012 21:27:29 -0400 Subject: [PATCH 3/6] Add extension configs, compile more extensions --- .travis.yml | 10 ++++++--- travis/compile.sh | 39 +++++++++++++++++++++++++++++++++-- travis/ext/mysql/setup.sh | 2 ++ travis/ext/mysqli/setup.sh | 2 ++ travis/ext/pdo_mysql/setup.sh | 2 ++ travis/ext/pdo_pgsql/setup.sh | 2 ++ travis/ext/pgsql/setup.sh | 4 ++++ 7 files changed, 56 insertions(+), 5 deletions(-) create mode 100755 travis/ext/mysql/setup.sh create mode 100755 travis/ext/mysqli/setup.sh create mode 100755 travis/ext/pdo_mysql/setup.sh create mode 100755 travis/ext/pdo_pgsql/setup.sh create mode 100755 travis/ext/pgsql/setup.sh diff --git a/.travis.yml b/.travis.yml index 9bc335b05862..8f61d7fb136b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,13 +5,17 @@ php: - 5.4 env: - - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php DB=mysql + - REPORT_EXIT_STATUS=1 TEST_PHP_EXECUTABLE=./sapi/cli/php before_script: # Compile PHP - ./travis/compile.sh - # Create the MySQL test DB - - mysql -u root -e "CREATE DATABASE test" + # Setup Extensions + - ./travis/ext/mysql/setup.sh + - ./travis/ext/mysqli/setup.sh + - ./travis/ext/pdo_mysql/setup.sh + - ./travis/ext/pgsql/setup.sh + - ./travis/ext/pdo_pgsql/setup.sh # Run PHPs run-tests.php script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" diff --git a/travis/compile.sh b/travis/compile.sh index f80cc6bd0b6f..a0fc167a15bf 100755 --- a/travis/compile.sh +++ b/travis/compile.sh @@ -1,4 +1,39 @@ #!/bin/bash ./buildconf -./configure --with-pdo-mysql --with-mysql --with-sqlite --with-pdo-sqlite -make +./configure \ +--with-pdo-mysql \ +--with-mysql \ +--with-mysqli \ +--with-pgsql \ +--with-pdo-pgsql \ +--with-pdo-sqlite \ +--enable-intl \ +--without-pear \ +--with-gd \ +--with-jpeg-dir=/usr \ +--with-png-dir=/usr \ +--enable-exif \ +--enable-zip \ +--with-zlib \ +--with-zlib-dir=/usr \ +--with-mcrypt=/usr \ +--enable-soap \ +--enable-xmlreader \ +--with-xsl \ +--with-curl=/usr \ +--with-tidy \ +--with-xmlrpc \ +--enable-sysvsem \ +--enable-sysvshm \ +--enable-shmop \ +--enable-pcntl \ +--with-readline \ +--enable-mbstring \ +--with-curl \ +--with-gettext \ +--enable-sockets \ +--with-bz2 \ +--enable-bcmath \ +--enable-fastcgi \ +--with-mime-magic +make \ No newline at end of file diff --git a/travis/ext/mysql/setup.sh b/travis/ext/mysql/setup.sh new file mode 100755 index 000000000000..994fad13766d --- /dev/null +++ b/travis/ext/mysql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/mysqli/setup.sh b/travis/ext/mysqli/setup.sh new file mode 100755 index 000000000000..994fad13766d --- /dev/null +++ b/travis/ext/mysqli/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/pdo_mysql/setup.sh b/travis/ext/pdo_mysql/setup.sh new file mode 100755 index 000000000000..994fad13766d --- /dev/null +++ b/travis/ext/pdo_mysql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mysql -u root -e "CREATE DATABASE IF NOT EXISTS test" diff --git a/travis/ext/pdo_pgsql/setup.sh b/travis/ext/pdo_pgsql/setup.sh new file mode 100755 index 000000000000..6f16f72cc258 --- /dev/null +++ b/travis/ext/pdo_pgsql/setup.sh @@ -0,0 +1,2 @@ +#!/bin/bash +export PDO_PGSQL_TEST_DSN='pgsql:host=localhost port=5432 dbname=test user=postgres password=' \ No newline at end of file diff --git a/travis/ext/pgsql/setup.sh b/travis/ext/pgsql/setup.sh new file mode 100755 index 000000000000..32b39a40443e --- /dev/null +++ b/travis/ext/pgsql/setup.sh @@ -0,0 +1,4 @@ +#!/bin/bash +echo ' +' >> "./ext/pgsql/tests/config.inc" +psql -c 'create database test;' -U postgres \ No newline at end of file From 3db6d59a63b3ad4c76cb489a228e8ea40387996f Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Fri, 27 Apr 2012 23:53:24 -0400 Subject: [PATCH 4/6] Source all extension scripts for ENV vars --- .travis.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8f61d7fb136b..c51a332f40ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,11 +11,11 @@ before_script: # Compile PHP - ./travis/compile.sh # Setup Extensions - - ./travis/ext/mysql/setup.sh - - ./travis/ext/mysqli/setup.sh - - ./travis/ext/pdo_mysql/setup.sh - - ./travis/ext/pgsql/setup.sh - - ./travis/ext/pdo_pgsql/setup.sh + - . ./travis/ext/mysql/setup.sh + - . ./travis/ext/mysqli/setup.sh + - . ./travis/ext/pdo_mysql/setup.sh + - . ./travis/ext/pgsql/setup.sh + - . ./travis/ext/pdo_pgsql/setup.sh # Run PHPs run-tests.php script: ./sapi/cli/php run-tests.php -g "FAIL,XFAIL,BORK,WARN,LEAK,SKIP" From e2ebe6ce4ed9b149143949008f930007dfcb855f Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Fri, 27 Apr 2012 23:53:53 -0400 Subject: [PATCH 5/6] Add curl extension config, uses cli-server to test --- travis/ext/curl/setup.sh | 5 +++++ 1 file changed, 5 insertions(+) create mode 100755 travis/ext/curl/setup.sh diff --git a/travis/ext/curl/setup.sh b/travis/ext/curl/setup.sh new file mode 100755 index 000000000000..74dad16eb35b --- /dev/null +++ b/travis/ext/curl/setup.sh @@ -0,0 +1,5 @@ +#!/bin/bash +export PHP_CURL_HTTP_REMOTE_SERVER="http://localhost" +cd ./ext/curl/tests/responder +sudo php -S localhost:80 & +cd - \ No newline at end of file From 5ef46fe43c25996a8fd6eb8c513e4114569d79b6 Mon Sep 17 00:00:00 2001 From: Davey Shafik Date: Mon, 28 May 2012 06:18:44 -0400 Subject: [PATCH 6/6] Fix boolean casting and whitespace (@dsp / #68) --- run-tests.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/run-tests.php b/run-tests.php index 4af9a4f3a630..753e1ddc0236 100755 --- a/run-tests.php +++ b/run-tests.php @@ -311,7 +311,7 @@ function write_information($show_html) define('PHP_QA_EMAIL', 'qa-reports@lists.php.net'); define('QA_SUBMISSION_PAGE', 'http://qa.php.net/buildtest-process.php'); define('QA_REPORTS_PAGE', 'http://qa.php.net/reports'); -define('TRAVIS_CI' , !!getenv('TRAVIS_PHP_VERSION')); +define('TRAVIS_CI' , (bool) getenv('TRAVIS_PHP_VERSION')); function save_or_mail_results() { @@ -349,9 +349,9 @@ function save_or_mail_results() } /* Ask the user to provide an email address, so that QA team can contact the user */ - if (TRAVIS_CI) { - $user_email = 'travis at php dot net'; - } elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { + if (TRAVIS_CI) { + $user_email = 'travis at php dot net'; + } elseif (!strncasecmp($user_input, 'y', 1) || strlen(trim($user_input)) == 0) { 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): "; flush(); $user_email = trim(fgets($fp, 1024));