diff options
author | michael-grunder <michael.grunder@gmail.com> | 2018-09-21 08:23:40 +0300 |
---|---|---|
committer | michael-grunder <michael.grunder@gmail.com> | 2018-09-21 08:23:40 +0300 |
commit | bfd274712eeb372926d1106b3da3c4fc19c0a48a (patch) | |
tree | 55c128533bc5269dcba53320fa01c4b18832cc26 /tests | |
parent | 2f694e1089f94078c815a8ec3ce2f86acce843b4 (diff) |
Modify session testing logic
In the event that the test PHP executable has been built with redis
and/or igbinary support built statically, we don't need to try and
find it by adding --no-php-ini and the extension directives themselves.
This fixes the test execution when php has the required extensions
already.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/RedisTest.php | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/tests/RedisTest.php b/tests/RedisTest.php index e021805c..b5da01e8 100644 --- a/tests/RedisTest.php +++ b/tests/RedisTest.php @@ -5663,9 +5663,27 @@ class Redis_Test extends TestSuite if (!$cmd) { $cmd = (getenv('TEST_PHP_EXECUTABLE') ?: (defined('PHP_BINARY') ? PHP_BINARY : 'php')); // PHP_BINARY is 5.4+ - $cmd .= ' '; - $cmd .= (getenv('TEST_PHP_ARGS') ?: '--no-php-ini --define extension=igbinary.so --define extension=' . dirname(__DIR__) . '/modules/redis.so'); + + if ($test_args = getenv('TEST_PHP_ARGS')) { + $cmd .= $test_args; + } else { + /* Only append specific extension directives if PHP hasn't been compiled with what we need statically */ + $result = shell_exec("$cmd --no-php-ini -m"); + $redis = strpos($result, 'redis') !== false; + $igbinary = strpos($result, 'igbinary') !== false; + + if (!$redis || !$igbinary) { + $cmd .= ' --no-php-ini'; + if (!$igbinary) { + $cmd .= ' --define extension=igbinary.so'; + } + if (!$redis) { + $cmd .= ' --define extension=' . dirname(__DIR__) . '/modules/redis.so'; + } + } + } } + return $cmd . ' ' . __DIR__ . '/' . $script . ' '; } } |