twister: do not recorde a null version

In some scenarios we might end up with a null version value in the json
file, if the version can't be determined, set it to Unkown instead.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2022-11-05 13:20:19 -04:00
commit 148a6e2ee1

View file

@ -698,8 +698,13 @@ class TwisterEnv:
universal_newlines=True,
cwd=ZEPHYR_BASE)
if subproc.returncode == 0:
self.version = subproc.stdout.strip()
logger.info(f"Zephyr version: {self.version}")
_version = subproc.stdout.strip()
if _version:
self.version = _version
logger.info(f"Zephyr version: {self.version}")
else:
self.version = "Unknown"
logger.error("Coult not determine version")
except OSError:
logger.info("Cannot read zephyr version.")