зеркало из https://github.com/microsoft/lisa.git
fix Windows failure without WSL
This commit is contained in:
Родитель
2d62443079
Коммит
0c7a5a5dbe
|
@ -33,9 +33,10 @@ class HelloWorld(TestSuite):
|
|||
|
||||
if node.isLinux:
|
||||
uname = node.getTool(Uname)
|
||||
release, version, hardware = uname.getLinuxInformation()
|
||||
release, version, hardware, os = uname.getLinuxInformation()
|
||||
log.info(
|
||||
f"release: '{release}', version: '{version}', hardware: '{hardware}'"
|
||||
f"release: '{release}', version: '{version}', "
|
||||
f"hardware: '{hardware}', os: '{os}'"
|
||||
)
|
||||
log.info("It's Linux, try on Windows!")
|
||||
else:
|
||||
|
|
|
@ -39,6 +39,7 @@ class Node:
|
|||
self.kernelRelease: str = ""
|
||||
self.kernelVersion: str = ""
|
||||
self.hardwarePlatform: str = ""
|
||||
self.os: str = ""
|
||||
|
||||
self.tools: Dict[Type[Tool], Tool] = dict()
|
||||
|
||||
|
@ -172,8 +173,9 @@ class Node:
|
|||
self.kernelRelease,
|
||||
self.kernelVersion,
|
||||
self.hardwarePlatform,
|
||||
self.os,
|
||||
) = uname.getLinuxInformation(noErrorLog=True)
|
||||
if not self.kernelRelease:
|
||||
if (not self.kernelRelease) or ("Linux" not in self.os):
|
||||
self._isLinux = False
|
||||
if self._isLinux:
|
||||
log.info(
|
||||
|
|
|
@ -7,7 +7,8 @@ from lisa.core.tool import Tool
|
|||
class Uname(Tool):
|
||||
def initialize(self) -> None:
|
||||
self.key_info_pattern = re.compile(
|
||||
r"(?P<release>[^ ]*?) (?P<version>[\w\W]*) (?P<platform>[\w_]+?)$"
|
||||
r"(?P<release>[^ ]*?) (?P<version>[\w\W]*) (?P<platform>[\w\W]+?) "
|
||||
r"(?P<os>[\w\W]+?)$"
|
||||
)
|
||||
# uname's result suppose not be changed frequently,
|
||||
# so cache it for performance.
|
||||
|
@ -16,6 +17,7 @@ class Uname(Tool):
|
|||
self.kernelRelease: str = ""
|
||||
self.kernelVersion: str = ""
|
||||
self.hardwarePlatform: str = ""
|
||||
self.os: str = ""
|
||||
|
||||
@property
|
||||
def command(self) -> str:
|
||||
|
@ -40,7 +42,7 @@ class Uname(Tool):
|
|||
"""
|
||||
|
||||
if (not self.hasResult) or force:
|
||||
cmd_result = self.run("-vri", noErrorLog=noErrorLog)
|
||||
cmd_result = self.run("-vrio", noErrorLog=noErrorLog)
|
||||
|
||||
if cmd_result.exitCode != 0:
|
||||
self.isLinux = False
|
||||
|
@ -51,9 +53,11 @@ class Uname(Tool):
|
|||
self.kernelRelease = match_result.group("release")
|
||||
self.kernelVersion = match_result.group("version")
|
||||
self.hardwarePlatform = match_result.group("platform")
|
||||
self.os = match_result.group("os")
|
||||
self.hasResult = True
|
||||
return (
|
||||
self.kernelRelease,
|
||||
self.kernelVersion,
|
||||
self.hardwarePlatform,
|
||||
self.os,
|
||||
)
|
||||
|
|
Загрузка…
Ссылка в новой задаче