Skip to content

Commit 7294396

Browse files
[lldb][test] Handle failure to get /proc/cpuinfo from a remote Linux platform (#108183)
I've been testing against qemu-aarch64 using the qemu-user platform, which doesn't support get-file: ``` AssertionError: False is not true : Command 'platform get-file "/proc/cpuinfo" <...>/TestAArch64LinuxMTEMemoryRegion.test_mte_regions/cpuinfo Command output: get-file failed: unimplemented ' did not return successfully ``` QEMU itself does support overriding cpuinfo for the emulated process (https://gitlab.com/qemu-project/qemu/-/commit/a55b9e72267085957cadb0af0a8811cfbd7c61a9) however we'd need to be able to read the cpuinfo before the process starts, so I'm not attempting to use this feature. Instead if the get-file fails, assume empty cpuinfo so we can at least carry on testing. I've logged the failure and the reason to the trace so developers can find it. ``` runCmd: platform get-file "/proc/cpuinfo" <...>/TestAArch64LinuxMTEMemoryRegion.test_mte_regions/cpuinfo check of return status not required runCmd failed! Failed to get /proc/cpuinfo from remote: "get-file failed: unimplemented" All cpuinfo feature checks will fail. ``` For now this only helps AArch64 but I suspect that RISC-V, being even more mix and match when it comes to extensions, may need this in future. And I know we have some folks testing against qemu-riscv at the moment.
1 parent 2149914 commit 7294396

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lldb/packages/Python/lldbsuite/test/lldbtest.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1317,7 +1317,18 @@ def getCPUInfo(self):
13171317
# Need to do something different for non-Linux/Android targets
13181318
cpuinfo_path = self.getBuildArtifact("cpuinfo")
13191319
if configuration.lldb_platform_name:
1320-
self.runCmd('platform get-file "/proc/cpuinfo" ' + cpuinfo_path)
1320+
self.runCmd(
1321+
'platform get-file "/proc/cpuinfo" ' + cpuinfo_path, check=False
1322+
)
1323+
if not self.res.Succeeded():
1324+
if self.TraceOn():
1325+
print(
1326+
'Failed to get /proc/cpuinfo from remote: "{}"'.format(
1327+
self.res.GetOutput().strip()
1328+
)
1329+
)
1330+
print("All cpuinfo feature checks will fail.")
1331+
return ""
13211332
else:
13221333
cpuinfo_path = "/proc/cpuinfo"
13231334

0 commit comments

Comments
 (0)