Created
April 9, 2020 01:00
-
-
Save lauromoura/e8352a2c78945c86dbab114d46974bc6 to your computer and use it in GitHub Desktop.
Script to try to run multiple WTR in parallel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import os | |
import sys | |
import argparse | |
from multiprocessing import Pool | |
def parse_args(): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--processes', '-p', type=int, default=5, help='Maximum number of parallel processes') | |
parser.add_argument('--number', '-n', type=int, default=5, help='Number of tests to be run') | |
parser.add_argument('webkitdir', help='WebKit root directory') | |
parser.add_argument('test', help='Test case file') | |
return parser.parse_args() | |
def run_process(data): | |
i, command = data | |
print(f"Maestro: Starting job {i}") | |
os.system(command) | |
def main(): | |
args = parse_args() | |
basepath = args.webkitdir | |
testcase = args.test | |
processes = args.processes | |
number = args.number | |
webkitbuild = os.path.join(basepath, 'WebKitBuild') | |
jhbuild_wrapper = os.path.join(basepath, 'Tools', 'jhbuild', 'jhbuild-wrapper') | |
wtr_exec = os.path.join(basepath, 'WebKitBuild', 'Debug', 'bin', 'WebKitTestRunner') | |
os.environ['TEST_RUNNER_INJECTED_BUNDLE_FILENAME'] = os.path.join(basepath, 'WebKitBuild', 'Debug', 'lib', 'libTestRunnerInjectedBundle.so') | |
command = f'{jhbuild_wrapper} --wpe run {wtr_exec} {testcase}' | |
pool = Pool(processes=processes) | |
pool.map(run_process, [(i, command) for i in range(number)]) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment