test-backend: Change --parallel default to use `cpu_count`.

The number of processes to run the backend tests is currently a
hardcoded value, this commit transistions the default to be based on the
number of logical CPUs available.
This commit is contained in:
Wyatt Hoodes 2019-04-30 10:33:03 -10:00 committed by Tim Abbott
parent 4ea5fea8a1
commit 21c67ea1c2
1 changed files with 4 additions and 2 deletions

View File

@ -187,6 +187,8 @@ def main() -> None:
os.chdir(os.path.dirname(TOOLS_DIR)) os.chdir(os.path.dirname(TOOLS_DIR))
sys.path.insert(0, os.path.dirname(TOOLS_DIR)) sys.path.insert(0, os.path.dirname(TOOLS_DIR))
default_parallel = os.cpu_count()
# Remove proxy settings for running backend tests # Remove proxy settings for running backend tests
os.environ["http_proxy"] = "" os.environ["http_proxy"] = ""
os.environ["https_proxy"] = "" os.environ["https_proxy"] = ""
@ -227,9 +229,9 @@ def main() -> None:
parser.add_argument('--parallel', dest='processes', parser.add_argument('--parallel', dest='processes',
type=int, type=int,
action='store', action='store',
default=4, default=default_parallel,
help='Specify the number of processes to run the ' help='Specify the number of processes to run the '
'tests in. Default is 4.') 'tests in. Default is the number of logical CPUs')
parser.add_argument('--profile', dest='profile', parser.add_argument('--profile', dest='profile',
action="store_true", action="store_true",
default=False, help='Profile test runtime.') default=False, help='Profile test runtime.')