From 8c0ff17c3bb44edf455a2964e6035f28be68c9f3 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 7 May 2020 11:15:58 -0700 Subject: [PATCH] [lldb/Test] Add @skipIfReproducer to tests using lldb::FileSP. lldb::FileSP is a typedef for std::shared_ptr and the reproducers cannot instrument a lldb_private constructor. --- .../minidump-new/TestMiniDumpNew.py | 1 + .../TestDisassemble_VST1_64.py | 1 + .../python_api/file_handle/TestFileHandle.py | 49 +++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py index f209261f0500..3e1abc3353c3 100644 --- a/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py +++ b/lldb/test/API/functionalities/postmortem/minidump-new/TestMiniDumpNew.py @@ -29,6 +29,7 @@ class MiniDumpNewTestCase(TestBase): self.process = self.target.LoadCore(minidump_path) return self.process + @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def check_state(self): with open(os.devnull) as devnul: # sanitize test output diff --git a/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py b/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py index e4d085de7c2b..fd5c9ec59ea9 100644 --- a/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py +++ b/lldb/test/API/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py @@ -20,6 +20,7 @@ class Disassemble_VST1_64(TestBase): @add_test_categories(['pyapi']) @no_debug_info_test @skipIfLLVMTargetMissing("ARM") + @skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_disassemble_invalid_vst_1_64_raw_data(self): """Test disassembling invalid vst1.64 raw bytes with the API.""" # Create a target from the debugger. diff --git a/lldb/test/API/python_api/file_handle/TestFileHandle.py b/lldb/test/API/python_api/file_handle/TestFileHandle.py index 550aad2ad8a1..98e8847467a0 100644 --- a/lldb/test/API/python_api/file_handle/TestFileHandle.py +++ b/lldb/test/API/python_api/file_handle/TestFileHandle.py @@ -120,6 +120,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: self.dbg.SetOutputFileHandle(f, False) @@ -135,6 +136,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: self.dbg.SetOutputFileHandle(f, False) @@ -143,6 +145,7 @@ class FileHandleTestCase(lldbtest.TestBase): 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: self.dbg.SetErrorFileHandle(f, False) @@ -157,6 +160,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: self.dbg.SetErrorFileHandle(f, False) @@ -166,6 +170,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: self.dbg.SetErrorFileHandle(f, False) @@ -175,6 +180,7 @@ class FileHandleTestCase(lldbtest.TestBase): 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() self.assertRaises(Exception, sbf.Write, None) @@ -185,6 +191,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: sbf = lldb.SBFile(f.fileno(), "w", False) @@ -199,6 +206,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: sbf = lldb.SBFile(f) @@ -212,6 +220,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: f.write('FOO') @@ -225,6 +234,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: f.write('foo') @@ -240,6 +250,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: sbf = lldb.SBFile(f.fileno(), "w", False) @@ -254,6 +265,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: sbf = lldb.SBFile(f.fileno(), "w", False) @@ -265,6 +277,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: status = self.dbg.SetOutputFile(lldb.SBFile(f)) @@ -275,6 +288,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: ret = lldb.SBCommandReturnObject() @@ -292,6 +306,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_immediate_string(self): f = io.StringIO() ret = lldb.SBCommandReturnObject() @@ -308,6 +323,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_immediate_sbfile_string(self): f = io.StringIO() ret = lldb.SBCommandReturnObject() @@ -322,6 +338,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: f.write("help help\n") @@ -345,6 +362,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: f.write("help help\n") @@ -363,6 +381,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: f.write("help help\n") @@ -382,6 +401,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_string_inout(self): inf = io.StringIO("help help\np/x ~0\n") outf = io.StringIO() @@ -399,6 +419,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_bytes_inout(self): inf = io.BytesIO(b"help help\nhelp b\n") outf = io.BytesIO() @@ -415,6 +436,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: @@ -433,6 +455,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_replace_stdout(self): f = io.StringIO() with replace_stdout(f): @@ -443,6 +466,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_replace_stdout_with_nonfile(self): f = io.StringIO() with replace_stdout(f): @@ -458,6 +482,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: sbf = lldb.SBFile.Create(f, borrow=True) @@ -474,6 +499,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_forced(self): with open(self.out_filename, 'w') as f: written = MutableBool(False) @@ -495,6 +521,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_forced_borrowed(self): with open(self.out_filename, 'w') as f: written = MutableBool(False) @@ -516,6 +543,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_string(self): f = io.StringIO() sbf = lldb.SBFile(f) @@ -529,6 +557,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_string_out(self): f = io.StringIO() status = self.dbg.SetOutputFile(f) @@ -539,6 +568,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_string_error(self): f = io.StringIO() status = self.dbg.SetErrorFile(f) @@ -550,6 +580,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_write_bytes(self): f = io.BytesIO() sbf = lldb.SBFile(f) @@ -562,6 +593,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_read_string(self): f = io.StringIO('zork') sbf = lldb.SBFile(f) @@ -573,6 +605,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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): f = io.StringIO('z') sbf = lldb.SBFile(f) @@ -585,6 +618,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_read_bytes(self): f = io.BytesIO(b'zork') sbf = lldb.SBFile(f) @@ -596,6 +630,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbfile_out(self): with open(self.out_filename, 'w') as f: sbf = lldb.SBFile(f) @@ -608,6 +643,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_file_out(self): with open(self.out_filename, 'w') as f: status = self.dbg.SetOutputFile(f) @@ -618,6 +654,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: sbf = lldb.SBFile(f) @@ -630,6 +667,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: status = self.dbg.SetErrorFile(f) @@ -641,6 +679,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_exceptions(self): self.assertRaises(Exception, lldb.SBFile, None) self.assertRaises(Exception, lldb.SBFile, "ham sandwich") @@ -660,6 +699,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_exceptions_logged(self): messages = list() self.dbg.SetLoggingCallback(messages.append) @@ -671,6 +711,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_flush(self): flushed = MutableBool(False) closed = MutableBool(False) @@ -700,6 +741,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: f.write("foo") @@ -721,6 +763,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: status = self.dbg.SetOutputFile(f) @@ -740,6 +783,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_stdout(self): f = io.StringIO() status = self.dbg.SetOutputFile(f) @@ -749,6 +793,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: status = self.dbg.SetOutputFile(f) @@ -765,6 +810,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) @skipIf(py_version=['<', (3,)]) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_identity(self): f = io.StringIO() @@ -820,6 +866,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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: # at each step here we're borrowing the file, so we have to keep @@ -839,6 +886,7 @@ class FileHandleTestCase(lldbtest.TestBase): @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) self.assertRaises(Exception, self.dbg.SetOutputFile, "ham sandwich") @@ -877,6 +925,7 @@ class FileHandleTestCase(lldbtest.TestBase): @add_test_categories(['pyapi']) + @@skipIfReproducer # lldb::FileSP used in typemap cannot be instrumented. def test_sbstream(self): with open(self.out_filename, 'w') as f: