diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml index 1980028..3155496 100644 --- a/.github/workflows/build-debug.yml +++ b/.github/workflows/build-debug.yml @@ -238,4 +238,4 @@ jobs: - name: E2E Test sora-python-sdk working-directory: sora-python-sdk run: | - lldb-18 -o 'settings set target.process.follow-fork-mode child' -o run -o continue -o 'bt all' -o 'exit' -- uv run pytest tests -s + lldb-18 --batch -o 'command script import test_with_llvm.py' -o 'test' diff --git a/test_with_llvm.py b/test_with_llvm.py new file mode 100644 index 0000000..8e9dc36 --- /dev/null +++ b/test_with_llvm.py @@ -0,0 +1,35 @@ +import sys +import time + +import lldb + + +def test(debugger, command, result, internal_dict): + debugger.HandleCommand("settings set target.process.follow-fork-mode child") + + target = debugger.CreateTargetWithFileAndArch("uv", lldb.LLDB_ARCH_DEFAULT) + process = target.LaunchSimple(["run", "pytest", "tests", "-s"], None, None) + + if not process: + print("Error: could not launch process") + return + + while True: + time.sleep(1.0) + state = process.GetState() + + if state == lldb.eStateExited: + exit_status = process.GetExitStatus() + sys.exit(exit_status) + elif state == lldb.eStateStopped: + thread = process.GetSelectedThread() + if thread.GetStopReason() == lldb.eStopReasonExec: + process.Continue() + continue + debugger.HandleCommand("bt all") + sys.exit(1) + + +# LLDBにスクリプトを初期化してコマンドを追加 +def __lldb_init_module(debugger, internal_dict): + debugger.HandleCommand("command script add -f test_with_llvm.test test")