llvm-project/lldb/test/API/lang/objc/struct-description/TestObjCStructDescription.py
Med Ismail Bennani b3ec476c70
[lldb/test] Fix tests reading log from remote platform instead of host (#183413)
Some tests are using logs to validate that a test behaves correctly
however they used `platform shell cat {log}` to read the logfile.

This doesn't work when running the testsuite against a remote platform
since the logs are saved on the host's filesystem.

This patch addresses those failures by making sure we read the log file
from the host platform.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-02-25 23:46:40 +00:00

38 lines
1.2 KiB
Python

import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestCase(TestBase):
def test(self):
self.build()
lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.m"))
log = self.getBuildArtifact("expr.log")
self.runCmd(f"log enable lldb expr -f {log}")
self.expect(
"vo pair",
substrs=[
"warning: `po` was unsuccessful, running `p` instead\n",
"(Pair) pair = (f = 2, e = 3)",
],
)
self.filecheck(
f"platform shel -h -- cat {log}", __file__, f"-check-prefix=CHECK-VO"
)
# CHECK-VO: Object description fallback due to error: not a pointer type
self.expect(
"expr -O -- pair",
substrs=[
"warning: `po` was unsuccessful, running `p` instead\n",
"(Pair) (f = 2, e = 3)",
],
)
self.filecheck(
f"platform shel -h -- cat {log}", __file__, f"-check-prefix=CHECK-EXPR"
)
# CHECK-EXPR: Object description fallback due to error: not a pointer type