source: trunk/run-xcachetest

Last change on this file was 1573, checked in by moo, 12 days ago

fix tests for older php

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.7 KB
Line 
1#!/bin/sh
2
3getAbsolutePath() {
4    which readlink >/dev/null 2>&1 && readlink -f "$@" || echo "$@"
5}
6
7# use symlink first
8if test -x ./php-cli ; then
9    php_cli=`getAbsolutePath ./php-cli`
10elif test ! -z "$TEST_PHP_EXECUTABLE" && test -x "$TEST_PHP_EXECUTABLE"; then
11    php_cli="$TEST_PHP_EXECUTABLE"
12else
13    php_cli="`which php`"
14fi
15
16test_args="-c \"$TEST_INI\""' -d "open_basedir=" -d "safe_mode=0" -d "output_buffering=0" -d "memory_limit=-1"'
17
18if test -x ./php-cgi ; then
19    php_cgi=`getAbsolutePath ./php-cgi`
20else
21    php_cgi="`which php-cgi`"
22fi
23
24echo '#!/bin/sh' > ./php-cli-test
25echo 'exec "'$php_cli'" '$test_args' "$@"' >> php-cli-test
26chmod +x ./php-cli-test
27
28echo '#!/bin/sh' > ./php-cgi-test
29echo 'exec "'$php_cgi'" '$test_args' "$@"' >> php-cgi-test
30chmod +x ./php-cgi-test
31
32TEST_PHP_EXECUTABLE=`getAbsolutePath ./php-cli-test`
33TEST_PHP_CGI_EXECUTABLE=`getAbsolutePath ./php-cgi-test`
34real_php_src=`getAbsolutePath ./php-src`;
35test -z "$TEST_PHP_SRCDIR" && TEST_PHP_SRCDIR=$real_php_src
36
37export TEST_PHP_EXECUTABLE
38export TEST_PHP_CGI_EXECUTABLE
39export TEST_PHP_SRCDIR
40
41echo "XCache test running with:"
42echo "TEST_PHP_CGI_EXECUTABLE: $TEST_PHP_CGI_EXECUTABLE"
43echo "TEST_PHP_EXECUTABLE:     $TEST_PHP_EXECUTABLE"
44echo "TEST_PHP_SRCDIR:         $TEST_PHP_SRCDIR"
45
46patch_run_tests_ext() {
47    if test -z "$TEST_EXT" ; then
48        sed "s#'ext',##g"
49    else
50        cat
51    fi
52}
53patch_run_tests_report_leaks() {
54    if test -z "$TEST_REPORT_MEMLEAKS" ; then
55        sed "s#'report_memleaks=1',#'report_memleaks=0',#g"
56    else
57        cat
58    fi
59}
60run_tests_src=$real_php_src/run-tests.php
61patch_run_tests_ext < "$run_tests_src" | sed "s#^\\\$test_dirs = array('.*#\\\$test_dirs = array();#" | patch_run_tests_report_leaks > run-tests.php
62exec "$TEST_PHP_EXECUTABLE" `getAbsolutePath ./run-tests.php` "$@"
Note: See TracBrowser for help on using the repository browser.