Adding a few more functions to get php version, driver version, msodbcsql version
This commit is contained in:
parent
0ce6fc52a2
commit
1e3c1c8dcc
|
@ -54,11 +54,13 @@ class XMLResult( object ):
|
||||||
, success = None
|
, success = None
|
||||||
, duration = None
|
, duration = None
|
||||||
, memory = None
|
, memory = None
|
||||||
|
, iterations = None
|
||||||
, error_message = None ):
|
, error_message = None ):
|
||||||
self.benchmark_name = benchmark_name
|
self.benchmark_name = benchmark_name
|
||||||
self.success = success
|
self.success = success
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
self.memory = memory
|
self.memory = memory
|
||||||
|
self.iterations = iterations
|
||||||
self.error_message = error_message
|
self.error_message = error_message
|
||||||
|
|
||||||
def get_test_name( name ):
|
def get_test_name( name ):
|
||||||
|
@ -242,6 +244,11 @@ def get_php_arch():
|
||||||
elif out.decode('ascii') == "4":
|
elif out.decode('ascii') == "4":
|
||||||
return "x86"
|
return "x86"
|
||||||
|
|
||||||
|
def get_php_version():
|
||||||
|
p = subprocess.Popen( "php -r 'echo phpversion();'", stdout=subprocess.PIPE, shell = True )
|
||||||
|
out, err = p.communicate()
|
||||||
|
return out.decode('ascii')
|
||||||
|
|
||||||
def get_php_thread():
|
def get_php_thread():
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
command = "php -i | findstr 'Thread'"
|
command = "php -i | findstr 'Thread'"
|
||||||
|
@ -254,6 +261,19 @@ def get_php_thread():
|
||||||
else:
|
else:
|
||||||
return "ts"
|
return "ts"
|
||||||
|
|
||||||
|
def get_driver_version( driver_name ):
|
||||||
|
command = "php -r \"echo phpversion('{0}');\""
|
||||||
|
print(command.format( driver_name ))
|
||||||
|
p = subprocess.Popen( command.format( driver_name ), stdout=subprocess.PIPE, shell = True )
|
||||||
|
out, err = p.communicate()
|
||||||
|
return out.decode('ascii')
|
||||||
|
|
||||||
|
def get_msodbcsql_version( test_db ):
|
||||||
|
command = "php -r \"echo sqlsrv_client_info( sqlsrv_connect( '{0}', array( 'UID'=>'{1}', 'PWD'=>'{2}')))['DriverName'];\""
|
||||||
|
p = subprocess.Popen( command.format( test_db.server_name, test_db.username, test_db.password ), stdout=subprocess.PIPE, shell = True )
|
||||||
|
out, err = p.communicate()
|
||||||
|
return out.decode('ascii')
|
||||||
|
|
||||||
def get_path_to_driver( driver_name ):
|
def get_path_to_driver( driver_name ):
|
||||||
p = subprocess.Popen( "php -r \"echo ini_get('extension_dir');\"", stdout=subprocess.PIPE, shell = True )
|
p = subprocess.Popen( "php -r \"echo ini_get('extension_dir');\"", stdout=subprocess.PIPE, shell = True )
|
||||||
out, err = p.communicate()
|
out, err = p.communicate()
|
||||||
|
@ -309,17 +329,18 @@ def disable_pooling():
|
||||||
|
|
||||||
def run_tests( iterations, iterations_large ):
|
def run_tests( iterations, iterations_large ):
|
||||||
print("Running the tests...")
|
print("Running the tests...")
|
||||||
call( get_run_command( sqlsrv_regular_path, iterations, "sqlsrv-regular.xml" ), shell=True, stdout=open( os.devnull, 'wb' ))
|
call( get_run_command( sqlsrv_regular_path, iterations, "sqlsrv-regular.xml" ), shell=True )
|
||||||
call( get_run_command( sqlsrv_large_path, iterations_large, "sqlsrv-large.xml" ), shell=True, stdout=open( os.devnull, 'wb' ))
|
call( get_run_command( sqlsrv_large_path, iterations_large, "sqlsrv-large.xml" ), shell=True )
|
||||||
|
|
||||||
call( get_run_command( pdo_regular_path, iterations, "pdo_sqlsrv-regular.xml" ), shell=True, stdout=open( os.devnull, 'wb' ))
|
call( get_run_command( pdo_regular_path, iterations, "pdo_sqlsrv-regular.xml" ), shell=True )
|
||||||
call( get_run_command( pdo_large_path, iterations_large, "pdo_sqlsrv-large.xml" ), shell=True, stdout=open( os.devnull, 'wb' ))
|
call( get_run_command( pdo_large_path, iterations_large, "pdo_sqlsrv-large.xml" ), shell=True )
|
||||||
|
|
||||||
def parse_results( dump_file ):
|
def parse_results( dump_file ):
|
||||||
xml_results = []
|
xml_results = []
|
||||||
tree = ET.parse( dump_file )
|
tree = ET.parse( dump_file )
|
||||||
root = tree.getroot()
|
root = tree.getroot()
|
||||||
for benchmark in root[0].findall( 'benchmark' ):
|
benchmarks = root[0].findall( 'benchmark' )
|
||||||
|
for benchmark in benchmarks:
|
||||||
xml_result = XMLResult()
|
xml_result = XMLResult()
|
||||||
xml_result.benchmark_name = benchmark.get( 'class' )[1:]
|
xml_result.benchmark_name = benchmark.get( 'class' )[1:]
|
||||||
errors = benchmark[0][0].find( 'errors' )
|
errors = benchmark[0][0].find( 'errors' )
|
||||||
|
@ -329,8 +350,10 @@ def parse_results( dump_file ):
|
||||||
else:
|
else:
|
||||||
xml_result.success = 1
|
xml_result.success = 1
|
||||||
xml_result.duration = int( round( int( benchmark[0][0].find( 'stats' ).get( 'sum' )) / 1000000 ))
|
xml_result.duration = int( round( int( benchmark[0][0].find( 'stats' ).get( 'sum' )) / 1000000 ))
|
||||||
|
iterations = benchmark[0][0].findall( 'iteration' )
|
||||||
|
xml_result.iterations = len( iterations )
|
||||||
memory_peak = 0
|
memory_peak = 0
|
||||||
for iteration in benchmark[0][0].findall( 'iteration' ):
|
for iteration in iterations:
|
||||||
iter_memory_peak = int( iteration.get( 'mem-peak' ))
|
iter_memory_peak = int( iteration.get( 'mem-peak' ))
|
||||||
if iter_memory_peak > memory_peak:
|
if iter_memory_peak > memory_peak:
|
||||||
memory_peak = iter_memory_peak
|
memory_peak = iter_memory_peak
|
||||||
|
@ -347,8 +370,13 @@ def parse_and_store_results( dump_file, test_db, result_db, platform, driver, st
|
||||||
team_id = get_team_id( conn )
|
team_id = get_team_id( conn )
|
||||||
driver_id = get_driver_id( conn, driver )
|
driver_id = get_driver_id( conn, driver )
|
||||||
|
|
||||||
arch = get_php_arch()
|
|
||||||
thread = get_php_thread()
|
php_arch = get_php_arch()
|
||||||
|
php_thread = get_php_thread()
|
||||||
|
php_version = get_php_version()
|
||||||
|
driver_version = get_driver_version( driver )
|
||||||
|
msodbcsql_version = get_msodbcsql_version( test_db )
|
||||||
|
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
results = parse_results( dump_file )
|
results = parse_results( dump_file )
|
||||||
|
|
||||||
|
@ -360,6 +388,7 @@ def parse_and_store_results( dump_file, test_db, result_db, platform, driver, st
|
||||||
if result.success:
|
if result.success:
|
||||||
insert_key_value( conn, "KeyValueTableBigInt", result_id, "duration", result.duration )
|
insert_key_value( conn, "KeyValueTableBigInt", result_id, "duration", result.duration )
|
||||||
insert_key_value( conn, "KeyValueTableBigInt", result_id, "memory", result.memory )
|
insert_key_value( conn, "KeyValueTableBigInt", result_id, "memory", result.memory )
|
||||||
|
insert_key_value( conn, "KeyValueTableBigInt", result_id, "iterations", result.iterations)
|
||||||
else:
|
else:
|
||||||
insert_key_value( conn, "KeyValueTableString", result_id, "error", result.error_message )
|
insert_key_value( conn, "KeyValueTableString", result_id, "error", result.error_message )
|
||||||
|
|
||||||
|
@ -367,9 +396,11 @@ def parse_and_store_results( dump_file, test_db, result_db, platform, driver, st
|
||||||
insert_key_value( conn, "KeyValueTableBigInt", result_id, "mars" , mars )
|
insert_key_value( conn, "KeyValueTableBigInt", result_id, "mars" , mars )
|
||||||
insert_key_value( conn, "KeyValueTableBigInt", result_id, "pooling" , pooling )
|
insert_key_value( conn, "KeyValueTableBigInt", result_id, "pooling" , pooling )
|
||||||
insert_key_value( conn, "KeyValueTableString", result_id, "driver" , driver )
|
insert_key_value( conn, "KeyValueTableString", result_id, "driver" , driver )
|
||||||
insert_key_value( conn, "KeyValueTableString", result_id, "arch" , arch )
|
insert_key_value( conn, "KeyValueTableString", result_id, "php_arch" , php_arch )
|
||||||
insert_key_value( conn, "KeyValueTableString", result_id, "os" , platform )
|
insert_key_value( conn, "KeyValueTableString", result_id, "os" , platform )
|
||||||
insert_key_value( conn, "KeyValueTableString", result_id, "thread" , thread )
|
insert_key_value( conn, "KeyValueTableString", result_id, "php_thread" , php_thread )
|
||||||
|
insert_key_value( conn, "KeyValueTableString", result_id, "php_version", php_version )
|
||||||
|
insert_key_value( conn, "KeyValueTableString", result_id, "msodbcsql" , msodbcsql_version )
|
||||||
|
|
||||||
def parse_and_store_results_all( test_db, result_db, platform, start_time, mars, pooling ):
|
def parse_and_store_results_all( test_db, result_db, platform, start_time, mars, pooling ):
|
||||||
print("Parsing and storing the results...")
|
print("Parsing and storing the results...")
|
||||||
|
@ -414,3 +445,4 @@ if __name__ == '__main__':
|
||||||
parse_and_store_results_all( test_db, result_db, args.PLATFORM, start_time, 0, 1 )
|
parse_and_store_results_all( test_db, result_db, args.PLATFORM, start_time, 0, 1 )
|
||||||
disable_pooling()
|
disable_pooling()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue