Permalink
Browse files

Improve the traivs test script

  • Loading branch information...
1 parent 8d767ce commit 27d712e941674f5eb45677aafef887420b50cdad @laruence laruence committed Apr 19, 2013
Showing with 33 additions and 12 deletions.
  1. +1 −0 .travis.yml
  2. +32 −12 .travis/run-test.sh
View
@@ -8,6 +8,7 @@ php:
before_script:
- phpize
- ./configure --enable-opcache
+ - make clean
- make
script:
View
@@ -1,26 +1,46 @@
#!/bin/sh
-PHP_VERSION=`php-config --version`
+PHP_VERSION=`php-config --vernum`
+php-config --configure-options | grep "enable-debug" >/dev/null
+php_debug=$?
+php_zts=`php -r "echo PHP_ZTS;"`
+TEST_DIR="`pwd`/tests"
export TEST_PHP_EXECUTABLE=`which php`
-if [ "$PHP_VERSION" = "`echo -e "$PHP_VERSION\n5.3.0" | sort -n | head -n1`" ]
+if [ $PHP_VERSION -lt 50300 ]
then
- export TEST_PHP_ARGS="-n -d zend_extension_debug=`pwd`/modules/opcache.so"
+ if [ $php_debug -eq 0 ]
+ then
+ if [ $php_zts -eq 1 ]
+ then
+ export TEST_PHP_ARGS="-d zend_extension_debug_ts=`pwd`/modules/opcache.so"
+ else
+ export TEST_PHP_ARGS="-d zend_extension_debug=`pwd`/modules/opcache.so"
+ fi
+ else
+ export TEST_PHP_ARGS="-d zend_extension=`pwd`/modules/opcache.so"
+ fi
else
- export TEST_PHP_ARGS="-n -d zend_extension=`pwd`/modules/opcache.so"
+ export TEST_PHP_ARGS="-d zend_extension=`pwd`/modules/opcache.so"
fi
-$TEST_PHP_EXECUTABLE run-tests.php tests/*.phpt
+$TEST_PHP_EXECUTABLE run-tests.php -n tests/*.phpt $TEST_DIR
-ls tests/*.diff 1>/dev/null 2>&1
-ret_code=$?
+for file in `find $TEST_DIR -name "*.diff" 2>/dev/null`
+do
+ grep "\-\-XFAIL--" ${file/%".diff"/".phpt"} >/dev/null 2>&1
+ if [ $? -gt 0 ]
+ then
+ FAILS[${#FAILS[@]}]="$file"
+ fi
+done
-tests/*.mem 1>/dev/null 2>&1
-ret_code=$(($ret_code & $?))
-
-if [ $ret_code -eq 0 ]
+if [ ${#FAILS[@]} -gt 0 ]
then
- find tests -name "*.diff" -or -name "*.mem" | xargs -i sh -xc "cat {}"
+ for fail in "${FAILS[@]}"
+ do
+ sh -xc "cat $fail"
+ done
exit 1
else
exit 0

0 comments on commit 27d712e

Please sign in to comment.