Skip to content

Commit 03b4d85

Browse files
committed
scripts: west_commands: build: Fix warning during rebuild
5718af0 introduced a regression where a warning was printed about unknown BOARD when rebuilding. Commit moved _find_board() to an earlier stage and that was failing during the rebuild. Instead of moving board finding earlier we can move parsing of the test_item to the later stage as it is needed only just before running cmake. Signed-off-by: Krzysztof Chruściński <[email protected]>
1 parent 11a9096 commit 03b4d85

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

scripts/west_commands/build.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -193,21 +193,6 @@ def do_run(self, args, remainder):
193193
# Store legacy -s option locally
194194
source_dir = self.args.source_dir
195195
self._parse_remainder(remainder)
196-
board, origin = self._find_board()
197-
# Parse testcase.yaml or sample.yaml files for additional options.
198-
if self.args.test_item:
199-
# we get path + testitem
200-
item = os.path.basename(self.args.test_item)
201-
if self.args.source_dir:
202-
test_path = self.args.source_dir
203-
else:
204-
test_path = os.path.dirname(self.args.test_item)
205-
if test_path and os.path.exists(test_path):
206-
self.args.source_dir = test_path
207-
if not self._parse_test_item(item, board):
208-
self.die("No test metadata found")
209-
else:
210-
self.die("test item path does not exist")
211196

212197
if source_dir:
213198
if self.args.source_dir:
@@ -264,6 +249,23 @@ def do_run(self, args, remainder):
264249
except Exception as e:
265250
self.wrn(f'Failed to create info file: {build_info_file},', e)
266251

252+
board, origin = self._find_board()
253+
254+
# Parse testcase.yaml or sample.yaml files for additional options.
255+
if self.args.test_item:
256+
# we get path + testitem
257+
item = os.path.basename(self.args.test_item)
258+
if self.args.source_dir:
259+
test_path = self.args.source_dir
260+
else:
261+
test_path = os.path.dirname(self.args.test_item)
262+
if test_path and os.path.exists(test_path):
263+
self.args.source_dir = test_path
264+
if not self._parse_test_item(item, board):
265+
self.die("No test metadata found")
266+
else:
267+
self.die("test item path does not exist")
268+
267269
self._run_cmake(board, origin, self.args.cmake_opts)
268270
if args.cmake_only:
269271
return

0 commit comments

Comments
 (0)