The new test fails on x86 and arm64 public macOS bots: ``` 09:27:59 ====================================================================== 09:27:59 FAIL: test_append_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase) 09:27:59 Test that we can add frames after real stack. 09:27:59 ---------------------------------------------------------------------- 09:27:59 Traceback (most recent call last): 09:27:59 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 122, in test_append_frames 09:27:59 self.assertEqual(new_frame_count, original_frame_count + 1) 09:27:59 AssertionError: 5 != 6 09:27:59 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 09:27:59 ====================================================================== 09:27:59 FAIL: test_applies_to_thread (TestScriptedFrameProvider.ScriptedFrameProviderTestCase) 09:27:59 Test that applies_to_thread filters which threads get the provider. 09:27:59 ---------------------------------------------------------------------- 09:27:59 Traceback (most recent call last): 09:27:59 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 218, in test_applies_to_thread 09:27:59 self.assertEqual( 09:27:59 AssertionError: 5 != 1 : Thread with ID 1 should have 1 synthetic frame 09:27:59 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 09:27:59 ====================================================================== 09:27:59 FAIL: test_prepend_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase) 09:27:59 Test that we can add frames before real stack. 09:27:59 ---------------------------------------------------------------------- 09:27:59 Traceback (most recent call last): 09:27:59 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 84, in test_prepend_frames 09:27:59 self.assertEqual(new_frame_count, original_frame_count + 2) 09:27:59 AssertionError: 5 != 7 09:27:59 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 09:27:59 ====================================================================== 09:27:59 FAIL: test_remove_frame_provider_by_id (TestScriptedFrameProvider.ScriptedFrameProviderTestCase) 09:27:59 Test that RemoveScriptedFrameProvider removes a specific provider by ID. 09:27:59 ---------------------------------------------------------------------- 09:27:59 Traceback (most recent call last): 09:27:59 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 272, in test_remove_frame_provider_by_id 09:27:59 self.assertEqual(thread.GetNumFrames(), 3, "Should have 3 synthetic frames") 09:27:59 AssertionError: 5 != 3 : Should have 3 synthetic frames 09:27:59 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 09:27:59 ====================================================================== 09:27:59 FAIL: test_replace_all_frames (TestScriptedFrameProvider.ScriptedFrameProviderTestCase) 09:27:59 Test that we can replace the entire stack. 09:27:59 ---------------------------------------------------------------------- 09:27:59 Traceback (most recent call last): 09:27:59 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 41, in test_replace_all_frames 09:27:59 self.assertEqual(thread.GetNumFrames(), 3, "Should have 3 synthetic frames") 09:27:59 AssertionError: 5 != 3 : Should have 3 synthetic frames 09:27:59 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 09:27:59 ====================================================================== 09:27:59 FAIL: test_scripted_frame_objects (TestScriptedFrameProvider.ScriptedFrameProviderTestCase) 09:27:59 Test that provider can return ScriptedFrame objects. 09:27:59 ---------------------------------------------------------------------- 09:27:59 Traceback (most recent call last): 09:27:59 File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/functionalities/scripted_frame_provider/TestScriptedFrameProvider.py", line 159, in test_scripted_frame_objects 09:27:59 self.assertEqual(frame0.GetFunctionName(), "custom_scripted_frame_0") 09:27:59 AssertionError: 'thread_func(int)' != 'custom_scripted_frame_0' 09:27:59 - thread_func(int) 09:27:59 + custom_scripted_frame_0 09:27:59 09:27:59 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 09:27:59 ---------------------------------------------------------------------- 09:27:59 Ran 6 tests in 14.242s 09:27:59 09:27:59 FAILED (failures=6) ``` Reverts llvm/llvm-project#161870
361 lines
11 KiB
C++
361 lines
11 KiB
C++
//===-- PythonTestSuite.cpp -----------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h"
|
|
#include "Plugins/ScriptInterpreter/Python/lldb-python.h"
|
|
|
|
#include "PythonTestSuite.h"
|
|
#include <optional>
|
|
|
|
void PythonTestSuite::SetUp() {
|
|
// Although we don't care about concurrency for the purposes of running
|
|
// this test suite, Python requires the GIL to be locked even for
|
|
// deallocating memory, which can happen when you call Py_DECREF or
|
|
// Py_INCREF. So acquire the GIL for the entire duration of this
|
|
// test suite.
|
|
Py_InitializeEx(0);
|
|
m_gil_state = PyGILState_Ensure();
|
|
python::RunSimpleString("import sys");
|
|
}
|
|
|
|
void PythonTestSuite::TearDown() {
|
|
PyGILState_Release(m_gil_state);
|
|
|
|
// We could call Py_FinalizeEx here, but initializing and finalizing Python is
|
|
// pretty slow, so just keep Python initialized across tests.
|
|
}
|
|
|
|
// The following functions are the Pythonic implementations of the required
|
|
// callbacks. Because they're defined in libLLDB which we cannot link for the
|
|
// unit test, we have a 'default' implementation here.
|
|
|
|
extern "C" PyObject *PyInit__lldb(void) { return nullptr; }
|
|
|
|
llvm::Expected<bool>
|
|
lldb_private::python::SWIGBridge::LLDBSwigPythonBreakpointCallbackFunction(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
const lldb::StackFrameSP &sb_frame,
|
|
const lldb::BreakpointLocationSP &sb_bp_loc,
|
|
const StructuredDataImpl &args_impl) {
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSwigPythonWatchpointCallbackFunction(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
const lldb::StackFrameSP &sb_frame, const lldb::WatchpointSP &sb_wp) {
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSwigPythonFormatterCallbackFunction(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
lldb::TypeImplSP type_impl_sp) {
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallTypeScript(
|
|
const char *python_function_name, const void *session_dictionary,
|
|
const lldb::ValueObjectSP &valobj_sp, void **pyfunct_wrapper,
|
|
const lldb::TypeSummaryOptionsSP &options_sp, std::string &retval) {
|
|
return false;
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateSyntheticProvider(
|
|
const char *python_class_name, const char *session_dictionary_name,
|
|
const lldb::ValueObjectSP &valobj_sp) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::LLDBSwigPythonCreateCommandObject(
|
|
const char *python_class_name, const char *session_dictionary_name,
|
|
lldb::DebuggerSP debugger_sp) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
size_t lldb_private::python::SWIGBridge::LLDBSwigPython_CalculateNumChildren(
|
|
PyObject *implementor, uint32_t max) {
|
|
return 0;
|
|
}
|
|
|
|
PyObject *lldb_private::python::SWIGBridge::LLDBSwigPython_GetChildAtIndex(
|
|
PyObject *implementor, uint32_t idx) {
|
|
return nullptr;
|
|
}
|
|
|
|
uint32_t
|
|
lldb_private::python::SWIGBridge::LLDBSwigPython_GetIndexOfChildWithName(
|
|
PyObject *implementor, const char *child_name) {
|
|
return 0;
|
|
}
|
|
|
|
void *
|
|
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBData(PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBBreakpoint(
|
|
PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBBreakpointLocation(
|
|
PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBAttachInfo(
|
|
PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBLaunchInfo(
|
|
PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *
|
|
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBError(PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *
|
|
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBEvent(PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *
|
|
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBStream(PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *
|
|
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBFrame(PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBSymbolContext(
|
|
PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *
|
|
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBValue(PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBMemoryRegionInfo(
|
|
PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *lldb_private::python::LLDBSWIGPython_CastPyObjectToSBExecutionContext(
|
|
PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
void *
|
|
lldb_private::python::LLDBSWIGPython_CastPyObjectToSBFrameList(PyObject *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
lldb::ValueObjectSP
|
|
lldb_private::python::SWIGBridge::LLDBSWIGPython_GetValueObjectSPFromSBValue(
|
|
void *data) {
|
|
return nullptr;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::
|
|
LLDBSwigPython_UpdateSynthProviderInstance(PyObject *implementor) {
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::
|
|
LLDBSwigPython_MightHaveChildrenSynthProviderInstance(
|
|
PyObject *implementor) {
|
|
return false;
|
|
}
|
|
|
|
PyObject *
|
|
lldb_private::python::SWIGBridge::LLDBSwigPython_GetValueSynthProviderInstance(
|
|
PyObject *implementor) {
|
|
return nullptr;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommand(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
lldb::DebuggerSP debugger, const char *args,
|
|
lldb_private::CommandReturnObject &cmd_retobj,
|
|
lldb::ExecutionContextRefSP exe_ctx_ref_sp) {
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallCommandObject(
|
|
PyObject *implementor, lldb::DebuggerSP debugger, const char *args,
|
|
lldb_private::CommandReturnObject &cmd_retobj,
|
|
lldb::ExecutionContextRefSP exe_ctx_ref_sp) {
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallParsedCommandObject(
|
|
PyObject *implementor, lldb::DebuggerSP debugger,
|
|
StructuredDataImpl &args_impl,
|
|
lldb_private::CommandReturnObject &cmd_retobj,
|
|
lldb::ExecutionContextRefSP exe_ctx_ref_sp) {
|
|
return false;
|
|
}
|
|
|
|
std::optional<std::string>
|
|
LLDBSwigPythonGetRepeatCommandForScriptedCommand(PyObject *implementor,
|
|
std::string &command) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
StructuredData::DictionarySP
|
|
LLDBSwigPythonHandleArgumentCompletionForScriptedCommand(
|
|
PyObject *implementor, std::vector<llvm::StringRef> &args, size_t args_pos,
|
|
size_t pos_in_arg) {
|
|
return {};
|
|
}
|
|
|
|
StructuredData::DictionarySP
|
|
LLDBSwigPythonHandleOptionArgumentCompletionForScriptedCommand(
|
|
PyObject *implementor, llvm::StringRef &long_options, size_t char_in_arg) {
|
|
return {};
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallModuleInit(
|
|
const char *python_module_name, const char *session_dictionary_name,
|
|
lldb::DebuggerSP debugger) {
|
|
return false;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSwigPythonCallModuleNewTarget(
|
|
const char *python_module_name, const char *session_dictionary_name,
|
|
lldb::TargetSP target) {
|
|
return false;
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::LLDBSWIGPythonCreateOSPlugin(
|
|
const char *python_class_name, const char *session_dictionary_name,
|
|
const lldb::ProcessSP &process_sp) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::LLDBSWIGPython_CreateFrameRecognizer(
|
|
const char *python_class_name, const char *session_dictionary_name) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
PyObject *
|
|
lldb_private::python::SWIGBridge::LLDBSwigPython_GetRecognizedArguments(
|
|
PyObject *implementor, const lldb::StackFrameSP &frame_sp) {
|
|
return nullptr;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordProcess(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
const lldb::ProcessSP &process, std::string &output) {
|
|
return false;
|
|
}
|
|
|
|
std::optional<std::string>
|
|
lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordThread(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
lldb::ThreadSP thread) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordTarget(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
const lldb::TargetSP &target, std::string &output) {
|
|
return false;
|
|
}
|
|
|
|
std::optional<std::string>
|
|
lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordFrame(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
lldb::StackFrameSP frame) {
|
|
return std::nullopt;
|
|
}
|
|
|
|
bool lldb_private::python::SWIGBridge::LLDBSWIGPythonRunScriptKeywordValue(
|
|
const char *python_function_name, const char *session_dictionary_name,
|
|
const lldb::ValueObjectSP &value, std::string &output) {
|
|
return false;
|
|
}
|
|
|
|
void *lldb_private::python::SWIGBridge::LLDBSWIGPython_GetDynamicSetting(
|
|
void *module, const char *setting, const lldb::TargetSP &target_sp) {
|
|
return nullptr;
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(Status &&status) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::ProcessAttachInfoSP) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::ProcessLaunchInfoSP) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::DataExtractorSP) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::ExecutionContextRefSP) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::ThreadPlanSP) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::ProcessSP) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(lldb::StackFrameListSP) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject lldb_private::python::SWIGBridge::ToSWIGWrapper(
|
|
const lldb_private::StructuredDataImpl &) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(Event *event) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject
|
|
lldb_private::python::SWIGBridge::ToSWIGWrapper(const Stream *stream) {
|
|
return python::PythonObject();
|
|
}
|
|
|
|
python::PythonObject lldb_private::python::SWIGBridge::ToSWIGWrapper(
|
|
std::shared_ptr<lldb::SBStream> stream_sb) {
|
|
return python::PythonObject();
|
|
}
|