Started adding documentation to run-pref_test.py
This commit is contained in:
parent
c0aabee4f1
commit
224c3651ae
|
@ -1,3 +1,11 @@
|
|||
#!/usr/bin/python3
|
||||
"""
|
||||
Description: This script intended to run the Performance Tests on Windows, Linux and Mac.
|
||||
Requirements:
|
||||
Run setup_env_unix.sh( Linux and Mac ) or setup_env_windows.ps1( Windows ) before invoking this script.
|
||||
modify lib/connect.php with the credentials to connect to the test database.
|
||||
"""
|
||||
|
||||
import shutil
|
||||
from shutil import copyfile
|
||||
import os
|
||||
|
@ -15,16 +23,36 @@ import datetime
|
|||
import time
|
||||
from time import strftime
|
||||
import hashlib
|
||||
|
||||
sqlsrv_regular_path = "benchmark"+ os.sep + "sqlsrv" + os.sep + "regular"
|
||||
sqlsrv_large_path = "benchmark"+ os.sep + "sqlsrv" + os.sep + "large"
|
||||
pdo_regular_path = "benchmark"+ os.sep + "pdo_sqlsrv" + os.sep + "regular"
|
||||
pdo_large_path = "benchmark"+ os.sep + "pdo_sqlsrv" + os.sep + "large"
|
||||
|
||||
"""
|
||||
Paths to current benchmarks. These constants should be modified if there are any changes in folder structure of the project. "regular" folder contains the benchmarks that can be run for any iterations. "large" folder contains the benchmarks ( currently the benchmark that fetches large amount of data ) that take long time to run and meant to have less number of iterations than the regular ones.
|
||||
"""
|
||||
|
||||
sqlsrv_regular_path = "benchmark" + os.sep + "sqlsrv" + os.sep + "regular"
|
||||
sqlsrv_large_path = "benchmark" + os.sep + "sqlsrv" + os.sep + "large"
|
||||
pdo_regular_path = "benchmark" + os.sep + "pdo_sqlsrv" + os.sep + "regular"
|
||||
pdo_large_path = "benchmark" + os.sep + "pdo_sqlsrv" + os.sep + "large"
|
||||
|
||||
"""
|
||||
Path to the connect.php file that contains test database credentials. Note that, the benchmarks are ran against this database and it is different from Result database.
|
||||
"""
|
||||
connect_file = "lib" + os.sep + "connect.php"
|
||||
connect_file_bak = connect_file + ".bak"
|
||||
|
||||
"""
|
||||
Global data format used across the script
|
||||
"""
|
||||
fmt = "%Y-%m-%d %H:%M:%S.0000000"
|
||||
|
||||
|
||||
def validate_platform( platform_name ):
|
||||
"""
|
||||
This module validates the platform name passed in to the script as an argument.
|
||||
If no match, the script will stop the execution.
|
||||
Args:
|
||||
platform_name (str): Platform name to validate
|
||||
Returns:
|
||||
N/A
|
||||
"""
|
||||
platforms = [
|
||||
"Windows10"
|
||||
, "WidnowsServer2016"
|
||||
|
@ -38,6 +66,14 @@ def validate_platform( platform_name ):
|
|||
exit( 1 )
|
||||
|
||||
class DB( object ):
|
||||
"""
|
||||
A class to keep database credentials
|
||||
Attributes:
|
||||
server_name (str): The name or the IP address of the server.
|
||||
database_name (str): The name of the database
|
||||
username (str): Database username
|
||||
password (str): Database password for username
|
||||
"""
|
||||
def __init__ ( self
|
||||
, server_name = None
|
||||
, database_name = None
|
||||
|
@ -49,6 +85,16 @@ class DB( object ):
|
|||
self.password = password
|
||||
|
||||
class XMLResult( object ):
|
||||
"""
|
||||
A class to keep a result set of a benchmark generated by PHPBench as an XML file.
|
||||
Attributes:
|
||||
benchmark_name (str): The name or the benchmark.
|
||||
success (int): 0 or 1. 0 if the benchmark to execute, 1 if the execution was successful.
|
||||
duration (int,optional): In case of success, time taken to run the benchmark.
|
||||
memory (int, optional): In case of success, memory peak when executing the benchmark.
|
||||
iterations(int, optional): In case of success, number of iterations the benchmark was ran for.
|
||||
error_message(str, optional): In case of failure, descriptive error message.
|
||||
"""
|
||||
def __init__ ( self
|
||||
, benchmark_name = None
|
||||
, success = None
|
||||
|
|
Loading…
Reference in a new issue