Skip to content

Issue #84 - Added command line source/build directory option #86

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 21, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 44 additions & 3 deletions workspace_tools/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,30 @@
if __name__ == '__main__':
# Parse Options
parser = get_default_options_parser()
parser.add_option("-p", type="int", dest="program",
parser.add_option("-p", type="int", dest="program", default=-1,
help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
parser.add_option("-n", dest="program_name",
help="The name of the desired test program")
parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
default=False, help="Verbose diagnostic output")

# Local run
parser.add_option("--automated", action="store_true", dest="automated",
default=False, help="Automated test")
parser.add_option("--host", dest="host_test",
default=None, help="Host test")
parser.add_option("--extra", dest="extra",
default=None, help="Extra files")
parser.add_option("--peripherals", dest="peripherals",
default=None, help="Required peripherals")
parser.add_option("--dep", dest="dependencies",
default=None, help="Dependencies")
parser.add_option("--source", dest="source_dir",
default=None, help="The source (input) directory")
parser.add_option("--duration", type="int", dest="duration",
default=None, help="Duration of the test")
parser.add_option("--build", dest="build_dir",
default=None, help="The build (output) directory")
parser.add_option("-d", "--disk", dest="disk",
default=None, help="The mbed disk")
parser.add_option("-s", "--serial", dest="serial",
Expand All @@ -67,9 +83,15 @@
default=None, help="use the specified linker script")

(options, args) = parser.parse_args()


# force program to "0" if a source dir is specified
if options.source_dir is not None:
p = 0
n = None
else:
# Program Number or name
p, n = options.program, options.program_name
p, n = options.program, options.program_name

if n is not None and p is not None:
args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
if n:
Expand Down Expand Up @@ -99,6 +121,19 @@

# Test
test = Test(p)
if options.automated is not None:
test.automated = options.automated
if options.dependencies is not None:
test.dependencies = options.dependencies
if options.host_test is not None:
test.host_test = options.host_test;
if options.peripherals is not None:
test.peripherals = options.peripherals;
if options.duration is not None:
test.duration = options.duration;
if options.extra is not None:
test.extra_files = options.extra

if not test.is_supported(mcu, toolchain):
print 'The selected test is not supported on target %s with toolchain %s' % (mcu, toolchain)
sys.exit()
Expand All @@ -108,6 +143,12 @@
test.dependencies.append(RTOS_LIBRARIES)

build_dir = join(BUILD_DIR, "test", mcu, toolchain, test.id)
if options.source_dir is not None:
test.source_dir = options.source_dir
build_dir = options.source_dir

if options.build_dir is not None:
build_dir = options.build_dir

target = TARGET_MAP[mcu]
try:
Expand Down