File tree Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Expand file tree Collapse file tree 2 files changed +23
-17
lines changed Original file line number Diff line number Diff line change 38
38
from tools .paths import UBLOX_LIBRARY
39
39
from tools .tests import TESTS , Test , TEST_MAP
40
40
from tools .tests import TEST_MBED_LIB
41
+ from tools .tests import test_known , test_name_known
41
42
from tools .targets import TARGET_MAP
42
43
from tools .options import get_default_options_parser
43
44
from tools .build_api import build_project
44
45
from tools .build_api import mcu_toolchain_matrix
45
46
from utils import argparse_filestring_type
46
47
from argparse import ArgumentTypeError
47
- try :
48
- import tools .private_settings as ps
49
- except :
50
- ps = object ()
51
-
52
- def test_known (string ):
53
- i = int (string )
54
- if i >= 0 and i < len (TESTS ) : return i
55
- else : raise ArgumentTypeError ("{0} does not index a test" .format (i ))
56
-
57
- def test_name_known (string ):
58
- nlist = string .split (',' )
59
- for test_id in nlist :
60
- if test_id not in TEST_MAP .keys ():
61
- raise ArgumentTypeError ("Program with name '%s' not found" % test_id )
62
-
63
- return [TEST_MAP [n ].n for n in nlist ]
64
48
65
49
if __name__ == '__main__' :
66
50
# Parse Options
Original file line number Diff line number Diff line change 16
16
"""
17
17
from tools .paths import *
18
18
from tools .data .support import *
19
+ from argparse import ArgumentTypeError
20
+
21
+ try :
22
+ import tools .private_settings as ps
23
+ except :
24
+ ps = object ()
19
25
20
26
TEST_CMSIS_LIB = join (TEST_DIR , "cmsis" , "lib" )
21
27
TEST_MBED_LIB = join (TEST_DIR , "mbed" , "env" )
@@ -1212,3 +1218,19 @@ def __getitem__(self, key):
1212
1218
return None
1213
1219
1214
1220
TEST_MAP = dict ([(test ['id' ], Test (i )) for i , test in enumerate (TESTS )])
1221
+
1222
+ # parser helpers
1223
+ def test_known (string ):
1224
+ i = int (string )
1225
+ if i >= 0 and i < len (TESTS ) : return i
1226
+ else : raise ArgumentTypeError ("{0} does not index a test" .format (i ))
1227
+
1228
+ def test_name_known (string ):
1229
+ nlist = string .split (',' )
1230
+ for test_id in nlist :
1231
+ if test_id not in TEST_MAP .keys ():
1232
+ if getattr (ps , "test_alias" , None ) is None or \
1233
+ ps .test_alias .get (test_id , "" ) not in TEST_MAP .keys ():
1234
+ raise ArgumentTypeError ("Program with name '%s' not found" % test_id )
1235
+
1236
+ return [TEST_MAP [n ].n for n in nlist ]
You can’t perform that action at this time.
0 commit comments