-
Notifications
You must be signed in to change notification settings - Fork 9
/
cgal_docker_args.py
85 lines (73 loc) · 4.46 KB
/
cgal_docker_args.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import logging
import argparse
import sys
import shlex
from os import path
from socket import gethostname
from getpass import getuser
from multiprocessing import cpu_count
from xdg.BaseDirectory import load_first_config, xdg_config_home
class CustomArgumentParser(argparse.ArgumentParser):
def __init__(self, *args, **kwargs):
super(CustomArgumentParser, self).__init__(*args, **kwargs)
def convert_arg_line_to_args(self, line):
return shlex.split(line, comments=True)
def parser():
"""Return the command line argument parser for test_cgal"""
parser = CustomArgumentParser(
description='''This script launches docker containers which run the CGAL testsuite.''',
fromfile_prefix_chars='@')
local_dir = path.dirname(path.realpath(__file__))
# Testing related arguments
parser.add_argument('--images', nargs='*',
help='List of images to launch, defaults to all prefixed with cgal-testsuite')
parser.add_argument('--testsuite', metavar='/path/to/testsuite',
help='Absolute path where the release is going to be stored.',
default=path.abspath(path.join(local_dir, 'testsuite/')))
parser.add_argument('--testresults', metavar='/path/to/testresults',
help='Absolute path where the testresults are going to be stored.',
default=path.abspath(path.join(local_dir, 'testresults/')))
parser.add_argument('--packages', nargs='*',
help='List of package base names to run the tests for. Will always include Installation.'
'e.g. AABB_tree will run AABB_tree, AABB_tree_Examples, and AABB_tree_Demo.')
parser.add_argument('--intel-license', metavar='/path/to/intel-license',
help='Absolute path to a directory containing Intel license files.',
default='/opt/intel/licenses')
parser.add_argument('--mac-address', metavar='92:d0:c6:0a:29:33',
help='Container MAC address. Necessary for newer Intel Licenses.',
default=None)
# Docker related arguments
parser.add_argument('--docker-url', metavar='protocol://hostname/to/docker.sock[:PORT]',
default='unix://var/run/docker.sock',
help='The protocol+hostname+port where the Docker server is hosted.')
parser.add_argument('--force-rm', action='store_true',
help='If a container with the same name already exists, force it to quit')
parser.add_argument('--max-cpus', metavar='N', default=cpu_count(), type=int,
help='The maximum number of CPUs the testsuite is allowed to use at a single time. Defaults to all available cpus.')
parser.add_argument('--container-cpus', metavar='N', default=1, type=int,
help='The number of CPUs a single container should have. Defaults to one.')
parser.add_argument('--jobs', metavar='N', default=None, type=int,
help='The number of jobs a single container is going to launch. Defaults to --container-cpus.')
parser.add_argument('--use-fedora-selinux-policy', action='store_true',
help='Mount volumes with z option to accomodate SELinux on Fedora.')
# Download related arguments
parser.add_argument('--use-local', action='store_true',
help='Use a local extracted CGAL release. --testsuite must be set to that release.')
# TODO make internal releases and latest public?
parser.add_argument('--user', help='Username for CGAL Members')
parser.add_argument('--passwd', help='Password for CGAL Members')
# Upload related arguments
parser.add_argument('--upload-results', action='store_true', help='Actually upload the test results.')
parser.add_argument('--tester', help='The tester', default=getuser())
parser.add_argument('--tester-name', help='The name of the tester', default=gethostname())
parser.add_argument('--tester-address', help='The mail address of the tester')
if load_first_config('CGAL'):
default_arg_file = path.join(load_first_config('CGAL'), 'test_cgal_rc')
else:
default_arg_file = path.join(xdg_config_home, 'test_cgal_rc')
if path.isfile(default_arg_file):
logging.info('Using default arguments from: {}'.format(default_arg_file))
sys.argv.insert(1, '@' + default_arg_file)
return parser
if __name__ == "__main__":
pass