Skip to content

Commit

Permalink
テストスクリプトを使う
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Nov 2, 2024
1 parent 13636a5 commit 2bc359a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/build-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
35 changes: 35 additions & 0 deletions test_with_llvm.py
Original file line number Diff line number Diff line change
@@ -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")

0 comments on commit 2bc359a

Please # to comment.