From 2732f6036e146f926cbe5d28a9101b50aad8cd15 Mon Sep 17 00:00:00 2001 From: Li Jie Date: Mon, 30 Sep 2024 16:35:12 +0800 Subject: [PATCH] debug: refactor test script --- .github/workflows/go.yml | 1 + _lldb/runtest.sh | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4191295c..a15bebee 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -99,6 +99,7 @@ jobs: bash .github/workflows/test_llgo.sh - name: LLDB tests + if: ${{startsWith(matrix.os, 'macos')}} run: | echo "Test lldb with llgo plugin on ${{matrix.os}} with LLVM ${{matrix.llvm}}" bash _lldb/runtest.sh -v diff --git a/_lldb/runtest.sh b/_lldb/runtest.sh index 03cc3ec9..6d73cbb8 100755 --- a/_lldb/runtest.sh +++ b/_lldb/runtest.sh @@ -40,8 +40,23 @@ build_project "$package_path" || exit 1 # Set up the result file path result_file="/tmp/lldb_exit_code" +# Prepare LLDB commands +lldb_commands=( + "command script import _lldb/llgo_plugin.py" + "command script import _lldb/test.py" + "script test.run_tests_with_result('${package_path}/debug.out', ['${package_path}/in.go'], $verbose, $interactive, $plugin_path, '$result_file')" + "quit" +) + +# Run LLDB with prepared commands +lldb_command_string="" +for cmd in "${lldb_commands[@]}"; do + lldb_command_string+=" -o \"$cmd\"" +done + + # Run LLDB with the test script -"$LLDB_PATH" -o "command script import _lldb/test.py" -o "script test.run_tests_with_result('${package_path}/debug.out', ['${package_path}/in.go'], $verbose, $interactive, $plugin_path, '$result_file')" -o "quit" +eval "$LLDB_PATH $lldb_command_string" # Read the exit code from the result file if [ -f "$result_file" ]; then