Importing rustc-1.56.0 Change-Id: I98941481270706fa55f8fb2cb91686ae3bd30f38
diff --git a/src/llvm-project/lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py b/src/llvm-project/lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py index 80324ee..bd02b76 100644 --- a/src/llvm-project/lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/breakpoint/TestBreakpointAPI.py
@@ -13,7 +13,6 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True - @add_test_categories(['pyapi']) def test_breakpoint_is_valid(self): """Make sure that if an SBBreakpoint gets deleted its IsValid returns false.""" self.build() @@ -45,7 +44,6 @@ not breakpoint, "Breakpoint we deleted is no longer valid.") - @add_test_categories(['pyapi']) def test_target_delete(self): """Make sure that if an SBTarget gets deleted the associated Breakpoint's IsValid returns false."""
diff --git a/src/llvm-project/lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py b/src/llvm-project/lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py index 091bb1b..061556a 100644 --- a/src/llvm-project/lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py +++ b/src/llvm-project/lldb/test/API/python_api/class_members/TestSBTypeClassMembers.py
@@ -24,7 +24,6 @@ self.line = line_number(self.source, '// set breakpoint here') @skipUnlessDarwin - @add_test_categories(['pyapi']) def test(self): """Test SBType APIs to fetch member function types.""" d = {'EXE': self.exe_name}
diff --git a/src/llvm-project/lldb/test/API/python_api/class_members/main.mm b/src/llvm-project/lldb/test/API/python_api/class_members/main.mm index b84f4d3..723cb61 100644 --- a/src/llvm-project/lldb/test/API/python_api/class_members/main.mm +++ b/src/llvm-project/lldb/test/API/python_api/class_members/main.mm
@@ -1,4 +1,4 @@ -#import <Foundation/Foundation.h> +#import <objc/NSObject.h> class Base { public:
diff --git a/src/llvm-project/lldb/test/API/python_api/debugger/Makefile b/src/llvm-project/lldb/test/API/python_api/debugger/Makefile new file mode 100644 index 0000000..bfad5f3 --- /dev/null +++ b/src/llvm-project/lldb/test/API/python_api/debugger/Makefile
@@ -0,0 +1,3 @@ +CXX_SOURCES := main.cpp + +include Makefile.rules
diff --git a/src/llvm-project/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/src/llvm-project/lldb/test/API/python_api/debugger/TestDebuggerAPI.py index 32202acb..f9fe64d 100644 --- a/src/llvm-project/lldb/test/API/python_api/debugger/TestDebuggerAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/debugger/TestDebuggerAPI.py
@@ -14,7 +14,6 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True - @add_test_categories(['pyapi']) def test_debugger_api_boundary_condition(self): """Exercise SBDebugger APIs with boundary conditions.""" self.dbg.HandleCommand(None) @@ -37,9 +36,59 @@ fresh_dbg = lldb.SBDebugger() self.assertEquals(len(fresh_dbg), 0) - @add_test_categories(['pyapi']) def test_debugger_delete_invalid_target(self): """SBDebugger.DeleteTarget() should not crash LLDB given and invalid target.""" target = lldb.SBTarget() self.assertFalse(target.IsValid()) self.dbg.DeleteTarget(target) + + def test_debugger_internal_variables(self): + """Ensure that SBDebugger reachs the same instance of properties + regardless CommandInterpreter's context initialization""" + self.build() + exe = self.getBuildArtifact("a.out") + + # Create a target by the debugger. + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + property_name = "target.process.memory-cache-line-size" + + def get_cache_line_size(): + value_list = lldb.SBStringList() + value_list = self.dbg.GetInternalVariableValue(property_name, + self.dbg.GetInstanceName()) + + self.assertEqual(value_list.GetSize(), 1) + try: + return int(value_list.GetStringAtIndex(0)) + except ValueError as error: + self.fail("Value is not a number: " + error) + + # Get global property value while there are no processes. + global_cache_line_size = get_cache_line_size() + + # Run a process via SB interface. CommandInterpreter's execution context + # remains empty. + error = lldb.SBError() + launch_info = lldb.SBLaunchInfo(None) + launch_info.SetLaunchFlags(lldb.eLaunchFlagStopAtEntry) + process = target.Launch(launch_info, error) + self.assertTrue(process, PROCESS_IS_VALID) + + # This should change the value of a process's local property. + new_cache_line_size = global_cache_line_size + 512 + error = self.dbg.SetInternalVariable(property_name, + str(new_cache_line_size), + self.dbg.GetInstanceName()) + self.assertTrue(error.Success(), + property_name + " value was changed successfully") + + # Check that it was set actually. + self.assertEqual(get_cache_line_size(), new_cache_line_size) + + # Run any command to initialize CommandInterpreter's execution context. + self.runCmd("target list") + + # Test the local property again, is it set to new_cache_line_size? + self.assertEqual(get_cache_line_size(), new_cache_line_size)
diff --git a/src/llvm-project/lldb/test/API/python_api/debugger/main.cpp b/src/llvm-project/lldb/test/API/python_api/debugger/main.cpp new file mode 100644 index 0000000..4b4ca68 --- /dev/null +++ b/src/llvm-project/lldb/test/API/python_api/debugger/main.cpp
@@ -0,0 +1,9 @@ +// This simple program is to test the lldb Python API SBDebugger. + +int func(int val) { + return val - 1; +} + +int main (int argc, char const *argv[]) { + return func(argc); +}
diff --git a/src/llvm-project/lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/src/llvm-project/lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index 65c4dac..d69e13f 100644 --- a/src/llvm-project/lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/src/llvm-project/lldb/test/API/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -25,7 +25,6 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True - @add_test_categories(['pyapi']) def test_SBAddress(self): obj = lldb.SBAddress() if self.TraceOn(): @@ -35,7 +34,6 @@ import sb_address sb_address.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBBlock(self): obj = lldb.SBBlock() if self.TraceOn(): @@ -45,7 +43,6 @@ import sb_block sb_block.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBBreakpoint(self): obj = lldb.SBBreakpoint() if self.TraceOn(): @@ -55,7 +52,6 @@ import sb_breakpoint sb_breakpoint.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBBreakpointLocation(self): obj = lldb.SBBreakpointLocation() if self.TraceOn(): @@ -65,7 +61,6 @@ import sb_breakpointlocation sb_breakpointlocation.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBBreakpointName(self): obj = lldb.SBBreakpointName() if self.TraceOn(): @@ -75,7 +70,6 @@ import sb_breakpointname sb_breakpointname.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBBroadcaster(self): obj = lldb.SBBroadcaster() if self.TraceOn(): @@ -85,7 +79,6 @@ import sb_broadcaster sb_broadcaster.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBCommandReturnObject(self): """SBCommandReturnObject object is valid after default construction.""" obj = lldb.SBCommandReturnObject() @@ -93,7 +86,6 @@ print(obj) self.assertTrue(obj) - @add_test_categories(['pyapi']) def test_SBCommunication(self): obj = lldb.SBCommunication() if self.TraceOn(): @@ -103,7 +95,6 @@ import sb_communication sb_communication.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBCompileUnit(self): obj = lldb.SBCompileUnit() if self.TraceOn(): @@ -113,7 +104,6 @@ import sb_compileunit sb_compileunit.fuzz_obj(obj) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_SBDebugger(self): obj = lldb.SBDebugger() @@ -124,7 +114,6 @@ import sb_debugger sb_debugger.fuzz_obj(obj) - @add_test_categories(['pyapi']) # darwin: This test passes with swig 3.0.2, fails w/3.0.5 other tests fail # with 2.0.12 http://llvm.org/pr23488 def test_SBError(self): @@ -136,7 +125,6 @@ import sb_error sb_error.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBEvent(self): obj = lldb.SBEvent() # This is just to test that typemap, as defined in lldb.swig, works. @@ -148,7 +136,6 @@ import sb_event sb_event.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBFileSpec(self): obj = lldb.SBFileSpec() # This is just to test that FileSpec(None) does not crash. @@ -160,7 +147,6 @@ import sb_filespec sb_filespec.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBFrame(self): obj = lldb.SBFrame() if self.TraceOn(): @@ -170,7 +156,6 @@ import sb_frame sb_frame.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBFunction(self): obj = lldb.SBFunction() if self.TraceOn(): @@ -180,7 +165,6 @@ import sb_function sb_function.fuzz_obj(obj) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_SBFile(self): sbf = lldb.SBFile() @@ -194,7 +178,6 @@ self.assertEqual(n, 0) self.assertTrue(e.Fail()) - @add_test_categories(['pyapi']) def test_SBInstruction(self): obj = lldb.SBInstruction() if self.TraceOn(): @@ -204,7 +187,6 @@ import sb_instruction sb_instruction.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBInstructionList(self): obj = lldb.SBInstructionList() if self.TraceOn(): @@ -214,7 +196,6 @@ import sb_instructionlist sb_instructionlist.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBLineEntry(self): obj = lldb.SBLineEntry() if self.TraceOn(): @@ -224,7 +205,6 @@ import sb_lineentry sb_lineentry.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBListener(self): obj = lldb.SBListener() if self.TraceOn(): @@ -234,7 +214,6 @@ import sb_listener sb_listener.fuzz_obj(obj) - @add_test_categories(['pyapi']) # Py3 asserts due to a bug in SWIG. Trying to upstream a patch to fix # this in 3.0.8 @skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)]) @@ -247,7 +226,6 @@ import sb_module sb_module.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBProcess(self): obj = lldb.SBProcess() if self.TraceOn(): @@ -257,7 +235,6 @@ import sb_process sb_process.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBProcessInfo(self): obj = lldb.SBProcessInfo() if self.TraceOn(): @@ -267,7 +244,6 @@ import sb_process_info sb_process_info.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBSection(self): obj = lldb.SBSection() if self.TraceOn(): @@ -277,7 +253,6 @@ import sb_section sb_section.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBStream(self): """SBStream object is valid after default construction.""" obj = lldb.SBStream() @@ -285,7 +260,6 @@ print(obj) self.assertTrue(obj) - @add_test_categories(['pyapi']) def test_SBStringList(self): obj = lldb.SBStringList() if self.TraceOn(): @@ -295,7 +269,6 @@ import sb_stringlist sb_stringlist.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBSymbol(self): obj = lldb.SBSymbol() if self.TraceOn(): @@ -305,7 +278,6 @@ import sb_symbol sb_symbol.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBSymbolContext(self): obj = lldb.SBSymbolContext() if self.TraceOn(): @@ -315,7 +287,6 @@ import sb_symbolcontext sb_symbolcontext.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBSymbolContextList(self): """SBSymbolContextList object is valid after default construction.""" obj = lldb.SBSymbolContextList() @@ -323,7 +294,6 @@ print(obj) self.assertTrue(obj) - @add_test_categories(['pyapi']) def test_SBTarget(self): obj = lldb.SBTarget() if self.TraceOn(): @@ -333,7 +303,6 @@ import sb_target sb_target.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBThread(self): obj = lldb.SBThread() if self.TraceOn(): @@ -343,7 +312,6 @@ import sb_thread sb_thread.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBType(self): try: obj = lldb.SBType() @@ -361,7 +329,6 @@ import sb_type sb_type.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBTypeList(self): """SBTypeList object is valid after default construction.""" obj = lldb.SBTypeList() @@ -369,7 +336,6 @@ print(obj) self.assertTrue(obj) - @add_test_categories(['pyapi']) def test_SBValue(self): obj = lldb.SBValue() if self.TraceOn(): @@ -379,7 +345,6 @@ import sb_value sb_value.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBValueList(self): obj = lldb.SBValueList() if self.TraceOn(): @@ -389,7 +354,6 @@ import sb_valuelist sb_valuelist.fuzz_obj(obj) - @add_test_categories(['pyapi']) def test_SBWatchpoint(self): obj = lldb.SBWatchpoint() if self.TraceOn():
diff --git a/src/llvm-project/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py b/src/llvm-project/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py index 49992f4..d6e0b32 100644 --- a/src/llvm-project/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py +++ b/src/llvm-project/lldb/test/API/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -16,7 +16,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) @no_debug_info_test @skipIfRemote @skipIfReproducer # GetInstructions is not instrumented. @@ -33,6 +32,12 @@ elif re.match("powerpc64le", arch): target = self.dbg.CreateTargetWithFileAndTargetTriple("", "powerpc64le") raw_bytes = bytearray([0x00, 0x00, 0x80, 0x38]) + elif arch == "aarch64": + target = self.dbg.CreateTargetWithFileAndTargetTriple("", "aarch64") + raw_bytes = bytearray([0x60, 0x0c, 0x80, 0x52]) + elif arch == "arm": + target = self.dbg.CreateTargetWithFileAndTargetTriple("", "arm") + raw_bytes = bytearray([0x63, 0x30, 0xa0, 0xe3]) else: target = self.dbg.CreateTargetWithFileAndTargetTriple("", "x86_64") raw_bytes = bytearray([0x48, 0x89, 0xe5]) @@ -47,13 +52,19 @@ print("Raw bytes: ", [hex(x) for x in raw_bytes]) print("Disassembled%s" % str(inst)) if re.match("mips", arch): - self.assertTrue(inst.GetMnemonic(target) == "move") - self.assertTrue(inst.GetOperands(target) == + self.assertEqual(inst.GetMnemonic(target), "move") + self.assertEqual(inst.GetOperands(target), '$' + "fp, " + '$' + "sp") elif re.match("powerpc64le", arch): - self.assertTrue(inst.GetMnemonic(target) == "li") - self.assertTrue(inst.GetOperands(target) == "4, 0") + self.assertEqual(inst.GetMnemonic(target), "li") + self.assertEqual(inst.GetOperands(target), "4, 0") + elif arch == "aarch64": + self.assertEqual(inst.GetMnemonic(target), "mov") + self.assertEqual(inst.GetOperands(target), "w0, #0x63") + elif arch == "arm": + self.assertEqual(inst.GetMnemonic(target), "mov") + self.assertEqual(inst.GetOperands(target), "r3, #99") else: - self.assertTrue(inst.GetMnemonic(target) == "movq") - self.assertTrue(inst.GetOperands(target) == + self.assertEqual(inst.GetMnemonic(target), "movq") + self.assertEqual(inst.GetOperands(target), '%' + "rsp, " + '%' + "rbp")
diff --git a/src/llvm-project/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py b/src/llvm-project/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py index fd5c9ec..9260b72 100644 --- a/src/llvm-project/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py +++ b/src/llvm-project/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
@@ -17,7 +17,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) @no_debug_info_test @skipIfLLVMTargetMissing("ARM") @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. @@ -76,4 +75,4 @@ print("Raw bytes: ", [hex(x) for x in raw_bytes]) print("Disassembled%s" % str(inst)) - self.assertTrue(inst.GetMnemonic(target) == "vst1.64") + self.assertEqual(inst.GetMnemonic(target), "vst1.64")
diff --git a/src/llvm-project/lldb/test/API/python_api/event/TestEvents.py b/src/llvm-project/lldb/test/API/python_api/event/TestEvents.py index 238e9eb..95cf5b2 100644 --- a/src/llvm-project/lldb/test/API/python_api/event/TestEvents.py +++ b/src/llvm-project/lldb/test/API/python_api/event/TestEvents.py
@@ -26,7 +26,6 @@ self.line = line_number( 'main.c', '// Find the line number of function "c" here.') - @add_test_categories(['pyapi']) @expectedFailureAll( oslist=["linux"], bugnumber="llvm.org/pr23730 Flaky, fails ~1/10 cases") @@ -62,8 +61,8 @@ False, # Stop at entry error) # error - self.assertTrue( - process.GetState() == lldb.eStateStopped, + self.assertEqual( + process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) # Create an empty event object. @@ -119,7 +118,6 @@ # Shouldn't we be testing against some kind of expectation here? - @add_test_categories(['pyapi']) @expectedFlakeyLinux("llvm.org/pr23730") # Flaky, fails ~1/100 cases @skipIfWindows # This is flakey on Windows AND when it fails, it hangs: llvm.org/pr38373 @skipIfNetBSD @@ -197,7 +195,6 @@ self.assertTrue(event, "My listening thread successfully received an event") - @add_test_categories(['pyapi']) @expectedFailureAll( oslist=["linux"], bugnumber="llvm.org/pr23617 Flaky, fails ~1/10 cases") @@ -315,5 +312,5 @@ my_thread.join() # The final judgement. :-) - self.assertTrue(self.state == 'stopped', + self.assertEqual(self.state, 'stopped', "Both expected state changed events received")
diff --git a/src/llvm-project/lldb/test/API/python_api/file_handle/TestFileHandle.py b/src/llvm-project/lldb/test/API/python_api/file_handle/TestFileHandle.py index bbcb112..286b3ee 100644 --- a/src/llvm-project/lldb/test/API/python_api/file_handle/TestFileHandle.py +++ b/src/llvm-project/lldb/test/API/python_api/file_handle/TestFileHandle.py
@@ -119,7 +119,6 @@ return ret.GetOutput() - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_legacy_file_out_script(self): with open(self.out_filename, 'w') as f: @@ -135,7 +134,6 @@ self.assertEqual(readStrippedLines(f), ['2', 'FOO']) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_legacy_file_out(self): with open(self.out_filename, 'w') as f: @@ -144,7 +142,6 @@ with open(self.out_filename, 'r') as f: self.assertIn('deadbeef', f.read()) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_legacy_file_err_with_get(self): with open(self.out_filename, 'w') as f: @@ -159,7 +156,6 @@ self.assertTrue(re.search(r'FOOBAR', errors)) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_legacy_file_err(self): with open(self.out_filename, 'w') as f: @@ -169,7 +165,6 @@ self.assertIn("is not a valid command", f.read()) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_legacy_file_error(self): with open(self.out_filename, 'w') as f: @@ -179,7 +174,6 @@ errors = f.read() self.assertTrue(re.search(r'error:.*lolwut', errors)) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_type_errors(self): sbf = lldb.SBFile() @@ -190,7 +184,6 @@ self.assertRaises(Exception, sbf.Read, u"ham sandwich") - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_fileno(self): with open(self.out_filename, 'w') as f: @@ -205,7 +198,6 @@ self.assertEqual(readStrippedLines(f), ['FOO', 'BAR']) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write(self): with open(self.out_filename, 'w') as f: @@ -219,7 +211,6 @@ self.assertEqual(f.read().strip(), 'FOO') - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_read_fileno(self): with open(self.out_filename, 'w') as f: @@ -233,7 +224,6 @@ self.assertEqual(buffer[:n], b'FOO') - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_read(self): with open(self.out_filename, 'w') as f: @@ -249,7 +239,6 @@ self.assertTrue(f.closed) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_fileno_out(self): with open(self.out_filename, 'w') as f: @@ -264,7 +253,6 @@ self.assertEqual(readStrippedLines(f), ['3', 'quux']) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_fileno_help(self): with open(self.out_filename, 'w') as f: @@ -276,7 +264,6 @@ self.assertTrue(re.search(r'Show a list of all debugger commands', f.read())) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_help(self): with open(self.out_filename, 'w') as f: @@ -287,7 +274,6 @@ self.assertIn('Show a list of all debugger commands', f.read()) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_immediate(self): with open(self.out_filename, 'w') as f: @@ -304,7 +290,6 @@ self.assertTrue(re.search(r'QUUX', output)) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_immediate_string(self): @@ -321,7 +306,6 @@ self.assertTrue(re.search(r'QUUX', output)) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_immediate_sbfile_string(self): @@ -337,7 +321,6 @@ self.assertTrue(re.search(r'Show a list of all debugger commands', output)) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_fileno_inout(self): with open(self.in_filename, 'w') as f: @@ -361,7 +344,6 @@ self.assertTrue(re.search(r'Show a list of all debugger commands', f.read())) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_inout(self): with open(self.in_filename, 'w') as f: @@ -380,7 +362,6 @@ self.assertIn('Show a list of all debugger commands', output) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_binary_inout(self): with open(self.in_filename, 'w') as f: @@ -399,7 +380,6 @@ self.assertIn('Show a list of all debugger commands', output) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_string_inout(self): @@ -417,7 +397,6 @@ self.assertIn('0xfff', output) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_bytes_inout(self): @@ -435,7 +414,6 @@ self.assertIn(b'Set a breakpoint', output) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_fileno_error(self): with open(self.out_filename, 'w') as f: @@ -454,7 +432,6 @@ self.assertTrue(re.search(r'zork', errors)) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_replace_stdout(self): f = io.StringIO() @@ -465,7 +442,6 @@ self.assertEqual(sys.stdout, f) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_replace_stdout_with_nonfile(self): f = io.StringIO() @@ -481,7 +457,6 @@ self.assertEqual(f.getvalue(), "FOO") - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_borrowed(self): with open(self.out_filename, 'w') as f: @@ -497,7 +472,6 @@ - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_forced(self): @@ -519,7 +493,6 @@ self.assertEqual(f.read().strip(), 'FOO') - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_forced_borrowed(self): @@ -541,7 +514,6 @@ self.assertEqual(f.read().strip(), 'FOO') - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_string(self): @@ -555,7 +527,6 @@ self.assertTrue(f.closed) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_string_out(self): @@ -566,7 +537,6 @@ self.assertEqual(f.getvalue().strip(), "'foobar'") - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_string_error(self): @@ -578,7 +548,6 @@ self.assertTrue(re.search(r'error:.*lolwut', errors)) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_bytes(self): @@ -591,7 +560,6 @@ sbf.Close() self.assertTrue(f.closed) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_read_string(self): @@ -603,7 +571,6 @@ self.assertEqual(buf[:n], b'zork') - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_read_string_one_byte(self): @@ -616,7 +583,6 @@ self.assertEqual(e.GetCString(), "can't read less than 6 bytes from a utf8 text stream") - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_read_bytes(self): @@ -628,7 +594,6 @@ self.assertEqual(buf[:n], b'zork') - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_out(self): @@ -641,7 +606,6 @@ self.assertEqual(f.read().strip(), '4') - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_file_out(self): @@ -653,7 +617,6 @@ self.assertEqual(f.read().strip(), '4') - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_error(self): with open(self.out_filename, 'w') as f: @@ -666,7 +629,6 @@ self.assertTrue(re.search(r'error:.*lolwut', errors)) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_file_error(self): with open(self.out_filename, 'w') as f: @@ -678,7 +640,6 @@ self.assertTrue(re.search(r'error:.*lolwut', errors)) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_exceptions(self): self.assertRaises(Exception, lldb.SBFile, None) @@ -697,7 +658,6 @@ self.assertIn('OH NOE', error.GetCString()) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_exceptions_logged(self): @@ -709,7 +669,6 @@ self.assertTrue(any('OH NOE' in msg for msg in messages)) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_flush(self): @@ -740,7 +699,6 @@ self.assertFalse(f.closed) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_fileno_flush(self): with open(self.out_filename, 'w') as f: @@ -762,7 +720,6 @@ self.assertEqual(f.read(), 'foobar') - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_close(self): with open(self.out_filename, 'w') as f: @@ -781,7 +738,6 @@ self.assertTrue(re.search(r'ZAP', output)) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_stdout(self): @@ -792,7 +748,6 @@ self.assertEqual(f.getvalue().strip().split(), ["foobar", "7"]) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_stdout_file(self): with open(self.out_filename, 'w') as f: @@ -808,7 +763,6 @@ self.assertEqual(lines, ["foobar"]) - @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_identity(self): @@ -865,7 +819,6 @@ self.assertEqual("foobar", f.read().strip()) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_back_and_forth(self): with open(self.out_filename, 'w') as f: @@ -885,7 +838,6 @@ self.assertEqual(list(range(10)), list(map(int, f.read().strip().split()))) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_set_filehandle_none(self): self.assertRaises(Exception, self.dbg.SetOutputFile, None) @@ -924,7 +876,6 @@ self.assertEqual(sbf.GetFile().fileno(), 0) - @add_test_categories(['pyapi']) @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbstream(self):
diff --git a/src/llvm-project/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py b/src/llvm-project/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py index 4042052..727c114 100644 --- a/src/llvm-project/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py +++ b/src/llvm-project/lldb/test/API/python_api/findvalue_duplist/TestSBFrameFindValue.py
@@ -13,7 +13,6 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True - @add_test_categories(['pyapi']) def test_formatters_api(self): """Test that SBFrame::FindValue finds things but does not duplicate the entire variables list""" self.build()
diff --git a/src/llvm-project/lldb/test/API/python_api/formatters/TestFormattersSBAPI.py b/src/llvm-project/lldb/test/API/python_api/formatters/TestFormattersSBAPI.py index f01d7c4..ac135b9 100644 --- a/src/llvm-project/lldb/test/API/python_api/formatters/TestFormattersSBAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/formatters/TestFormattersSBAPI.py
@@ -19,7 +19,6 @@ TestBase.setUp(self) self.line = line_number('main.cpp', '// Set break point at this line.') - @add_test_categories(['pyapi']) def test_formatters_api(self): """Test Python APIs for working with formatters""" self.build() @@ -128,8 +127,8 @@ filter = lldb.SBTypeFilter(0) filter.AppendExpressionPath("A") filter.AppendExpressionPath("D") - self.assertTrue( - filter.GetNumberOfExpressionPaths() == 2, + self.assertEqual( + filter.GetNumberOfExpressionPaths(), 2, "filter with two items does not have two items") category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"), filter) @@ -180,11 +179,11 @@ foo_var.GetDeclaration().IsValid(), 'foo declaration is invalid') - self.assertTrue( - foo_var.GetNumChildren() == 2, + self.assertEqual( + foo_var.GetNumChildren(), 2, 'synthetic value has wrong number of child items (synth)') - self.assertTrue( - foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1, + self.assertEqual( + foo_var.GetChildMemberWithName('X').GetValueAsUnsigned(), 1, 'foo_synth.X has wrong value (synth)') self.assertFalse( foo_var.GetChildMemberWithName('B').IsValid(), @@ -210,14 +209,14 @@ ).GetSelectedThread().GetSelectedFrame().FindVariable('foo') self.assertTrue(foo_var.IsValid(), 'could not find foo') - self.assertTrue( - foo_var.GetNumChildren() == 2, + self.assertEqual( + foo_var.GetNumChildren(), 2, 'synthetic value has wrong number of child items (filter)') - self.assertTrue( - foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 0, + self.assertEqual( + foo_var.GetChildMemberWithName('X').GetValueAsUnsigned(), 0, 'foo_synth.X has wrong value (filter)') - self.assertTrue( - foo_var.GetChildMemberWithName('A').GetValueAsUnsigned() == 1, + self.assertEqual( + foo_var.GetChildMemberWithName('A').GetValueAsUnsigned(), 1, 'foo_synth.A has wrong value (filter)') self.assertTrue(filter.ReplaceExpressionPathAtIndex( @@ -240,20 +239,20 @@ foo_var = self.dbg.GetSelectedTarget().GetProcess( ).GetSelectedThread().GetSelectedFrame().FindVariable('foo') self.assertTrue(foo_var.IsValid(), 'could not find foo') - self.assertTrue( - foo_var.GetChildMemberWithName('C').GetValueAsUnsigned() == ord('e'), + self.assertEqual( + foo_var.GetChildMemberWithName('C').GetValueAsUnsigned(), ord('e'), 'foo_synth.C has wrong value (filter)') chosen = self.dbg.GetFilterForType( lldb.SBTypeNameSpecifier("JustAStruct")) - self.assertTrue( - chosen.count == 2, + self.assertEqual( + chosen.count, 2, "wrong filter found for JustAStruct") - self.assertTrue( - chosen.GetExpressionPathAtIndex(0) == 'C', + self.assertEqual( + chosen.GetExpressionPathAtIndex(0), 'C', "wrong item at index 0 for JustAStruct") - self.assertTrue( - chosen.GetExpressionPathAtIndex(1) == 'F', + self.assertEqual( + chosen.GetExpressionPathAtIndex(1), 'F', "wrong item at index 1 for JustAStruct") self.assertFalse( @@ -420,8 +419,8 @@ self.assertTrue( summary.IsValid(), "no summary found for foo* when one was in place") - self.assertTrue( - summary.GetData() == "hello static world", + self.assertEqual( + summary.GetData(), "hello static world", "wrong summary found for foo*") self.expect("frame variable e1", substrs=["I am an empty Empty1 {}"]) @@ -436,7 +435,6 @@ lldb.eLanguageTypeObjC) is not None, "ObjC category is None") - @add_test_categories(['pyapi']) def test_force_synth_off(self): """Test that one can have the public API return non-synthetic SBValues if desired""" self.build(dictionary={'EXE': 'no_synth'}) @@ -475,8 +473,8 @@ int_vector = frame.FindVariable("int_vector") if self.TraceOn(): print(int_vector) - self.assertTrue( - int_vector.GetNumChildren() == 0, + self.assertEqual( + int_vector.GetNumChildren(), 0, 'synthetic vector is empty') self.runCmd('settings set target.enable-synthetic-value false') @@ -495,6 +493,6 @@ int_vector = frame.FindVariable("int_vector") if self.TraceOn(): print(int_vector) - self.assertTrue( - int_vector.GetNumChildren() == 0, + self.assertEqual( + int_vector.GetNumChildren(), 0, 'synthetic vector is still empty')
diff --git a/src/llvm-project/lldb/test/API/python_api/frame/TestFrames.py b/src/llvm-project/lldb/test/API/python_api/frame/TestFrames.py index 1ec66a3..f02257a 100644 --- a/src/llvm-project/lldb/test/API/python_api/frame/TestFrames.py +++ b/src/llvm-project/lldb/test/API/python_api/frame/TestFrames.py
@@ -16,7 +16,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) def test_get_arg_vals_for_call_stack(self): """Exercise SBFrame.GetVariables() API to get argument vals.""" self.build() @@ -38,7 +37,7 @@ None, None, self.get_process_working_directory()) process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) # Keeps track of the number of times 'a' is called where it is within a @@ -88,25 +87,26 @@ # instruction as PC. if self.getArchitecture() in ['arm', 'armv7', 'armv7k']: pc_value_int &= ~1 - self.assertTrue( - pc_value_int == frame.GetPC(), + self.assertEqual( + pc_value_int, frame.GetPC(), "PC gotten as a value should equal frame's GetPC") sp_value = gpr_reg_set.GetChildMemberWithName("sp") self.assertTrue( sp_value, "We should have a valid Stack Pointer.") - self.assertTrue(int(sp_value.GetValue(), 0) == frame.GetSP( - ), "SP gotten as a value should equal frame's GetSP") + self.assertEqual( + int(sp_value.GetValue(), 0), frame.GetSP(), + "SP gotten as a value should equal frame's GetSP") print("---", file=session) process.Continue() # At this point, the inferior process should have exited. - self.assertTrue( - process.GetState() == lldb.eStateExited, + self.assertEqual( + process.GetState(), lldb.eStateExited, PROCESS_EXITED) # Expect to find 'a' on the call stacks two times. - self.assertTrue(callsOfA == 2, + self.assertEqual(callsOfA, 2, "Expect to find 'a' on the call stacks two times") # By design, the 'a' call frame has the following arg vals: # o a((int)val=1, (char)ch='A') @@ -119,7 +119,6 @@ substrs=["a((int)val=1, (char)ch='A')", "a((int)val=3, (char)ch='A')"]) - @add_test_categories(['pyapi']) def test_frame_api_boundary_condition(self): """Exercise SBFrame APIs with boundary condition inputs.""" self.build() @@ -141,7 +140,7 @@ None, None, self.get_process_working_directory()) process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) thread = lldbutil.get_stopped_thread( @@ -161,7 +160,6 @@ frame.EvaluateExpression(None) - @add_test_categories(['pyapi']) def test_frame_api_IsEqual(self): """Exercise SBFrame API IsEqual.""" self.build() @@ -183,7 +181,7 @@ None, None, self.get_process_working_directory()) process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) thread = lldbutil.get_stopped_thread(
diff --git a/src/llvm-project/lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py b/src/llvm-project/lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py index eb40b4c..aa8c9c3 100644 --- a/src/llvm-project/lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py +++ b/src/llvm-project/lldb/test/API/python_api/frame/inlines/TestInlinedFrame.py
@@ -25,7 +25,6 @@ self.second_stop = line_number( self.source, '// This should correspond to the second break stop.') - @add_test_categories(['pyapi']) def test_stop_at_outer_inline(self): """Exercise SBFrame.IsInlined() and SBFrame.GetFunctionName().""" self.build() @@ -47,7 +46,7 @@ None, None, self.get_process_working_directory()) process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) import lldbsuite.test.lldbutil as lldbutil @@ -70,7 +69,7 @@ frame0 = thread.GetFrameAtIndex(0) if frame0.IsInlined(): filename = frame0.GetLineEntry().GetFileSpec().GetFilename() - self.assertTrue(filename == self.source) + self.assertEqual(filename, self.source) self.expect( stack_traces1, "First stop at %s:%d" % (self.source, self.first_stop), exe=False, substrs=[ @@ -79,7 +78,7 @@ # Expect to break again for the second time. process.Continue() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) stack_traces2 = lldbutil.print_stacktraces( process, string_buffer=True)
diff --git a/src/llvm-project/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py b/src/llvm-project/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py index 01d26da..c884241 100644 --- a/src/llvm-project/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/function_symbol/TestDisasmAPI.py
@@ -24,7 +24,6 @@ self.line2 = line_number( 'main.c', '// Find the line number for breakpoint 2 here.') - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765') def test(self): """Exercise getting SBAddress objects, disassembly, and SBAddress APIs.""" @@ -53,7 +52,7 @@ self.assertTrue(process, PROCESS_IS_VALID) # Frame #0 should be on self.line1. - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -61,7 +60,7 @@ "There should be a thread stopped due to breakpoint condition") frame0 = thread.GetFrameAtIndex(0) lineEntry = frame0.GetLineEntry() - self.assertTrue(lineEntry.GetLine() == self.line1) + self.assertEqual(lineEntry.GetLine(), self.line1) address1 = lineEntry.GetStartAddress() self.trace("address1:", address1) @@ -76,7 +75,7 @@ # Continue the inferior, the breakpoint 2 should be hit. process.Continue() - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -84,7 +83,7 @@ "There should be a thread stopped due to breakpoint condition") frame0 = thread.GetFrameAtIndex(0) lineEntry = frame0.GetLineEntry() - self.assertTrue(lineEntry.GetLine() == self.line2) + self.assertEqual(lineEntry.GetLine(), self.line2) # Verify that the symbol and the function has the same address range # per function 'a'.
diff --git a/src/llvm-project/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py b/src/llvm-project/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py index c5bcb15..14b01d5 100644 --- a/src/llvm-project/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/function_symbol/TestSymbolAPI.py
@@ -24,7 +24,6 @@ self.line2 = line_number( 'main.c', '// Find the line number for breakpoint 2 here.') - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765') def test(self): """Exercise some SBSymbol and SBAddress APIs.""" @@ -53,7 +52,7 @@ self.assertTrue(process, PROCESS_IS_VALID) # Frame #0 should be on self.line1. - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -62,7 +61,7 @@ frame0 = thread.GetFrameAtIndex(0) symbol_line1 = frame0.GetSymbol() # We should have a symbol type of code. - self.assertTrue(symbol_line1.GetType() == lldb.eSymbolTypeCode) + self.assertEqual(symbol_line1.GetType(), lldb.eSymbolTypeCode) addr_line1 = symbol_line1.GetStartAddress() # And a section type of code, too. self.assertTrue(addr_line1.GetSection().GetSectionType() @@ -70,7 +69,7 @@ # Continue the inferior, the breakpoint 2 should be hit. process.Continue() - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -79,7 +78,7 @@ frame0 = thread.GetFrameAtIndex(0) symbol_line2 = frame0.GetSymbol() # We should have a symbol type of code. - self.assertTrue(symbol_line2.GetType() == lldb.eSymbolTypeCode) + self.assertEqual(symbol_line2.GetType(), lldb.eSymbolTypeCode) addr_line2 = symbol_line2.GetStartAddress() # And a section type of code, too. self.assertTrue(addr_line2.GetSection().GetSectionType()
diff --git a/src/llvm-project/lldb/test/API/python_api/hello_world/TestHelloWorld.py b/src/llvm-project/lldb/test/API/python_api/hello_world/TestHelloWorld.py index ea8b9a7..0f616f4 100644 --- a/src/llvm-project/lldb/test/API/python_api/hello_world/TestHelloWorld.py +++ b/src/llvm-project/lldb/test/API/python_api/hello_world/TestHelloWorld.py
@@ -26,7 +26,6 @@ # Call super's tearDown(). TestBase.tearDown(self) - @add_test_categories(['pyapi']) @skipIfiOSSimulator def test_with_process_launch_api(self): """Create target, breakpoint, launch a process, and then kill it.""" @@ -72,7 +71,6 @@ # The breakpoint should have a hit count of 1. self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE) - @add_test_categories(['pyapi']) @skipIfiOSSimulator @skipIfReproducer # File synchronization is not supported during replay. def test_with_attach_to_process_with_id_api(self): @@ -104,7 +102,6 @@ substrs=['main.c:%d' % self.line2, '(int)argc=2']) - @add_test_categories(['pyapi']) @skipIfiOSSimulator @skipIfAsan # FIXME: Hangs indefinitely. @skipIfReproducer # FIXME: Unexpected packet during (active) replay
diff --git a/src/llvm-project/lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py b/src/llvm-project/lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py index a920ce8..151d445 100644 --- a/src/llvm-project/lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/interpreter/TestCommandInterpreterAPI.py
@@ -20,7 +20,6 @@ # Find the line number to break on inside main.cpp. self.line = line_number('main.c', 'Hello world.') - @add_test_categories(['pyapi']) def test_with_process_launch_api(self): """Test the SBCommandInterpreter APIs.""" self.build() @@ -74,7 +73,6 @@ if self.TraceOn(): lldbutil.print_stacktraces(process) - @add_test_categories(['pyapi']) def test_command_output(self): """Test command output handling.""" ci = self.dbg.GetCommandInterpreter()
diff --git a/src/llvm-project/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py b/src/llvm-project/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py index 9f30f6a..2db7fdd 100644 --- a/src/llvm-project/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
@@ -30,7 +30,6 @@ self.dbg.SetOutputFileHandle(self.devnull, False) self.dbg.SetErrorFileHandle (self.devnull, False) - @add_test_categories(['pyapi']) def test_run_session_with_error_and_quit_legacy(self): """Run non-existing and quit command returns appropriate values""" @@ -64,7 +63,6 @@ self.dbg.SetOutputFile(devnull) self.dbg.SetErrorFile(devnull) - @add_test_categories(['pyapi']) def test_run_session_with_error_and_quit(self): """Run non-existing and quit command returns appropriate values""" @@ -75,3 +73,40 @@ self.assertGreater(n_errors, 0) self.assertTrue(quit_requested) self.assertFalse(has_crashed) + +class SBCommandInterpreterRunOptionsCase(TestBase): + + NO_DEBUG_INFO_TESTCASE = True + mydir = TestBase.compute_mydir(__file__) + + def test_command_interpreter_run_options(self): + """Test SBCommandInterpreterRunOptions default values, getters & setters """ + + opts = lldb.SBCommandInterpreterRunOptions() + + # Check getters with default values + self.assertEqual(opts.GetStopOnContinue(), False) + self.assertEqual(opts.GetStopOnError(), False) + self.assertEqual(opts.GetStopOnCrash(), False) + self.assertEqual(opts.GetEchoCommands(), True) + self.assertEqual(opts.GetPrintResults(), True) + self.assertEqual(opts.GetPrintErrors(), True) + self.assertEqual(opts.GetAddToHistory(), True) + + # Invert values + opts.SetStopOnContinue(not opts.GetStopOnContinue()) + opts.SetStopOnError(not opts.GetStopOnError()) + opts.SetStopOnCrash(not opts.GetStopOnCrash()) + opts.SetEchoCommands(not opts.GetEchoCommands()) + opts.SetPrintResults(not opts.GetPrintResults()) + opts.SetPrintErrors(not opts.GetPrintErrors()) + opts.SetAddToHistory(not opts.GetAddToHistory()) + + # Check the value changed + self.assertEqual(opts.GetStopOnContinue(), True) + self.assertEqual(opts.GetStopOnError(), True) + self.assertEqual(opts.GetStopOnCrash(), True) + self.assertEqual(opts.GetEchoCommands(), False) + self.assertEqual(opts.GetPrintResults(), False) + self.assertEqual(opts.GetPrintErrors(), False) + self.assertEqual(opts.GetAddToHistory(), False)
diff --git a/src/llvm-project/lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py b/src/llvm-project/lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py index ec8d1f8..9c69bd9 100644 --- a/src/llvm-project/lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py +++ b/src/llvm-project/lldb/test/API/python_api/lldbutil/frame/TestFrameUtils.py
@@ -22,7 +22,6 @@ self.line = line_number('main.c', "// Find the line number here.") - @add_test_categories(['pyapi']) def test_frame_utils(self): """Test utility functions for the frame object.""" self.build() @@ -40,7 +39,7 @@ if not process: self.fail("SBTarget.LaunchProcess() failed") - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) import lldbsuite.test.lldbutil as lldbutil
diff --git a/src/llvm-project/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py b/src/llvm-project/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py index 050ec87..4fdde97 100644 --- a/src/llvm-project/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py +++ b/src/llvm-project/lldb/test/API/python_api/lldbutil/iter/TestLLDBIterator.py
@@ -23,7 +23,6 @@ 'main.cpp', '// Set break point at this line.') self.line2 = line_number('main.cpp', '// And that line.') - @add_test_categories(['pyapi']) def test_lldb_iter_module(self): """Test module_iter works correctly for SBTarget -> SBModule.""" self.build() @@ -50,16 +49,15 @@ for m in target.module_iter(): mine.append(m) - self.assertTrue(len(yours) == len(mine)) + self.assertEqual(len(yours), len(mine)) for i in range(len(yours)): if self.TraceOn(): print("yours[%d]='%s'" % (i, get_description(yours[i]))) print("mine[%d]='%s'" % (i, get_description(mine[i]))) - self.assertTrue( - yours[i] == mine[i], + self.assertEqual( + yours[i], mine[i], "UUID+FileSpec of yours[{0}] and mine[{0}] matches".format(i)) - @add_test_categories(['pyapi']) def test_lldb_iter_breakpoint(self): """Test breakpoint_iter works correctly for SBTarget -> SBBreakpoint.""" self.build() @@ -73,7 +71,7 @@ breakpoint = target.BreakpointCreateByLocation("main.cpp", self.line2) self.assertTrue(breakpoint, VALID_BREAKPOINT) - self.assertTrue(target.GetNumBreakpoints() == 2) + self.assertEqual(target.GetNumBreakpoints(), 2) from lldbsuite.test.lldbutil import get_description yours = [] @@ -83,15 +81,14 @@ for b in target.breakpoint_iter(): mine.append(b) - self.assertTrue(len(yours) == len(mine)) + self.assertEqual(len(yours), len(mine)) for i in range(len(yours)): if self.TraceOn(): print("yours[%d]='%s'" % (i, get_description(yours[i]))) print("mine[%d]='%s'" % (i, get_description(mine[i]))) - self.assertTrue(yours[i] == mine[i], + self.assertEqual(yours[i], mine[i], "ID of yours[{0}] and mine[{0}] matches".format(i)) - @add_test_categories(['pyapi']) def test_lldb_iter_frame(self): """Test iterator works correctly for SBProcess->SBThread->SBFrame.""" self.build() @@ -119,7 +116,7 @@ if thread.GetStopReason() == lldb.eStopReasonBreakpoint: stopped_due_to_breakpoint = True for frame in thread: - self.assertTrue(frame.GetThread().GetThreadID() == ID) + self.assertEqual(frame.GetThread().GetThreadID(), ID) if self.TraceOn(): print(frame)
diff --git a/src/llvm-project/lldb/test/API/python_api/lldbutil/iter/TestRegistersIterator.py b/src/llvm-project/lldb/test/API/python_api/lldbutil/iter/TestRegistersIterator.py index fbb8bff..6c8c045 100644 --- a/src/llvm-project/lldb/test/API/python_api/lldbutil/iter/TestRegistersIterator.py +++ b/src/llvm-project/lldb/test/API/python_api/lldbutil/iter/TestRegistersIterator.py
@@ -22,7 +22,6 @@ self.line1 = line_number( 'main.cpp', '// Set break point at this line.') - @add_test_categories(['pyapi']) def test_iter_registers(self): """Test iterator works correctly for lldbutil.iter_registers().""" self.build()
diff --git a/src/llvm-project/lldb/test/API/python_api/lldbutil/process/TestPrintStackTraces.py b/src/llvm-project/lldb/test/API/python_api/lldbutil/process/TestPrintStackTraces.py index 123b60e..4ac7b7c 100644 --- a/src/llvm-project/lldb/test/API/python_api/lldbutil/process/TestPrintStackTraces.py +++ b/src/llvm-project/lldb/test/API/python_api/lldbutil/process/TestPrintStackTraces.py
@@ -14,7 +14,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) def test_stack_traces(self): """Test SBprocess and SBThread APIs with printing of the stack traces.""" self.build()
diff --git a/src/llvm-project/lldb/test/API/python_api/module_section/TestModuleAndSection.py b/src/llvm-project/lldb/test/API/python_api/module_section/TestModuleAndSection.py index 95d4576..3bb26a2 100644 --- a/src/llvm-project/lldb/test/API/python_api/module_section/TestModuleAndSection.py +++ b/src/llvm-project/lldb/test/API/python_api/module_section/TestModuleAndSection.py
@@ -19,7 +19,6 @@ # Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into # SWIG 3.0.8. @skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)]) - @add_test_categories(['pyapi']) def test_module_and_section(self): """Test module and section APIs.""" self.build() @@ -71,7 +70,6 @@ symbol_type_to_str( sym.GetType())) - @add_test_categories(['pyapi']) def test_module_and_section_boundary_condition(self): """Test module and section APIs by passing None when it expects a Python string.""" self.build() @@ -112,7 +110,6 @@ if sec1: sec1.FindSubSection(None) - @add_test_categories(['pyapi']) def test_module_compile_unit_iter(self): """Test module's compile unit iterator APIs.""" self.build() @@ -140,7 +137,6 @@ for cu in exe_module.compile_unit_iter(): print(cu) - @add_test_categories(['pyapi']) def test_find_compile_units(self): """Exercise SBModule.FindCompileUnits() API.""" d = {'EXE': 'b.out'}
diff --git a/src/llvm-project/lldb/test/API/python_api/name_lookup/TestNameLookup.py b/src/llvm-project/lldb/test/API/python_api/name_lookup/TestNameLookup.py index 7db8b61..c1629f9 100644 --- a/src/llvm-project/lldb/test/API/python_api/name_lookup/TestNameLookup.py +++ b/src/llvm-project/lldb/test/API/python_api/name_lookup/TestNameLookup.py
@@ -15,7 +15,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765') def test_target(self): """Exercise SBTarget.FindFunctions() with various name masks.
diff --git a/src/llvm-project/lldb/test/API/python_api/objc_type/Makefile b/src/llvm-project/lldb/test/API/python_api/objc_type/Makefile index 8b322ff..5f07431 100644 --- a/src/llvm-project/lldb/test/API/python_api/objc_type/Makefile +++ b/src/llvm-project/lldb/test/API/python_api/objc_type/Makefile
@@ -1,8 +1,5 @@ OBJC_SOURCES := main.m - CFLAGS_EXTRAS := -w +LD_EXTRAS := -lobjc - - -LD_EXTRAS := -framework Foundation include Makefile.rules
diff --git a/src/llvm-project/lldb/test/API/python_api/objc_type/TestObjCType.py b/src/llvm-project/lldb/test/API/python_api/objc_type/TestObjCType.py index 8599b8a..aa64244 100644 --- a/src/llvm-project/lldb/test/API/python_api/objc_type/TestObjCType.py +++ b/src/llvm-project/lldb/test/API/python_api/objc_type/TestObjCType.py
@@ -49,12 +49,12 @@ aBar = self.frame().FindVariable("aBar") aBarType = aBar.GetType() self.assertTrue(aBarType.IsValid(), "Bar should be a valid data type") - self.assertTrue( - aBarType.GetName() == "Bar *", + self.assertEqual( + aBarType.GetName(), "Bar *", "Bar has the right name") - self.assertTrue( - aBarType.GetNumberOfDirectBaseClasses() == 1, + self.assertEqual( + aBarType.GetNumberOfDirectBaseClasses(), 1, "Bar has a superclass") aFooType = aBarType.GetDirectBaseClassAtIndex(0) @@ -64,6 +64,6 @@ self.assertEquals(aBarType.GetNumberOfFields(), 1, "Bar has a field") aBarField = aBarType.GetFieldAtIndex(0) - self.assertTrue( - aBarField.GetName() == "_iVar", + self.assertEqual( + aBarField.GetName(), "_iVar", "The field has the right name")
diff --git a/src/llvm-project/lldb/test/API/python_api/objc_type/main.m b/src/llvm-project/lldb/test/API/python_api/objc_type/main.m index 941442f..6075622 100644 --- a/src/llvm-project/lldb/test/API/python_api/objc_type/main.m +++ b/src/llvm-project/lldb/test/API/python_api/objc_type/main.m
@@ -1,4 +1,4 @@ -#import <Foundation/Foundation.h> +#import <objc/NSObject.h> @interface Foo: NSObject {}
diff --git a/src/llvm-project/lldb/test/API/python_api/process/TestProcessAPI.py b/src/llvm-project/lldb/test/API/python_api/process/TestProcessAPI.py index 7174ba1..790d794 100644 --- a/src/llvm-project/lldb/test/API/python_api/process/TestProcessAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/process/TestProcessAPI.py
@@ -23,7 +23,6 @@ "main.cpp", "// Set break point at this line and check variable 'my_char'.") - @add_test_categories(['pyapi']) @skipIfReproducer # SBProcess::ReadMemory is not instrumented. def test_read_memory(self): """Test Python SBProcess.ReadMemory() API.""" @@ -122,7 +121,6 @@ self.fail( "Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output") - @add_test_categories(['pyapi']) @skipIfReproducer # SBProcess::WriteMemory is not instrumented. def test_write_memory(self): """Test Python SBProcess.WriteMemory() API.""" @@ -182,7 +180,6 @@ exe=False, startstr=b'a') - @add_test_categories(['pyapi']) @skipIfReproducer # SBProcess::WriteMemory is not instrumented. def test_access_my_int(self): """Test access 'my_int' using Python SBProcess.GetByteOrder() and other APIs.""" @@ -281,7 +278,6 @@ for i in content: print("byte:", i) - @add_test_categories(['pyapi']) def test_remote_launch(self): """Test SBProcess.RemoteLaunch() API with a process not in eStateConnected, and it should fail.""" self.build() @@ -305,7 +301,6 @@ not success, "RemoteLaunch() should fail for process state != eStateConnected") - @add_test_categories(['pyapi']) def test_get_num_supported_hardware_watchpoints(self): """Test SBProcess.GetNumSupportedHardwareWatchpoints() API with a process.""" self.build() @@ -327,7 +322,6 @@ if self.TraceOn() and error.Success(): print("Number of supported hardware watchpoints: %d" % num) - @add_test_categories(['pyapi']) @no_debug_info_test def test_get_process_info(self): """Test SBProcess::GetProcessInfo() API with a locally launched process.""" @@ -362,6 +356,8 @@ self.assertNotEqual( process_info.GetProcessID(), lldb.LLDB_INVALID_PROCESS_ID, "Process ID is valid") + triple = process_info.GetTriple() + self.assertIsNotNone(triple, "Process has a triple") # Additional process info varies by platform, so just check that # whatever info was retrieved is consistent and nothing blows up. @@ -402,3 +398,58 @@ "Process effective group ID is invalid") process_info.GetParentProcessID() + + def test_allocate_deallocate_memory(self): + """Test Python SBProcess.AllocateMemory() and SBProcess.DeallocateMemory() APIs.""" + self.build() + (target, process, main_thread, main_breakpoint) = lldbutil.run_to_source_breakpoint( + self, "// Set break point at this line", lldb.SBFileSpec("main.cpp")) + + # Allocate a block of memory in the target process + error = lldb.SBError() + addr = process.AllocateMemory(16384, lldb.ePermissionsReadable, error) + if not error.Success() or addr == lldb.LLDB_INVALID_ADDRESS: + self.fail("SBProcess.AllocateMemory() failed") + + # Now use WriteMemory() API to write 'a' into the allocated + # memory. Note that the debugger can do this even though the + # block is not set writable. + result = process.WriteMemory(addr, 'a', error) + if not error.Success() or result != 1: + self.fail("SBProcess.WriteMemory() failed") + + # Read from the memory location. This time it should be 'a'. + # Due to the typemap magic (see lldb.swig), we pass in 1 to ReadMemory and + # expect to get a Python string as the result object! + content = process.ReadMemory(addr, 1, error) + if not error.Success(): + self.fail("SBProcess.ReadMemory() failed") + if self.TraceOn(): + print("memory content:", content) + + self.expect( + content, + "Result from SBProcess.ReadMemory() matches our expected output: 'a'", + exe=False, + startstr=b'a') + + # Verify that the process itself can read the allocated memory + frame = main_thread.GetFrameAtIndex(0) + val = frame.EvaluateExpression( + "test_read(reinterpret_cast<char *>({:#x}))".format(addr)) + self.expect(val.GetValue(), + "Result of test_read() matches expected output 'a'", + exe=False, + startstr="'a'") + + # Verify that the process cannot write into the block + val = frame.EvaluateExpression( + "test_write(reinterpret_cast<char *>({:#x}), 'b')".format(addr)) + if val.GetError().Success(): + self.fail( + "test_write() to allocated memory without write permission unexpectedly succeeded") + + # Deallocate the memory + error = process.DeallocateMemory(addr) + if not error.Success(): + self.fail("SBProcess.DeallocateMemory() failed")
diff --git a/src/llvm-project/lldb/test/API/python_api/process/io/TestProcessIO.py b/src/llvm-project/lldb/test/API/python_api/process/io/TestProcessIO.py index 4646c9d..312cc28 100644 --- a/src/llvm-project/lldb/test/API/python_api/process/io/TestProcessIO.py +++ b/src/llvm-project/lldb/test/API/python_api/process/io/TestProcessIO.py
@@ -32,7 +32,6 @@ self.lines = ["Line 1", "Line 2", "Line 3"] @skipIfWindows # stdio manipulation unsupported on Windows - @add_test_categories(['pyapi']) @expectedFlakeyLinux(bugnumber="llvm.org/pr26437") @skipIfDarwinEmbedded # I/O redirection like this is not supported on remote iOS devices yet <rdar://problem/54581135> def test_stdin_by_api(self): @@ -45,7 +44,6 @@ self.check_process_output(output, output) @skipIfWindows # stdio manipulation unsupported on Windows - @add_test_categories(['pyapi']) @expectedFlakeyLinux(bugnumber="llvm.org/pr26437") def test_stdin_redirection(self): """Exercise SBLaunchInfo::AddOpenFileAction() for STDIN without specifying STDOUT or STDERR.""" @@ -58,7 +56,6 @@ self.check_process_output(output, output) @skipIfWindows # stdio manipulation unsupported on Windows - @add_test_categories(['pyapi']) @expectedFlakeyLinux(bugnumber="llvm.org/pr26437") @skipIfDarwinEmbedded # debugserver can't create/write files on the device def test_stdout_redirection(self): @@ -73,7 +70,6 @@ self.check_process_output(output, error) @skipIfWindows # stdio manipulation unsupported on Windows - @add_test_categories(['pyapi']) @expectedFlakeyLinux(bugnumber="llvm.org/pr26437") @skipIfDarwinEmbedded # debugserver can't create/write files on the device def test_stderr_redirection(self): @@ -88,7 +84,6 @@ self.check_process_output(output, error) @skipIfWindows # stdio manipulation unsupported on Windows - @add_test_categories(['pyapi']) @expectedFlakeyLinux(bugnumber="llvm.org/pr26437") @skipIfDarwinEmbedded # debugserver can't create/write files on the device def test_stdout_stderr_redirection(self): @@ -201,7 +196,7 @@ threads = lldbutil.get_threads_stopped_at_breakpoint( self.process, self.breakpoint) - self.assertTrue(len(threads) == 1) + self.assertEqual(len(threads), 1) self.thread = threads[0] self.frame = self.thread.frames[0] self.assertTrue(self.frame, "Frame 0 is valid.") @@ -217,7 +212,7 @@ # Let process continue so it will exit self.process.Continue() state = self.process.GetState() - self.assertTrue(state == lldb.eStateExited, PROCESS_IS_VALID) + self.assertEqual(state, lldb.eStateExited, PROCESS_IS_VALID) def check_process_output(self, output, error): # Since we launched the process without specifying stdin/out/err,
diff --git a/src/llvm-project/lldb/test/API/python_api/process/main.cpp b/src/llvm-project/lldb/test/API/python_api/process/main.cpp index f3cc7e1..07cde05 100644 --- a/src/llvm-project/lldb/test/API/python_api/process/main.cpp +++ b/src/llvm-project/lldb/test/API/python_api/process/main.cpp
@@ -21,3 +21,13 @@ return 0; // Set break point at this line and check variable 'my_char'. // Use lldb Python API to set memory content for my_int and check the result. } + +char test_read (char *ptr) +{ + return *ptr; +} + +void test_write (char *ptr, char c) +{ + *ptr = c; +}
diff --git a/src/llvm-project/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py b/src/llvm-project/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py index f18b8e3..0e5aa0b 100644 --- a/src/llvm-project/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py +++ b/src/llvm-project/lldb/test/API/python_api/process/read-mem-cstring/TestReadMemCString.py
@@ -48,11 +48,11 @@ # None object. empty_str = process.ReadCStringFromMemory(empty_str_addr, 2048, err) self.assertTrue(err.Success()) - self.assertTrue(empty_str == "") + self.assertEqual(empty_str, "") one_letter_string = process.ReadCStringFromMemory(one_letter_str_addr, 2048, err) self.assertTrue(err.Success()) - self.assertTrue(one_letter_string == "1") + self.assertEqual(one_letter_string, "1") invalid_memory_string = process.ReadCStringFromMemory(invalid_memory_str_addr, 2048, err) self.assertTrue(err.Fail())
diff --git a/src/llvm-project/lldb/test/API/python_api/sbdata/TestSBData.py b/src/llvm-project/lldb/test/API/python_api/sbdata/TestSBData.py index ee04968..258ce51 100644 --- a/src/llvm-project/lldb/test/API/python_api/sbdata/TestSBData.py +++ b/src/llvm-project/lldb/test/API/python_api/sbdata/TestSBData.py
@@ -20,7 +20,6 @@ # Find the line number to break on inside main.cpp. self.line = line_number('main.cpp', '// set breakpoint here') - @add_test_categories(['pyapi']) @skipIfReproducer # SBData::SetData is not instrumented. def test_byte_order_and_address_byte_size(self): """Test the SBData::SetData() to ensure the byte order and address @@ -30,18 +29,17 @@ data = lldb.SBData() data.SetData(error, addr_data, lldb.eByteOrderBig, 4) addr = data.GetAddress(error, 0) - self.assertTrue(addr == 0x11223344); + self.assertEqual(addr, 0x11223344); data.SetData(error, addr_data, lldb.eByteOrderBig, 8) addr = data.GetAddress(error, 0) - self.assertTrue(addr == 0x1122334455667788); + self.assertEqual(addr, 0x1122334455667788); data.SetData(error, addr_data, lldb.eByteOrderLittle, 4) addr = data.GetAddress(error, 0) - self.assertTrue(addr == 0x44332211); + self.assertEqual(addr, 0x44332211); data.SetData(error, addr_data, lldb.eByteOrderLittle, 8) addr = data.GetAddress(error, 0) - self.assertTrue(addr == 0x8877665544332211); + self.assertEqual(addr, 0x8877665544332211); - @add_test_categories(['pyapi']) @skipIfReproducer # SBData::SetData is not instrumented. def test_with_run_command(self): """Test the SBData APIs.""" @@ -146,8 +144,8 @@ self.assertTrue(new_foobar.IsValid()) data = new_foobar.GetData() - self.assertTrue(data.uint32[0] == 8, 'then foo[1].a == 8') - self.assertTrue(data.uint32[1] == 7, 'then foo[1].b == 7') + self.assertEqual(data.uint32[0], 8, 'then foo[1].a == 8') + self.assertEqual(data.uint32[1], 7, 'then foo[1].b == 7') # exploiting that sizeof(uint32) == sizeof(float) self.assertTrue(fabs(data.float[2] - 3.14) < 1, 'foo[1].c == 3.14') @@ -218,7 +216,7 @@ new_object = barfoo.CreateValueFromData( "new_object", data, barfoo.GetType().GetBasicType( lldb.eBasicTypeInt)) - self.assertTrue(new_object.GetValue() == "1", 'new_object == 1') + self.assertEqual(new_object.GetValue(), "1", 'new_object == 1') if data.GetByteOrder() == lldb.eByteOrderBig: data.SetData( @@ -262,12 +260,12 @@ hello_str = "hello!" data2 = lldb.SBData.CreateDataFromCString( process.GetByteOrder(), process.GetAddressByteSize(), hello_str) - self.assertTrue(len(data2.uint8) == len(hello_str)) - self.assertTrue(data2.uint8[0] == 104, 'h == 104') - self.assertTrue(data2.uint8[1] == 101, 'e == 101') - self.assertTrue(data2.uint8[2] == 108, 'l == 108') + self.assertEqual(len(data2.uint8), len(hello_str)) + self.assertEqual(data2.uint8[0], 104, 'h == 104') + self.assertEqual(data2.uint8[1], 101, 'e == 101') + self.assertEqual(data2.uint8[2], 108, 'l == 108') self.assert_data(data2.GetUnsignedInt8, 3, 108) # l - self.assertTrue(data2.uint8[4] == 111, 'o == 111') + self.assertEqual(data2.uint8[4], 111, 'o == 111') self.assert_data(data2.GetUnsignedInt8, 5, 33) # ! uint_lists = [[1, 2, 3, 4, 5], [int(i) for i in [1, 2, 3, 4, 5]]] @@ -415,7 +413,7 @@ data2 = lldb.SBData() data2.SetDataFromCString(hello_str) - self.assertTrue(len(data2.uint8) == len(hello_str)) + self.assertEqual(len(data2.uint8), len(hello_str)) self.assert_data(data2.GetUnsignedInt8, 0, 104) self.assert_data(data2.GetUnsignedInt8, 1, 101) self.assert_data(data2.GetUnsignedInt8, 2, 108) @@ -430,20 +428,20 @@ self.assert_data(data2.GetUnsignedInt64, 24, 4) self.assert_data(data2.GetUnsignedInt64, 32, 5) - self.assertTrue( - data2.uint64[0] == 1, + self.assertEqual( + data2.uint64[0], 1, 'read_data_helper failure: set data2[0] = 1') - self.assertTrue( - data2.uint64[1] == 2, + self.assertEqual( + data2.uint64[1], 2, 'read_data_helper failure: set data2[1] = 2') - self.assertTrue( - data2.uint64[2] == 3, + self.assertEqual( + data2.uint64[2], 3, 'read_data_helper failure: set data2[2] = 3') - self.assertTrue( - data2.uint64[3] == 4, + self.assertEqual( + data2.uint64[3], 4, 'read_data_helper failure: set data2[3] = 4') - self.assertTrue( - data2.uint64[4] == 5, + self.assertEqual( + data2.uint64[4], 5, 'read_data_helper failure: set data2[4] = 5') self.assertTrue( @@ -468,20 +466,20 @@ self.assert_data(data2.GetUnsignedInt32, 12, 4) self.assert_data(data2.GetUnsignedInt32, 16, 5) - self.assertTrue( - data2.uint32[0] == 1, + self.assertEqual( + data2.uint32[0], 1, 'read_data_helper failure: set 32-bit data2[0] = 1') - self.assertTrue( - data2.uint32[1] == 2, + self.assertEqual( + data2.uint32[1], 2, 'read_data_helper failure: set 32-bit data2[1] = 2') - self.assertTrue( - data2.uint32[2] == 3, + self.assertEqual( + data2.uint32[2], 3, 'read_data_helper failure: set 32-bit data2[2] = 3') - self.assertTrue( - data2.uint32[3] == 4, + self.assertEqual( + data2.uint32[3], 4, 'read_data_helper failure: set 32-bit data2[3] = 4') - self.assertTrue( - data2.uint32[4] == 5, + self.assertEqual( + data2.uint32[4], 5, 'read_data_helper failure: set 32-bit data2[4] = 5') data2.SetDataFromDoubleArray([3.14, 6.28, 2.71])
diff --git a/src/llvm-project/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py b/src/llvm-project/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py index 62c3ac2..99369f8 100644 --- a/src/llvm-project/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py +++ b/src/llvm-project/lldb/test/API/python_api/sbenvironment/TestSBEnvironment.py
@@ -30,7 +30,6 @@ - @add_test_categories(['pyapi']) @skipIfRemote # Remote environment not supported. def test_platform_environment(self): env = self.dbg.GetSelectedPlatform().GetEnvironment() @@ -38,7 +37,6 @@ self.assertNotEqual(env.Get("PATH"), None) - @add_test_categories(['pyapi']) def test_launch_info(self): target = self.dbg.CreateTarget("") launch_info = target.GetLaunchInfo() @@ -67,7 +65,6 @@ self.assertEqualEntries(launch_info.GetEnvironment(), ["BAR=foo", "X=y"]) - @add_test_categories(['pyapi']) @skipIfRemote # Remote environment not supported. def test_target_environment(self): env = self.dbg.GetSelectedTarget().GetEnvironment() @@ -85,7 +82,6 @@ env.PutEntry("PATH=#" + path) self.assertEqual(target.GetEnvironment().Get("PATH"), path) - @add_test_categories(['pyapi']) def test_creating_and_modifying_environment(self): env = lldb.SBEnvironment()
diff --git a/src/llvm-project/lldb/test/API/python_api/sbplatform/TestSBPlatform.py b/src/llvm-project/lldb/test/API/python_api/sbplatform/TestSBPlatform.py index 3fa4c10..b354a6e 100644 --- a/src/llvm-project/lldb/test/API/python_api/sbplatform/TestSBPlatform.py +++ b/src/llvm-project/lldb/test/API/python_api/sbplatform/TestSBPlatform.py
@@ -8,7 +8,6 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True - @add_test_categories(['pyapi']) @skipIfRemote # Remote environment not supported. def test_run(self): self.build()
diff --git a/src/llvm-project/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py b/src/llvm-project/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py index a1a3185..26f1791 100644 --- a/src/llvm-project/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py
@@ -18,7 +18,6 @@ def test(self): self.structured_data_api_test() - @add_test_categories(['pyapi']) def structured_data_api_test(self): error = lldb.SBError() s = lldb.SBStream()
diff --git a/src/llvm-project/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py b/src/llvm-project/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py index 410c6c9..8324d23 100644 --- a/src/llvm-project/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py +++ b/src/llvm-project/lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py
@@ -13,7 +13,6 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24772") def test(self): """Test SBValue::Persist""" @@ -57,11 +56,11 @@ self.assertTrue(barPersist.IsValid(), "barPersist is not valid") self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid") - self.assertTrue( - fooPersist.GetValueAsUnsigned(0) == 10, + self.assertEqual( + fooPersist.GetValueAsUnsigned(0), 10, "fooPersist != 10") - self.assertTrue( - barPersist.GetPointeeData().sint32[0] == 4, + self.assertEqual( + barPersist.GetPointeeData().sint32[0], 4, "barPersist != 4") self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85") @@ -71,11 +70,11 @@ self.assertTrue(barPersist.IsValid(), "barPersist is not valid") self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid") - self.assertTrue( - fooPersist.GetValueAsUnsigned(0) == 10, + self.assertEqual( + fooPersist.GetValueAsUnsigned(0), 10, "fooPersist != 10") - self.assertTrue( - barPersist.GetPointeeData().sint32[0] == 4, + self.assertEqual( + barPersist.GetPointeeData().sint32[0], 4, "barPersist != 4") self.assertEquals(bazPersist.GetSummary(), '"85"', "bazPersist != 85")
diff --git a/src/llvm-project/lldb/test/API/python_api/section/TestSectionAPI.py b/src/llvm-project/lldb/test/API/python_api/section/TestSectionAPI.py index 1513b98..bd8e451 100644 --- a/src/llvm-project/lldb/test/API/python_api/section/TestSectionAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/section/TestSectionAPI.py
@@ -13,7 +13,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) def test_get_target_byte_size(self): d = {'EXE': 'b.out'} self.build(dictionary=d)
diff --git a/src/llvm-project/lldb/test/API/python_api/signals/TestSignalsAPI.py b/src/llvm-project/lldb/test/API/python_api/signals/TestSignalsAPI.py index 602fee4..6c535d7 100644 --- a/src/llvm-project/lldb/test/API/python_api/signals/TestSignalsAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/signals/TestSignalsAPI.py
@@ -15,7 +15,6 @@ mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True - @add_test_categories(['pyapi']) @skipIfWindows # Windows doesn't have signals def test_ignore_signal(self): """Test Python SBUnixSignals.Suppress/Stop/Notify() API.""" @@ -48,9 +47,9 @@ unix_signals.SetShouldNotify(sigint, False) process.Continue() - self.assertTrue( - process.state == lldb.eStateExited, + self.assertEqual( + process.state, lldb.eStateExited, "The process should have exited") - self.assertTrue( - process.GetExitStatus() == 0, + self.assertEqual( + process.GetExitStatus(), 0, "The process should have returned 0")
diff --git a/src/llvm-project/lldb/test/API/python_api/symbol-context/TestSymbolContext.py b/src/llvm-project/lldb/test/API/python_api/symbol-context/TestSymbolContext.py index cbe4eff..c02e1bf 100644 --- a/src/llvm-project/lldb/test/API/python_api/symbol-context/TestSymbolContext.py +++ b/src/llvm-project/lldb/test/API/python_api/symbol-context/TestSymbolContext.py
@@ -21,7 +21,6 @@ self.line = line_number( 'main.c', '// Find the line number of function "c" here.') - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") @skipIfReproducer # FIXME: Unexpected packet during (passive) replay def test(self): @@ -49,7 +48,7 @@ self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint") frame0 = thread.GetFrameAtIndex(0) - self.assertTrue(frame0.GetLineEntry().GetLine() == self.line) + self.assertEqual(frame0.GetLineEntry().GetLine(), self.line) # Now get the SBSymbolContext from this frame. We want everything. :-) context = frame0.GetSymbolContext(lldb.eSymbolContextEverything) @@ -81,7 +80,7 @@ "The line entry should have the correct filename", exe=False, substrs=['main.c']) - self.assertTrue(lineEntry.GetLine() == self.line, + self.assertEqual(lineEntry.GetLine(), self.line, "The line entry's line number should match ") symbol = context.GetSymbol()
diff --git a/src/llvm-project/lldb/test/API/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py b/src/llvm-project/lldb/test/API/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py index 27d1b60..8188c73 100644 --- a/src/llvm-project/lldb/test/API/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py +++ b/src/llvm-project/lldb/test/API/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py
@@ -14,7 +14,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["windows"]) def test_lookup_by_address(self): """Test lookup by address in a module with multiple compilation units""" @@ -36,7 +35,6 @@ self.assertEqual(symbol_name, sc_by_address.GetFunction().GetName()) - @add_test_categories(['pyapi']) def test_ranges_in_multiple_compile_unit(self): """This test verifies that we correctly handle the case when multiple compile unit contains DW_AT_ranges and DW_AT_ranges_base attributes."""
diff --git a/src/llvm-project/lldb/test/API/python_api/target/TestTargetAPI.py b/src/llvm-project/lldb/test/API/python_api/target/TestTargetAPI.py index 12c9d9d..c53f600 100644 --- a/src/llvm-project/lldb/test/API/python_api/target/TestTargetAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/target/TestTargetAPI.py
@@ -35,7 +35,6 @@ # It does not segfaults now. But for dwarf, the variable value is None if # the inferior process does not exist yet. The radar has been updated. #@unittest232.skip("segmentation fault -- skipping") - @add_test_categories(['pyapi']) def test_find_global_variables(self): """Exercise SBTarget.FindGlobalVariables() API.""" d = {'EXE': 'b.out'} @@ -43,7 +42,6 @@ self.setTearDownCleanup(dictionary=d) self.find_global_variables('b.out') - @add_test_categories(['pyapi']) def test_find_compile_units(self): """Exercise SBTarget.FindCompileUnits() API.""" d = {'EXE': 'b.out'} @@ -51,7 +49,6 @@ self.setTearDownCleanup(dictionary=d) self.find_compile_units(self.getBuildArtifact('b.out')) - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778") def test_find_functions(self): """Exercise SBTarget.FindFunctions() API.""" @@ -60,20 +57,17 @@ self.setTearDownCleanup(dictionary=d) self.find_functions('b.out') - @add_test_categories(['pyapi']) def test_get_description(self): """Exercise SBTarget.GetDescription() API.""" self.build() self.get_description() - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["windows"], bugnumber='llvm.org/pr21765') def test_resolve_symbol_context_with_address(self): """Exercise SBTarget.ResolveSymbolContextForAddress() API.""" self.build() self.resolve_symbol_context_with_address() - @add_test_categories(['pyapi']) def test_get_platform(self): d = {'EXE': 'b.out'} self.build(dictionary=d) @@ -82,7 +76,6 @@ platform = target.platform self.assertTrue(platform, VALID_PLATFORM) - @add_test_categories(['pyapi']) def test_get_data_byte_size(self): d = {'EXE': 'b.out'} self.build(dictionary=d) @@ -90,7 +83,6 @@ target = self.create_simple_target('b.out') self.assertEqual(target.data_byte_size, 1) - @add_test_categories(['pyapi']) def test_get_code_byte_size(self): d = {'EXE': 'b.out'} self.build(dictionary=d) @@ -98,7 +90,6 @@ target = self.create_simple_target('b.out') self.assertEqual(target.code_byte_size, 1) - @add_test_categories(['pyapi']) def test_resolve_file_address(self): d = {'EXE': 'b.out'} self.build(dictionary=d) @@ -121,7 +112,6 @@ self.assertIsNotNone(data_section2) self.assertEqual(data_section.name, data_section2.name) - @add_test_categories(['pyapi']) @skipIfReproducer # SBTarget::ReadMemory is not instrumented. def test_read_memory(self): d = {'EXE': 'b.out'} @@ -151,7 +141,6 @@ self.assertEqual(len(content), 1) - @add_test_categories(['pyapi']) @skipIfWindows # stdio manipulation unsupported on Windows @skipIfRemote # stdio manipulation unsupported on remote iOS devices<rdar://problem/54581135> @skipIfReproducer # stdout not captured by reproducers @@ -244,11 +233,11 @@ # Make sure we hit our breakpoint: thread_list = lldbutil.get_threads_stopped_at_breakpoint( process, breakpoint) - self.assertTrue(len(thread_list) == 1) + self.assertEqual(len(thread_list), 1) value_list = target.FindGlobalVariables( 'my_global_var_of_char_type', 3) - self.assertTrue(value_list.GetSize() == 1) + self.assertEqual(value_list.GetSize(), 1) my_global_var = value_list.GetValueAtIndex(0) self.DebugSBValue(my_global_var) self.assertTrue(my_global_var) @@ -267,9 +256,9 @@ if os.path.normpath(m.GetFileSpec().GetDirectory()) == self.getBuildDir() and m.GetFileSpec().GetFilename() == exe_name: value_list = m.FindGlobalVariables( target, 'my_global_var_of_char_type', 3) - self.assertTrue(value_list.GetSize() == 1) - self.assertTrue( - value_list.GetValueAtIndex(0).GetValue() == "'X'") + self.assertEqual(value_list.GetSize(), 1) + self.assertEqual( + value_list.GetValueAtIndex(0).GetValue(), "'X'") break def find_compile_units(self, exe): @@ -283,8 +272,8 @@ list = target.FindCompileUnits(lldb.SBFileSpec(source_name, False)) # Executable has been built just from one source file 'main.c', # so we may check only the first element of list. - self.assertTrue( - list[0].GetCompileUnit().GetFileSpec().GetFilename() == source_name) + self.assertEqual( + list[0].GetCompileUnit().GetFileSpec().GetFilename(), source_name) def find_functions(self, exe_name): """Exercise SBTaget.FindFunctions() API.""" @@ -296,15 +285,15 @@ # Try it with a null name: list = target.FindFunctions(None, lldb.eFunctionNameTypeAuto) - self.assertTrue(list.GetSize() == 0) + self.assertEqual(list.GetSize(), 0) list = target.FindFunctions('c', lldb.eFunctionNameTypeAuto) - self.assertTrue(list.GetSize() == 1) + self.assertEqual(list.GetSize(), 1) for sc in list: - self.assertTrue( - sc.GetModule().GetFileSpec().GetFilename() == exe_name) - self.assertTrue(sc.GetSymbol().GetName() == 'c') + self.assertEqual( + sc.GetModule().GetFileSpec().GetFilename(), exe_name) + self.assertEqual(sc.GetSymbol().GetName(), 'c') def get_description(self): """Exercise SBTaget.GetDescription() API.""" @@ -334,7 +323,6 @@ substrs=['Target', 'Module', 'a.out', 'Breakpoint']) @skipIfRemote - @add_test_categories(['pyapi']) @no_debug_info_test @skipIfReproducer # Inferior doesn't run during replay. def test_launch_new_process_and_redirect_stdout(self): @@ -422,7 +410,7 @@ self.assertTrue(process, PROCESS_IS_VALID) # Frame #0 should be on self.line1. - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -431,13 +419,13 @@ #self.runCmd("process status") frame0 = thread.GetFrameAtIndex(0) lineEntry = frame0.GetLineEntry() - self.assertTrue(lineEntry.GetLine() == self.line1) + self.assertEqual(lineEntry.GetLine(), self.line1) address1 = lineEntry.GetStartAddress() # Continue the inferior, the breakpoint 2 should be hit. process.Continue() - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -446,7 +434,7 @@ #self.runCmd("process status") frame0 = thread.GetFrameAtIndex(0) lineEntry = frame0.GetLineEntry() - self.assertTrue(lineEntry.GetLine() == self.line2) + self.assertEqual(lineEntry.GetLine(), self.line2) address2 = lineEntry.GetStartAddress() @@ -476,6 +464,7 @@ desc2 = get_description(symbol2) self.assertTrue(desc1 and desc2 and desc1 == desc2, "The two addresses should resolve to the same symbol") + def test_default_arch(self): """ Test the other two target create methods using LLDB_ARCH_DEFAULT. """ self.build() @@ -489,3 +478,27 @@ target3 = self.dbg.CreateTargetWithFileAndTargetTriple(exe, target.GetTriple()) self.assertTrue(target3.IsValid()) + + @skipIfWindows + def test_is_loaded(self): + """Exercise SBTarget.IsLoaded(SBModule&) API.""" + d = {'EXE': 'b.out'} + self.build(dictionary=d) + self.setTearDownCleanup(dictionary=d) + target = self.create_simple_target('b.out') + + self.assertFalse(target.IsLoaded(lldb.SBModule())) + + num_modules = target.GetNumModules() + for i in range(num_modules): + module = target.GetModuleAtIndex(i) + self.assertFalse(target.IsLoaded(module), "Target that isn't " + "running shouldn't have any module loaded.") + + process = target.LaunchSimple(None, None, + self.get_process_working_directory()) + + for i in range(num_modules): + module = target.GetModuleAtIndex(i) + self.assertTrue(target.IsLoaded(module), "Running the target should " + "have loaded its modules.")
diff --git a/src/llvm-project/lldb/test/API/python_api/thread/TestThreadAPI.py b/src/llvm-project/lldb/test/API/python_api/thread/TestThreadAPI.py index c97be6c..b8416eb 100644 --- a/src/llvm-project/lldb/test/API/python_api/thread/TestThreadAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/thread/TestThreadAPI.py
@@ -16,19 +16,16 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) def test_get_process(self): """Test Python SBThread.GetProcess() API.""" self.build() self.get_process() - @add_test_categories(['pyapi']) def test_get_stop_description(self): """Test Python SBThread.GetStopDescription() API.""" self.build() self.get_stop_description() - @add_test_categories(['pyapi']) def test_run_to_address(self): """Test Python SBThread.RunToAddress() API.""" # We build a different executable than the default build() does. @@ -38,7 +35,6 @@ self.run_to_address(self.exe_name) @skipIfAsan # The output looks different under ASAN. - @add_test_categories(['pyapi']) @expectedFailureAll(oslist=["linux"], archs=['arm'], bugnumber="llvm.org/pr45892") @expectedFailureAll(oslist=["windows"]) def test_step_out_of_malloc_into_function_b(self): @@ -49,7 +45,6 @@ self.setTearDownCleanup(dictionary=d) self.step_out_of_malloc_into_function_b(self.exe_name) - @add_test_categories(['pyapi']) def test_step_over_3_times(self): """Test Python SBThread.StepOver() API.""" # We build a different executable than the default build() does. @@ -99,8 +94,7 @@ proc_of_thread = thread.GetProcess() self.trace("proc_of_thread:", proc_of_thread) - self.assertTrue(proc_of_thread.GetProcessID() - == process.GetProcessID()) + self.assertEqual(proc_of_thread.GetProcessID(), process.GetProcessID()) def get_stop_description(self): """Test Python SBThread.GetStopDescription() API.""" @@ -180,8 +174,8 @@ thread.StepOut() self.runCmd("thread backtrace") - self.assertTrue( - thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == self.step_out_of_malloc, + self.assertEqual( + thread.GetFrameAtIndex(0).GetLineEntry().GetLine(), self.step_out_of_malloc, "step out of malloc into function b is successful") def step_over_3_times(self, exe_name): @@ -203,7 +197,7 @@ self.assertTrue(process, PROCESS_IS_VALID) # Frame #0 should be on self.step_out_of_malloc. - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) self.assertTrue( thread.IsValid(), @@ -211,7 +205,7 @@ self.runCmd("thread backtrace") frame0 = thread.GetFrameAtIndex(0) lineEntry = frame0.GetLineEntry() - self.assertTrue(lineEntry.GetLine() == self.step_out_of_malloc) + self.assertEqual(lineEntry.GetLine(), self.step_out_of_malloc) thread.StepOver() thread.StepOver() @@ -222,13 +216,13 @@ # main2.cpp. frame0 = thread.GetFrameAtIndex(0) lineEntry = frame0.GetLineEntry() - self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete) + self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete) # Expected failure with clang as the compiler. # rdar://problem/9223880 # # Which has been fixed on the lldb by compensating for inaccurate line # table information with r140416. - self.assertTrue(lineEntry.GetLine() == self.after_3_step_overs) + self.assertEqual(lineEntry.GetLine(), self.after_3_step_overs) def run_to_address(self, exe_name): """Test Python SBThread.RunToAddress() API.""" @@ -249,7 +243,7 @@ self.assertTrue(process, PROCESS_IS_VALID) # Frame #0 should be on self.step_out_of_malloc. - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) self.assertTrue( thread.IsValid(), @@ -257,7 +251,7 @@ self.runCmd("thread backtrace") frame0 = thread.GetFrameAtIndex(0) lineEntry = frame0.GetLineEntry() - self.assertTrue(lineEntry.GetLine() == self.step_out_of_malloc) + self.assertEqual(lineEntry.GetLine(), self.step_out_of_malloc) # Get the start/end addresses for this line entry. start_addr = lineEntry.GetStartAddress().GetLoadAddress(target)
diff --git a/src/llvm-project/lldb/test/API/python_api/type/TestTypeList.py b/src/llvm-project/lldb/test/API/python_api/type/TestTypeList.py index 359dfe8..f60237b 100644 --- a/src/llvm-project/lldb/test/API/python_api/type/TestTypeList.py +++ b/src/llvm-project/lldb/test/API/python_api/type/TestTypeList.py
@@ -25,7 +25,6 @@ self.source = 'main.cpp' self.line = line_number(self.source, '// Break at this line') - @add_test_categories(['pyapi']) def test(self): """Exercise SBType and SBTypeList API.""" d = {'EXE': self.exe_name} @@ -47,7 +46,7 @@ self.assertTrue(process, PROCESS_IS_VALID) # Get Frame #0. - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -113,13 +112,13 @@ self.DebugSBType(task_head_type) self.assertTrue(task_head_type.IsPointerType()) - self.assertTrue(task_head_type == task_pointer_type) + self.assertEqual(task_head_type, task_pointer_type) # Get the pointee type of 'task_head'. task_head_pointee_type = task_head_type.GetPointeeType() self.DebugSBType(task_head_pointee_type) - self.assertTrue(task_type == task_head_pointee_type) + self.assertEqual(task_type, task_head_pointee_type) # We'll now get the child member 'id' from 'task_head'. id = task_head.GetChildMemberWithName('id') @@ -130,7 +129,7 @@ # SBType.GetBasicType() takes an enum 'BasicType' # (lldb-enumerations.h). int_type = id_type.GetBasicType(lldb.eBasicTypeInt) - self.assertTrue(id_type == int_type) + self.assertEqual(id_type, int_type) # Find 'myint_arr' and check the array element type. myint_arr = frame0.FindVariable('myint_arr') @@ -143,7 +142,7 @@ self.DebugSBType(myint_arr_element_type) myint_type = target.FindFirstType('myint') self.DebugSBType(myint_type) - self.assertTrue(myint_arr_element_type == myint_type) + self.assertEqual(myint_arr_element_type, myint_type) # Test enum methods. Requires DW_AT_enum_class which was added in Dwarf 4. if configuration.dwarf_version >= 4:
diff --git a/src/llvm-project/lldb/test/API/python_api/value/TestValueAPI.py b/src/llvm-project/lldb/test/API/python_api/value/TestValueAPI.py index bf8cbe3..543186c 100644 --- a/src/llvm-project/lldb/test/API/python_api/value/TestValueAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/value/TestValueAPI.py
@@ -24,7 +24,6 @@ self.line = line_number('main.c', '// Break at this line') @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24772") - @add_test_categories(['pyapi']) def test(self): """Exercise some SBValue APIs.""" d = {'EXE': self.exe_name} @@ -46,7 +45,7 @@ self.assertTrue(process, PROCESS_IS_VALID) # Get Frame #0. - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -79,14 +78,14 @@ list = target.FindGlobalVariables('weekdays', 1) weekdays = list.GetValueAtIndex(0) self.assertTrue(weekdays, VALID_VARIABLE) - self.assertTrue(weekdays.GetNumChildren() == 5, VALID_VARIABLE) + self.assertEqual(weekdays.GetNumChildren(), 5, VALID_VARIABLE) self.DebugSBValue(weekdays) # Get global variable 'g_table'. list = target.FindGlobalVariables('g_table', 1) g_table = list.GetValueAtIndex(0) self.assertTrue(g_table, VALID_VARIABLE) - self.assertTrue(g_table.GetNumChildren() == 2, VALID_VARIABLE) + self.assertEqual(g_table.GetNumChildren(), 2, VALID_VARIABLE) self.DebugSBValue(g_table) fmt = lldbutil.BasicFormatter() @@ -126,9 +125,9 @@ # Verify the SBValue::GetByteSize() API is working correctly. arch = self.getArchitecture() if arch == 'i386': - self.assertTrue(value.GetByteSize() == 4) + self.assertEqual(value.GetByteSize(), 4) elif arch == 'x86_64': - self.assertTrue(value.GetByteSize() == 8) + self.assertEqual(value.GetByteSize(), 8) # Get child at index 5 => 'Friday'. child = value.GetChildAtIndex(5, lldb.eNoDynamicValues, True) @@ -176,11 +175,11 @@ ]: self.assertTrue(v) - self.assertTrue( - frame0.FindVariable('uinthex').GetValueAsUnsigned() == 3768803088, + self.assertEqual( + frame0.FindVariable('uinthex').GetValueAsUnsigned(), 3768803088, 'unsigned uinthex == 3768803088') - self.assertTrue( - frame0.FindVariable('sinthex').GetValueAsUnsigned() == 3768803088, + self.assertEqual( + frame0.FindVariable('sinthex').GetValueAsUnsigned(), 3768803088, 'unsigned sinthex == 3768803088') self.assertTrue(
diff --git a/src/llvm-project/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py b/src/llvm-project/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py index 64391eb..ec162f6 100644 --- a/src/llvm-project/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/value/change_values/TestChangeValueAPI.py
@@ -26,7 +26,6 @@ self.end_line = line_number( 'main.c', '// Set a breakpoint here at the end') - @add_test_categories(['pyapi']) @expectedFlakeyLinux("llvm.org/pr25652") @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24772") def test_change_value(self): @@ -82,8 +81,8 @@ self.assertTrue(result, "Setting val returned True.") actual_value = val_value.GetValueAsSigned(error, 0) self.assertTrue(error.Success(), "Got a changed value from val") - self.assertTrue( - actual_value == 12345, + self.assertEqual( + actual_value, 12345, "Got the right changed value from val") # Now check that we can set a structure element: @@ -163,8 +162,8 @@ self.assertTrue(result, "Setting sp returned true.") actual_value = sp_value.GetValueAsUnsigned(error, 0) self.assertTrue(error.Success(), "Got a changed value for sp") - self.assertTrue( - actual_value == 1, + self.assertEqual( + actual_value, 1, "Got the right changed value for sp.") # Boundary condition test the SBValue.CreateValueFromExpression() API.
diff --git a/src/llvm-project/lldb/test/API/python_api/value/empty_class/TestValueAPIEmptyClass.py b/src/llvm-project/lldb/test/API/python_api/value/empty_class/TestValueAPIEmptyClass.py index c778577..ac8f60b 100644 --- a/src/llvm-project/lldb/test/API/python_api/value/empty_class/TestValueAPIEmptyClass.py +++ b/src/llvm-project/lldb/test/API/python_api/value/empty_class/TestValueAPIEmptyClass.py
@@ -8,7 +8,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) def test(self): self.build() exe = self.getBuildArtifact("a.out")
diff --git a/src/llvm-project/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py b/src/llvm-project/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py index b45186a..afd25bd 100644 --- a/src/llvm-project/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py +++ b/src/llvm-project/lldb/test/API/python_api/value/linked_list/TestValueAPILinkedList.py
@@ -28,7 +28,6 @@ # Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into # SWIG 3.0.8. @skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)]) - @add_test_categories(['pyapi']) def test(self): """Exercise SBValue API linked_list_iter.""" d = {'EXE': self.exe_name} @@ -50,7 +49,7 @@ self.assertTrue(process, PROCESS_IS_VALID) # Get Frame #0. - self.assertTrue(process.GetState() == lldb.eStateStopped) + self.assertEqual(process.GetState(), lldb.eStateStopped) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) self.assertTrue( @@ -80,7 +79,7 @@ # Sanity checks that the we visited all the items (no more, no less). if self.TraceOn(): print("visited IDs:", list) - self.assertTrue(visitedIDs == list) + self.assertEqual(visitedIDs, list) # Let's exercise the linked_list_iter() API again, this time supplying # our end of list test function. @@ -111,7 +110,7 @@ # Sanity checks that the we visited all the items (no more, no less). if self.TraceOn(): print("visited IDs:", list) - self.assertTrue(visitedIDs == list) + self.assertEqual(visitedIDs, list) # Get variable 'empty_task_head'. empty_task_head = frame0.FindVariable('empty_task_head') @@ -125,7 +124,7 @@ print(cvf.format(t)) list.append(int(t.GetChildMemberWithName("id").GetValue())) - self.assertTrue(len(list) == 0) + self.assertEqual(len(list), 0) # Get variable 'task_evil'. task_evil = frame0.FindVariable('task_evil') @@ -139,4 +138,4 @@ print(cvf.format(t)) list.append(int(t.GetChildMemberWithName("id").GetValue())) - self.assertTrue(len(list) == 3) + self.assertEqual(len(list), 3)
diff --git a/src/llvm-project/lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py b/src/llvm-project/lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py index b425cef..e7d47de 100644 --- a/src/llvm-project/lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py +++ b/src/llvm-project/lldb/test/API/python_api/value_var_update/TestValueVarUpdate.py
@@ -12,7 +12,6 @@ mydir = TestBase.compute_mydir(__file__) - @add_test_categories(['pyapi']) def test_with_process_launch_api(self): """Test SBValue::GetValueDidChange""" # Get the full path to our executable to be attached/debugged.
diff --git a/src/llvm-project/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py b/src/llvm-project/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py index 49ecf7a..f135ed6 100644 --- a/src/llvm-project/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py +++ b/src/llvm-project/lldb/test/API/python_api/watchpoint/TestSetWatchpoint.py
@@ -25,7 +25,6 @@ self.line = line_number( self.source, '// Set break point at this line.') - @add_test_categories(['pyapi']) # Read-write watchpoints not supported on SystemZ @expectedFailureAll(archs=['s390x']) def test_watch_val(self): @@ -49,7 +48,7 @@ # We should be stopped due to the breakpoint. Get frame #0. process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) @@ -98,8 +97,8 @@ process.Continue() # At this point, the inferior process should have exited. - self.assertTrue( - process.GetState() == lldb.eStateExited, + self.assertEqual( + process.GetState(), lldb.eStateExited, PROCESS_EXITED) self.dbg.DeleteTarget(target)
diff --git a/src/llvm-project/lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py b/src/llvm-project/lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py index 83a11d4..d0fd398 100644 --- a/src/llvm-project/lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py +++ b/src/llvm-project/lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py
@@ -25,7 +25,6 @@ self.line = line_number( self.source, '// Set break point at this line.') - @add_test_categories(['pyapi']) # Read-write watchpoints not supported on SystemZ @expectedFailureAll(archs=['s390x']) def test_set_watch_ignore_count(self):
diff --git a/src/llvm-project/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py b/src/llvm-project/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py index 44df96b..6ca9999 100644 --- a/src/llvm-project/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py +++ b/src/llvm-project/lldb/test/API/python_api/watchpoint/TestWatchpointIter.py
@@ -30,7 +30,6 @@ self.line = line_number( self.source, '// Set break point at this line.') - @add_test_categories(['pyapi']) def test_watch_iter(self): """Exercise SBTarget.watchpoint_iter() API to iterate on the available watchpoints.""" self.build() @@ -52,7 +51,7 @@ # We should be stopped due to the breakpoint. Get frame #0. process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) @@ -71,7 +70,7 @@ self.HideStdout() # There should be only 1 watchpoint location under the target. - self.assertTrue(target.GetNumWatchpoints() == 1) + self.assertEqual(target.GetNumWatchpoints(), 1) self.assertTrue(watchpoint.IsEnabled()) watch_id = watchpoint.GetID() self.assertTrue(watch_id != 0) @@ -105,7 +104,7 @@ # Now disable the 'rw' watchpoint. The program won't stop when it reads # 'global' next. watchpoint.SetEnabled(False) - self.assertTrue(watchpoint.GetHardwareIndex() == -1) + self.assertEqual(watchpoint.GetHardwareIndex(), -1) self.assertFalse(watchpoint.IsEnabled()) # Continue. The program does not stop again when the variable is being @@ -113,13 +112,13 @@ process.Continue() # At this point, the inferior process should have exited. - self.assertTrue( - process.GetState() == lldb.eStateExited, + self.assertEqual( + process.GetState(), lldb.eStateExited, PROCESS_EXITED) # Verify some vital statistics and exercise the iterator API. for watchpoint in target.watchpoint_iter(): self.assertTrue(watchpoint) - self.assertTrue(watchpoint.GetWatchSize() == 4) - self.assertTrue(watchpoint.GetHitCount() == 1) + self.assertEqual(watchpoint.GetWatchSize(), 4) + self.assertEqual(watchpoint.GetHitCount(), 1) print(watchpoint)
diff --git a/src/llvm-project/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py b/src/llvm-project/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py index 7334734..847f678 100644 --- a/src/llvm-project/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py +++ b/src/llvm-project/lldb/test/API/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
@@ -54,7 +54,7 @@ # We should be stopped due to the breakpoint. Get frame #0. process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) @@ -92,4 +92,4 @@ self.DebugSBValue(value) # Verify that the condition is met. - self.assertTrue(value.GetValueAsUnsigned() == 5) + self.assertEqual(value.GetValueAsUnsigned(), 5)
diff --git a/src/llvm-project/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py b/src/llvm-project/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py index 9cbc396..7df7285 100644 --- a/src/llvm-project/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py +++ b/src/llvm-project/lldb/test/API/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
@@ -28,7 +28,6 @@ # This is for verifying that watch location works. self.violating_func = "do_bad_thing_with_location" - @add_test_categories(['pyapi']) def test_watch_location(self): """Exercise SBValue.WatchPointee() API to set a watchpoint.""" self.build() @@ -50,7 +49,7 @@ # We should be stopped due to the breakpoint. Get frame #0. process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint)
diff --git a/src/llvm-project/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/src/llvm-project/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py index 53e794d..15d9b2a 100644 --- a/src/llvm-project/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ b/src/llvm-project/lldb/test/API/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
@@ -27,7 +27,6 @@ # This is for verifying that watch location works. self.violating_func = "do_bad_thing_with_location" - @add_test_categories(['pyapi']) def test_watch_address(self): """Exercise SBTarget.WatchAddress() API to set a watchpoint.""" self.build() @@ -49,7 +48,7 @@ # We should be stopped due to the breakpoint. Get frame #0. process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint) @@ -99,7 +98,6 @@ # This finishes our test. - @add_test_categories(['pyapi']) # No size constraint on MIPS for watches @skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el']) @skipIf(archs=['s390x']) # Likewise on SystemZ @@ -124,7 +122,7 @@ # We should be stopped due to the breakpoint. Get frame #0. process = target.GetProcess() - self.assertTrue(process.GetState() == lldb.eStateStopped, + self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED) thread = lldbutil.get_stopped_thread( process, lldb.eStopReasonBreakpoint)