west: build: fail early if path to test item is not valid

Fail early in case the path to the test item (--test-item) is not valid
or does not exist.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-08-23 10:28:49 +00:00 committed by Martí Bolívar
commit d4b0c48892

View file

@ -166,10 +166,13 @@ class Build(Forceable):
# we get path + testitem
item = os.path.basename(self.args.test_item)
test_path = os.path.dirname(self.args.test_item)
if test_path:
if test_path and os.path.exists(test_path):
self.args.source_dir = test_path
if not self._parse_test_item(item):
log.die("No test metadata found")
else:
log.die("test item path does not exist")
if source_dir:
if self.args.source_dir:
log.die("source directory specified twice:({} and {})".format(
@ -322,6 +325,7 @@ class Build(Forceable):
self.args.sysbuild = sysbuild
if found_test_metadata:
args = []
if extra_conf_files:
args.append(f"CONF_FILE=\"{';'.join(extra_conf_files)}\"")