Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_runner.py
Show First 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | |||||
def main(): | def main(): | ||||
# Read config generated by configure. | # Read config generated by configure. | ||||
config = configparser.ConfigParser() | config = configparser.ConfigParser() | ||||
configfile = os.path.join(os.path.abspath( | configfile = os.path.join(os.path.abspath( | ||||
os.path.dirname(__file__)), "..", "config.ini") | os.path.dirname(__file__)), "..", "config.ini") | ||||
config.read_file(open(configfile)) | config.read_file(open(configfile)) | ||||
src_dir = config["environment"]["SRCDIR"] | src_dir = config["environment"]["SRCDIR"] | ||||
if 'SRCDIR' in os.environ: | |||||
src_dir = os.environ['SRCDIR'] | |||||
else: | |||||
# Setup SRCDIR env since subprocesses can't find it properly without the env. | |||||
os.environ['SRCDIR'] = src_dir | |||||
build_dir = config["environment"]["BUILDDIR"] | build_dir = config["environment"]["BUILDDIR"] | ||||
tests_dir = os.path.join(src_dir, 'test', 'functional') | tests_dir = os.path.join(src_dir, 'test', 'functional') | ||||
# Parse arguments and pass through unrecognised args | # Parse arguments and pass through unrecognised args | ||||
parser = argparse.ArgumentParser(add_help=False, | parser = argparse.ArgumentParser(add_help=False, | ||||
usage='%(prog)s [test_runner.py options] [script options] [scripts]', | usage='%(prog)s [test_runner.py options] [script options] [scripts]', | ||||
description=__doc__, | description=__doc__, | ||||
epilog=''' | epilog=''' | ||||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | def handle_update_messages(): | ||||
if printed_status: | if printed_status: | ||||
print() | print() | ||||
printed_status = False | printed_status = False | ||||
handle_message(message, running_jobs) | handle_message(message, running_jobs) | ||||
update_queue.task_done() | update_queue.task_done() | ||||
except Empty as e: | except Empty as e: | ||||
if not on_ci(): | if not on_ci(): | ||||
print("Running jobs: {}".format(", ".join(running_jobs)), end="\r") | print("Running jobs: {}".format( | ||||
", ".join(running_jobs)), end="\r") | |||||
sys.stdout.flush() | sys.stdout.flush() | ||||
printed_status = True | printed_status = True | ||||
def handle_test_cases(): | def handle_test_cases(): | ||||
""" | """ | ||||
job_runner represents a single thread that is part of a worker pool. | job_runner represents a single thread that is part of a worker pool. | ||||
It waits for a test, then executes that test. | It waits for a test, then executes that test. | ||||
It also reports start and result messages to handle_update_messages | It also reports start and result messages to handle_update_messages | ||||
▲ Show 20 Lines • Show All 288 Lines • Show Last 20 Lines |