Skip to content

Commit 38eb79e

Browse files
committed
Merge pull request #86 from pbrier/master
Issue #84 - Added command line source/build directory option
2 parents 792c7f2 + 8fd42e5 commit 38eb79e

File tree

1 file changed

+44
-3
lines changed

1 file changed

+44
-3
lines changed

workspace_tools/make.py

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
if __name__ == '__main__':
4343
# Parse Options
4444
parser = get_default_options_parser()
45-
parser.add_option("-p", type="int", dest="program",
45+
parser.add_option("-p", type="int", dest="program", default=-1,
4646
help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
4747
parser.add_option("-n", dest="program_name",
4848
help="The name of the desired test program")
@@ -52,6 +52,22 @@
5252
help="Add a macro definition")
5353

5454
# Local run
55+
parser.add_option("--automated", action="store_true", dest="automated",
56+
default=False, help="Automated test")
57+
parser.add_option("--host", dest="host_test",
58+
default=None, help="Host test")
59+
parser.add_option("--extra", dest="extra",
60+
default=None, help="Extra files")
61+
parser.add_option("--peripherals", dest="peripherals",
62+
default=None, help="Required peripherals")
63+
parser.add_option("--dep", dest="dependencies",
64+
default=None, help="Dependencies")
65+
parser.add_option("--source", dest="source_dir",
66+
default=None, help="The source (input) directory")
67+
parser.add_option("--duration", type="int", dest="duration",
68+
default=None, help="Duration of the test")
69+
parser.add_option("--build", dest="build_dir",
70+
default=None, help="The build (output) directory")
5571
parser.add_option("-d", "--disk", dest="disk",
5672
default=None, help="The mbed disk")
5773
parser.add_option("-s", "--serial", dest="serial",
@@ -69,9 +85,15 @@
6985
default=None, help="use the specified linker script")
7086

7187
(options, args) = parser.parse_args()
72-
88+
89+
# force program to "0" if a source dir is specified
90+
if options.source_dir is not None:
91+
p = 0
92+
n = None
93+
else:
7394
# Program Number or name
74-
p, n = options.program, options.program_name
95+
p, n = options.program, options.program_name
96+
7597
if n is not None and p is not None:
7698
args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
7799
if n:
@@ -101,6 +123,19 @@
101123

102124
# Test
103125
test = Test(p)
126+
if options.automated is not None:
127+
test.automated = options.automated
128+
if options.dependencies is not None:
129+
test.dependencies = options.dependencies
130+
if options.host_test is not None:
131+
test.host_test = options.host_test;
132+
if options.peripherals is not None:
133+
test.peripherals = options.peripherals;
134+
if options.duration is not None:
135+
test.duration = options.duration;
136+
if options.extra is not None:
137+
test.extra_files = options.extra
138+
104139
if not test.is_supported(mcu, toolchain):
105140
print 'The selected test is not supported on target %s with toolchain %s' % (mcu, toolchain)
106141
sys.exit()
@@ -110,6 +145,12 @@
110145
test.dependencies.append(RTOS_LIBRARIES)
111146

112147
build_dir = join(BUILD_DIR, "test", mcu, toolchain, test.id)
148+
if options.source_dir is not None:
149+
test.source_dir = options.source_dir
150+
build_dir = options.source_dir
151+
152+
if options.build_dir is not None:
153+
build_dir = options.build_dir
113154

114155
target = TARGET_MAP[mcu]
115156
try:

0 commit comments

Comments
 (0)