Skip to content

Commit 7eb8795

Browse files
authored
Merge pull request #269 from bridadan/fix-test-spec
Respecting --test-spec definition for test command
2 parents 9ae8cce + ef3a001 commit 7eb8795

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

mbed/mbed.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,6 +2010,8 @@ def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_
20102010
args = remainder
20112011
# Find the root of the program
20122012
program = Program(os.getcwd(), True)
2013+
# Save original working directory
2014+
orig_path = os.getcwd()
20132015

20142016
target = program.get_mcu(mcu)
20152017
tchain = program.get_toolchain(toolchain)
@@ -2029,8 +2031,13 @@ def test_(toolchain=None, mcu=None, compile_list=False, run_list=False, compile_
20292031
if not build:
20302032
build = os.path.join(program.path, '.build/tests', target, tchain)
20312033

2032-
# Create the path to the test spec file
2033-
test_spec = os.path.join(build, 'test_spec.json')
2034+
2035+
if test_spec:
2036+
# Preserve path to given test spec
2037+
test_spec = os.path.relpath(os.path.join(orig_path, test_spec), program.path)
2038+
else:
2039+
# Create the path to the test spec file
2040+
test_spec = os.path.join(build, 'test_spec.json')
20342041

20352042
if compile_list:
20362043
popen(['python', '-u', os.path.join(tools_dir, 'test.py'), '--list']

0 commit comments

Comments
 (0)