Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

63 lines
2.1 KiB
Python

"""
Test that typing python expression in the terminal is echoed back to stdout.
"""
from lldbsuite.test.decorators import skipIfAsan
from lldbsuite.test.lldbpexpect import PExpectTest
@skipIfAsan
class PythonInterpreterEchoTest(PExpectTest):
PYTHON_PROMPT = ">>> "
def verify_command_echo(
self, command: str, expected_output: str = "", is_regex: bool = False
):
assert self.child != None
child = self.child
self.assertIsNotNone(self.child, "expected a running lldb process.")
child.sendline(command)
# Build pattern list: match whichever comes first (output or prompt).
# This prevents waiting for a timeout if there's no match.
pattern = []
match_expected = expected_output and len(expected_output) > 0
if match_expected:
pattern.append(expected_output)
pattern.append(self.PYTHON_PROMPT)
expect_func = child.expect if is_regex else child.expect_exact
match_idx = expect_func(pattern)
if match_expected:
self.assertEqual(
match_idx, 0, "Expected output `{expected_output}` in stdout."
)
self.assertIsNotNone(self.child.before, "Expected output before prompt")
self.assertIsInstance(self.child.before, bytes)
echoed_text: str = self.child.before.decode("ascii").strip()
self.assertEqual(
command, echoed_text, f"Command '{command}' should be echoed to stdout."
)
if match_expected:
child.expect_exact(self.PYTHON_PROMPT)
def test_python_interpreter_echo(self):
"""Test that that the user typed commands is echoed to stdout"""
self.launch(use_colors=False, dimensions=(100, 100))
# Enter the python interpreter.
self.verify_command_echo(
"script --language python --", expected_output="Python.*\\.", is_regex=True
)
self.child_in_script_interpreter = True
self.verify_command_echo("val = 300")
self.verify_command_echo(
"print('result =', 300)", expected_output="result = 300"
)