1
- #!/usr/bin/env python2.7
1
+ #!/usr/bin/env python
2
2
3
3
import os
4
4
import sys
12
12
13
13
from pprint import pprint
14
14
15
+ PHPUNIT_PHAR = 'phpunit.phar'
16
+
15
17
def read_popen (cmd ):
16
18
path = subprocess .Popen (cmd , shell = True , stdout = subprocess .PIPE )
17
19
path .wait ()
@@ -22,7 +24,7 @@ def read_popen_config(cmd):
22
24
return read_popen (cmd )
23
25
24
26
def find_php_bin ():
25
- path = read_popen ('which php' ).strip ()
27
+ path = read_popen ('which php' ).strip (). decode ()
26
28
if (path .find ('phpenv' ) != - 1 ):
27
29
version = read_popen ('phpenv global' )
28
30
if (version .find ('system' ) != - 1 ):
@@ -37,7 +39,7 @@ def prepare_env(php_ini):
37
39
os .mkdir ('var' )
38
40
shutil .copy ('test/shared/phpunit.xml' , 'var' )
39
41
test_dir_path = os .path .abspath (os .path .join (os .getcwd (), 'test' ))
40
- test_lib_path = os .path .join (test_dir_path , 'phpunit.phar' )
42
+ test_lib_path = os .path .join (test_dir_path , PHPUNIT_PHAR )
41
43
# shutil.copy('test/shared/tarantool.ini', 'var')
42
44
shutil .copy (php_ini , 'var' )
43
45
shutil .copy ('modules/tarantool.so' , 'var' )
@@ -60,10 +62,10 @@ def main():
60
62
try :
61
63
shutil .copy ('test/shared/phpunit.xml' , os .path .join (test_cwd , 'phpunit.xml' ))
62
64
shutil .copy ('modules/tarantool.so' , test_cwd )
63
- test_lib_path = os .path .join (test_dir_path , 'phpunit.phar' )
65
+ test_lib_path = os .path .join (test_dir_path , PHPUNIT_PHAR )
64
66
65
- version = read_popen_config ('--version' ).strip (' \n \t ' ) + '.'
66
- version1 = read_popen_config ('--extension-dir' ).strip (' \n \t ' )
67
+ version = read_popen_config ('--version' ).decode (). strip (' \n \t ' ) + '.'
68
+ version1 = read_popen_config ('--extension-dir' ).decode (). strip (' \n \t ' )
67
69
version += '\n ' + ('With' if version1 .find ('non-zts' ) == - 1 else 'Without' ) + ' ZTS'
68
70
version += '\n ' + ('With' if version1 .find ('no-debug' ) == - 1 else 'Without' ) + ' Debug'
69
71
print ('Running against ' + version )
@@ -100,9 +102,9 @@ def main():
100
102
cmd = cmd + 'sudo dtruss ' + find_php_bin ()
101
103
cmd = cmd + ' -c tarantool.ini {0}' .format (test_lib_path )
102
104
else :
103
- print find_php_bin ()
105
+ print ( find_php_bin () )
104
106
cmd = '{0} -c tarantool.ini {1}' .format (find_php_bin (), test_lib_path )
105
- print cmd
107
+ print ( cmd )
106
108
107
109
print ('Running "%s" with "%s"' % (cmd , php_ini ))
108
110
proc = subprocess .Popen (cmd , shell = True , cwd = test_cwd )
0 commit comments