[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)
https://github.com/slydiman edited https://github.com/llvm/llvm-project/pull/93345 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/93345 >From 8701bfc715168168ca04d86f134ef362d5e89173 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Sat, 25 May 2024 00:39:05 +0400 Subject: [PATCH] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host Do not denormalize the path. This patch fixes #93092. BTW, it would be great to be able to pass the style or triple to SBFileSpec. Currently it is impossible to create a posix FileSpec on the Windows host. --- lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index b4f1b76c39dbe..588b19dac6165 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -678,8 +678,8 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process, loaded_image->Clear(); std::string path; - path = remote_file.GetPath(); - + path = remote_file.GetPath(false); + ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread(); if (!thread_sp) { error.SetErrorString("dlopen error: no thread available to call dlopen."); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)
https://github.com/slydiman edited https://github.com/llvm/llvm-project/pull/93345 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host (PR #93345)
https://github.com/slydiman edited https://github.com/llvm/llvm-project/pull/93345 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test on the Linux AArch64 target (PR #93345)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/93345 >From 76a35a6ca5302aef5033d5ae297667e416921d7d Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Sat, 25 May 2024 00:39:05 +0400 Subject: [PATCH] [lldb] Fixed PlatformPOSIX::DoLoadImage() in case of the Windows host Do not denormalize the path. This patch fixes #93092. BTW, it would be great to be able to pass the style or triple to SBFileSpec. Currently it is impossible to create a posix FileSpec on the Windows host. --- lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index b4f1b76c39dbe..edad606e2e105 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -678,7 +678,7 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process *process, loaded_image->Clear(); std::string path; - path = remote_file.GetPath(); + path = remote_file.GetPath(false); ThreadSP thread_sp = process->GetThreadList().GetExpressionExecutionThread(); if (!thread_sp) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test on the Linux AArch64 target (PR #93345)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/93345 PlatformPOSIX::DoLoadImage() failed on the Linux AArch64 target. It is related to the issue #93092. Disable the TestCompletion.test_process_unload test for now. >From 3dcd6665052b1090cb5365732a92aef0b7fa0915 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Sat, 25 May 2024 00:39:05 +0400 Subject: [PATCH] [lldb] Fixed the TestCompletion test on the Linux AArch64 target PlatformPOSIX::DoLoadImage() failed on the Linux AArch64 target. It is related to the issue #93092. Disable the TestCompletion.test_process_unload test for now. --- lldb/test/API/functionalities/completion/TestCompletion.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py index 15aeaf8d0e897..eadb510a3df26 100644 --- a/lldb/test/API/functionalities/completion/TestCompletion.py +++ b/lldb/test/API/functionalities/completion/TestCompletion.py @@ -97,6 +97,9 @@ def test_process_load(self): self.complete_from_to("process load Makef", "process load Makefile") @skipUnlessPlatform(["linux"]) +@expectedFailureAll( +archs=["aarch64"], bugnumber="github.com/llvm/llvm-project/issues/93092" +) def test_process_unload(self): """Test the completion for "process unload " """ # This tab completion should not work without a running process. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (PR #90580)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/90580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestDAP_repl_mode_detection test in case of a remote target (PR #93165)
slydiman wrote: Replaced by #93169. https://github.com/llvm/llvm-project/pull/93165 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestDAP_repl_mode_detection test in case of a remote target (PR #93165)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/93165 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Automatically skip lldb-dap tests for remote platforms (PR #93169)
https://github.com/slydiman approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/93169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestDAP_repl_mode_detection test in case of a remote target (PR #93165)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/93165 This test is based on dap_server which runs locally. This test failed in case of Windows host and Linux target. >From 2243749477714852ada7a00bb849514283655464 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 23 May 2024 14:21:23 +0400 Subject: [PATCH] [lldb] Fixed the TestDAP_repl_mode_detection test in case of a remote target This test is based on dap_server which runs locally. This test failed in case of Windows host and Linux target. --- .../API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py b/lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py index 7c77fc8541b93..705ae13e349dc 100644 --- a/lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py +++ b/lldb/test/API/tools/lldb-dap/repl-mode/TestDAP_repl_mode_detection.py @@ -18,6 +18,7 @@ def assertEvaluate(self, expression, regex): regex, ) +@skipIfRemote def test_completions(self): program = self.getBuildArtifact("a.out") self.build_and_launch(program) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestExitDuringExpression test in case of a remote target (PR #93119)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/93119 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the TestBreakpointCommand test (PR #93122)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/93122 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the TestBreakpointCommand test (PR #93122)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/93122 The TestBreakpointCommand test is incorrectly disabled for Windows target. We can disable it for Windows host instead or just fix the issue. This patch fixes the path separator in BreakpointResolverFileLine::DeduceSourceMapping() and the Windows specific absolute path in the test in case of the Windows host. >From 4220b6d0dcc32e26a6916608ad2b2cf873bee212 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 23 May 2024 05:30:39 +0400 Subject: [PATCH] [lldb] Fixed the TestBreakpointCommand test The TestBreakpointCommand test is incorrectly disabled for Windows target. We can disable it for Windows host instead or just fix the issue. This patch fixes the path separator in BreakpointResolverFileLine::DeduceSourceMapping() and the Windows specific absolute path in the test in case of the Windows host. --- .../Breakpoint/BreakpointResolverFileLine.cpp | 10 +- .../TestBreakpointCommand.py | 18 +- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp index d7d8c714867e3..16c4ee1b88d16 100644 --- a/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverFileLine.cpp @@ -198,16 +198,16 @@ void BreakpointResolverFileLine::DeduceSourceMapping( return; Log *log = GetLog(LLDBLog::Breakpoints); - const llvm::StringRef path_separator = llvm::sys::path::get_separator( - m_location_spec.GetFileSpec().GetPathStyle()); // Check if "b" is a suffix of "a". // And return std::nullopt if not or the new path // of "a" after consuming "b" from the back. auto check_suffix = - [path_separator](llvm::StringRef a, llvm::StringRef b, - bool case_sensitive) -> std::optional { + [](llvm::StringRef a, llvm::StringRef b, + bool case_sensitive) -> std::optional { if (case_sensitive ? a.consume_back(b) : a.consume_back_insensitive(b)) { - if (a.empty() || a.ends_with(path_separator)) { + // Note sc_file_dir and request_file_dir below are normalized + // and always contain the path separator '/'. + if (a.empty() || a.ends_with("/")) { return a; } } diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py index c219a4ee5bd9c..605561c757372 100644 --- a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py +++ b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py @@ -6,7 +6,7 @@ import lldb from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * -from lldbsuite.test import lldbutil +from lldbsuite.test import lldbutil, lldbplatformutil import json import os import side_effect @@ -581,7 +581,6 @@ def verify_source_map_deduce_statistics(self, target, expected_count): self.assertNotEqual(target_stats, None) self.assertEqual(target_stats["sourceMapDeduceCount"], expected_count) -@skipIf(oslist=["windows"]) @no_debug_info_test def test_breakpoints_auto_source_map_relative(self): """ @@ -612,8 +611,13 @@ def test_breakpoints_auto_source_map_relative(self): self.verify_source_map_deduce_statistics(target, 0) # Verify auto deduced source map when file path in debug info -# is a suffix of request breakpoint file path -path = "/x/y/a/b/c/main.cpp" +# is a suffix of request breakpoint file path. +# Note the path must be absolute. +path = ( +"/x/y/a/b/c/main.cpp" +if lldbplatformutil.getHostPlatform() != "windows" +else r"C:\x\y\a\b\c\main.cpp" +) bp = target.BreakpointCreateByLocation(path, 2) self.assertGreater( bp.GetNumLocations(), @@ -625,7 +629,11 @@ def test_breakpoints_auto_source_map_relative(self): source_map_json = self.get_source_map_json() self.assertEqual(len(source_map_json), 1, "source map should not be empty") -self.verify_source_map_entry_pair(source_map_json[0], ".", "/x/y") +self.verify_source_map_entry_pair( +source_map_json[0], +".", +"/x/y" if lldbplatformutil.getHostPlatform() != "windows" else r"C:\x\y", +) self.verify_source_map_deduce_statistics(target, 1) # Reset source map. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestExitDuringExpression test in case of a remote target (PR #93119)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/93119 Sometimes this test failed on the assert `The thread exited` in case of a remote target. Increase the timeout to 1 second to avoid a racing condition. >From c51c200295425167d664197bc4c15d02ec91ed09 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 23 May 2024 04:56:26 +0400 Subject: [PATCH] [lldb] Fixed the TestExitDuringExpression test in case of a remote target Sometimes this test failed on the assert `The thread exited` in case of a remote target. Increase the timeout to 1 second to avoid a racing condition. --- .../API/functionalities/thread/exit_during_expression/main.c| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/functionalities/thread/exit_during_expression/main.c b/lldb/test/API/functionalities/thread/exit_during_expression/main.c index eb6d17520986c..f633632e96cc4 100644 --- a/lldb/test/API/functionalities/thread/exit_during_expression/main.c +++ b/lldb/test/API/functionalities/thread/exit_during_expression/main.c @@ -3,7 +3,7 @@ #include #include -static unsigned int g_timeout = 10; +static unsigned int g_timeout = 100; extern int usleep(unsigned int); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (PR #90580)
https://github.com/slydiman edited https://github.com/llvm/llvm-project/pull/90580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (PR #90580)
slydiman wrote: We are almost done with configuring the buildbot for cross lldb (Windows x86_64 host and Linux Aarch64 target). We are trying to get it green with minimal local patches. https://github.com/llvm/llvm-project/pull/90580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Skip the TestDataFormatterLibcxxChrono test to avoid python crash (PR #92575)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92575 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed LibcxxChronoTimePointSecondsSummaryProvider() (PR #92701)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92701 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed LibcxxChronoTimePointSecondsSummaryProvider() (PR #92701)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92701 >From 7d455ee2dabe3adc851b0c7989e9cef53eb24e6e Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Sun, 19 May 2024 21:50:21 +0400 Subject: [PATCH] [lldb][Windows] Fixed LibcxxChronoTimePointSecondsSummaryProvider() This patch fixes #92574. It is a replacement for #92575. --- .../Plugins/Language/CPlusPlus/LibCxx.cpp | 11 .../chrono/TestDataFormatterLibcxxChrono.py | 57 --- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index e160fd0763939..b0e6fb7d6f5af 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -1098,6 +1098,7 @@ LibcxxChronoTimePointSecondsSummaryProvider(ValueObject , Stream , if (!ptr_sp) return false; +#ifndef _WIN32 // The date time in the chrono library is valid in the range // [-32767-01-01T00:00:00Z, 32767-12-31T23:59:59Z]. A 64-bit time_t has a // larger range, the function strftime is not able to format the entire range @@ -1107,6 +1108,11 @@ LibcxxChronoTimePointSecondsSummaryProvider(ValueObject , Stream , -1'096'193'779'200; // -32767-01-01T00:00:00Z const std::time_t chrono_timestamp_max = 971'890'963'199; // 32767-12-31T23:59:59Z +#else + const std::time_t chrono_timestamp_min = -43'200; // 1969-12-31T12:00:00Z + const std::time_t chrono_timestamp_max = + 32'536'850'399; // 3001-01-19T21:59:59 +#endif const std::time_t seconds = ptr_sp->GetValueAsSigned(0); if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max) @@ -1148,12 +1154,17 @@ LibcxxChronoTimepointDaysSummaryProvider(ValueObject , Stream , if (!ptr_sp) return false; +#ifndef _WIN32 // The date time in the chrono library is valid in the range // [-32767-01-01Z, 32767-12-31Z]. A 32-bit time_t has a larger range, the // function strftime is not able to format the entire range of time_t. The // exact point has not been investigated; it's limited to chrono's range. const int chrono_timestamp_min = -12'687'428; // -32767-01-01Z const int chrono_timestamp_max = 11'248'737; // 32767-12-31Z +#else + const int chrono_timestamp_min = 0; // 1970-01-01Z + const int chrono_timestamp_max = 376'583; // 3001-01-19Z +#endif const int days = ptr_sp->GetValueAsSigned(0); if (days < chrono_timestamp_min || days > chrono_timestamp_max) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py index fb35481d55514..0737a5bc7e6eb 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py @@ -14,6 +14,7 @@ class LibcxxChronoDataFormatterTestCase(TestBase): @skipIf(compiler="clang", compiler_version=["<", "17.0"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" +isNotWindowsHost = lldbplatformutil.getHostPlatform() != "windows" self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp", False) @@ -57,7 +58,11 @@ def test_with_run_command(self): self.expect( "frame variable ss_neg_date_time", substrs=[ -"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z timestamp=-1096193779200 s" +( +"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z timestamp=-1096193779200 s" +if isNotWindowsHost +else "ss_neg_date_time = timestamp=-1096193779200 s" +) ], ) self.expect( @@ -68,7 +73,11 @@ def test_with_run_command(self): self.expect( "frame variable ss_pos_date_time", substrs=[ -"ss_pos_date_time = date/time=32767-12-31T23:59:59Z timestamp=971890963199 s" +( +"ss_pos_date_time = date/time=32767-12-31T23:59:59Z timestamp=971890963199 s" +if isNotWindowsHost +else "ss_pos_date_time = timestamp=971890963199 s" +) ], ) self.expect( @@ -103,7 +112,13 @@ def test_with_run_command(self): ) self.expect( "frame variable sd_neg_date", -substrs=["sd_neg_date = date=-32767-01-01Z timestamp=-12687428 days"], +substrs=[ +( +"sd_neg_date = date=-32767-01-01Z
[Lldb-commits] [lldb] [lldb][Windows] Skip the TestDataFormatterLibcxxChrono test to avoid python crash (PR #92575)
slydiman wrote: @Michael137 > I think we should just fix #92574 since it seems pretty trivial Please look at #92701. https://github.com/llvm/llvm-project/pull/92575 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed LibcxxChronoTimePointSecondsSummaryProvider() (PR #92701)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92701 This patch fixes #92574. It is a replacement for #92575. >From 2dfbb8663a4661255cd90269b9f527dfac8fb21b Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Sun, 19 May 2024 21:50:21 +0400 Subject: [PATCH] [lldb][Windows] Fixed LibcxxChronoTimePointSecondsSummaryProvider() This patch fixes #92574. It is a replacement for #92575. --- .../Plugins/Language/CPlusPlus/LibCxx.cpp | 11 .../chrono/TestDataFormatterLibcxxChrono.py | 57 --- 2 files changed, 60 insertions(+), 8 deletions(-) diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index e160fd0763939..da05ba7b40d32 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -1098,6 +1098,7 @@ LibcxxChronoTimePointSecondsSummaryProvider(ValueObject , Stream , if (!ptr_sp) return false; +#ifndef _WIN32 // The date time in the chrono library is valid in the range // [-32767-01-01T00:00:00Z, 32767-12-31T23:59:59Z]. A 64-bit time_t has a // larger range, the function strftime is not able to format the entire range @@ -1107,6 +1108,11 @@ LibcxxChronoTimePointSecondsSummaryProvider(ValueObject , Stream , -1'096'193'779'200; // -32767-01-01T00:00:00Z const std::time_t chrono_timestamp_max = 971'890'963'199; // 32767-12-31T23:59:59Z +#else + const std::time_t chrono_timestamp_min = -43'200; // 1969-12-31T12:00:00Z + const std::time_t chrono_timestamp_max = + 32'536'850'399; // 3001-01-19T21:59:59 +#endif const std::time_t seconds = ptr_sp->GetValueAsSigned(0); if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max) @@ -1148,12 +1154,17 @@ LibcxxChronoTimepointDaysSummaryProvider(ValueObject , Stream , if (!ptr_sp) return false; +#ifndef _WIN32 // The date time in the chrono library is valid in the range // [-32767-01-01Z, 32767-12-31Z]. A 32-bit time_t has a larger range, the // function strftime is not able to format the entire range of time_t. The // exact point has not been investigated; it's limited to chrono's range. const int chrono_timestamp_min = -12'687'428; // -32767-01-01Z const int chrono_timestamp_max = 11'248'737; // 32767-12-31Z +#else + const int chrono_timestamp_min = 0; // 1970-01-01Z + const int chrono_timestamp_max = 376'583; // 3001-01-19Z +#endif const int days = ptr_sp->GetValueAsSigned(0); if (days < chrono_timestamp_min || days > chrono_timestamp_max) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py index fb35481d55514..0737a5bc7e6eb 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py @@ -14,6 +14,7 @@ class LibcxxChronoDataFormatterTestCase(TestBase): @skipIf(compiler="clang", compiler_version=["<", "17.0"]) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" +isNotWindowsHost = lldbplatformutil.getHostPlatform() != "windows" self.build() (self.target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint( self, "break here", lldb.SBFileSpec("main.cpp", False) @@ -57,7 +58,11 @@ def test_with_run_command(self): self.expect( "frame variable ss_neg_date_time", substrs=[ -"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z timestamp=-1096193779200 s" +( +"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z timestamp=-1096193779200 s" +if isNotWindowsHost +else "ss_neg_date_time = timestamp=-1096193779200 s" +) ], ) self.expect( @@ -68,7 +73,11 @@ def test_with_run_command(self): self.expect( "frame variable ss_pos_date_time", substrs=[ -"ss_pos_date_time = date/time=32767-12-31T23:59:59Z timestamp=971890963199 s" +( +"ss_pos_date_time = date/time=32767-12-31T23:59:59Z timestamp=971890963199 s" +if isNotWindowsHost +else "ss_pos_date_time = timestamp=971890963199 s" +) ], ) self.expect( @@ -103,7 +112,13 @@ def test_with_run_command(self): ) self.expect( "frame variable sd_neg_date", -substrs=["sd_neg_date = date=-32767-01-01Z timestamp=-12687428 days"], +substrs=[ +( +
[Lldb-commits] [lldb] [lldb][Windows] Skip the TestDataFormatterLibcxxChrono test to avoid python crash (PR #92575)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92575 The python crashed with the exit code 0xC409 (STATUS_STACK_BUFFER_OVERRUN) on the command `frame variable ss_neg_seconds` running on Windows x86_64. See this issue for details https://github.com/llvm/llvm-project/issues/92574 >From 019dcbd636a4cee19700b8d34279d45ec715b67c Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Fri, 17 May 2024 20:46:18 +0400 Subject: [PATCH] [lldb][Windows] Skip the TestDataFormatterLibcxxChrono test to avoid python crash The python crashed with the exit code 0xC409 (STATUS_STACK_BUFFER_OVERRUN) on the command `frame variable ss_neg_seconds` running on Windows x86_64. See this issue for details https://github.com/llvm/llvm-project/issues/92574 --- .../libcxx/chrono/TestDataFormatterLibcxxChrono.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py index fb35481d55514..bb7310bc1a8c1 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py @@ -12,6 +12,9 @@ class LibcxxChronoDataFormatterTestCase(TestBase): @add_test_categories(["libc++"]) @skipIf(compiler="clang", compiler_version=["<", "17.0"]) +@skipIf( +hostoslist=["windows"], bugnumber="github.com/llvm/llvm-project/issues/92574" +) def test_with_run_command(self): """Test that that file and class static variables display correctly.""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92413 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)
@@ -52,6 +52,9 @@ def test_attach_with_vAttachWait(self): server = self.connect_to_debug_monitor() self.do_handshake() +if self._run_args: +self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) slydiman wrote: I have updated the patch. Thanks. https://github.com/llvm/llvm-project/pull/92413 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92413 >From d88cc6d992e1f753066aa5dccaa510d8a0a35b94 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 19:18:21 +0400 Subject: [PATCH 1/2] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target Install `_exe_to_attach` to a remote target if necessary. --- .../lldb-server/attach-wait/TestGdbRemoteAttachWait.py | 9 + 1 file changed, 9 insertions(+) diff --git a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py index f4c31fe2f5c07..a8333210a72b1 100644 --- a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py +++ b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py @@ -52,6 +52,9 @@ def test_attach_with_vAttachWait(self): server = self.connect_to_debug_monitor() self.do_handshake() +if self._run_args: +self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) + # Launch the first inferior (we shouldn't attach to this one). self._launch_and_wait_for_init() @@ -101,6 +104,9 @@ def test_launch_before_attach_with_vAttachOrWait(self): server = self.connect_to_debug_monitor() self.do_handshake() +if self._run_args: +self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) + inferior = self._launch_and_wait_for_init() # Add attach packets. @@ -141,6 +147,9 @@ def test_launch_after_attach_with_vAttachOrWait(self): server = self.connect_to_debug_monitor() self.do_handshake() +if self._run_args: +self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) + self.test_sequence.add_log_lines([self._attach_packet("vAttachOrWait")], True) # Run the stream until attachWait. context = self.expect_gdbremote_sequence() >From 1f329275f90c0be3ecf73f3e9e3c816439596116 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Fri, 17 May 2024 16:26:57 +0400 Subject: [PATCH 2/2] Moved install_to_target() to _set_up_inferior(). --- .../attach-wait/TestGdbRemoteAttachWait.py | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py index a8333210a72b1..84aab9c969aa4 100644 --- a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py +++ b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py @@ -17,7 +17,10 @@ def _set_up_inferior(self): # Use a shim to ensure that the process is ready to be attached from # the get-go. self._exe_to_run = "shim" -self._run_args = [self.getBuildArtifact(self._exe_to_attach)] +self._exe_to_attach = lldbutil.install_to_target( +self, self.getBuildArtifact(self._exe_to_attach) +) +self._run_args = [self._exe_to_attach] self.build(dictionary={"EXE": self._exe_to_run, "CXX_SOURCES": "shim.cpp"}) else: self._exe_to_run = self._exe_to_attach @@ -52,9 +55,6 @@ def test_attach_with_vAttachWait(self): server = self.connect_to_debug_monitor() self.do_handshake() -if self._run_args: -self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) - # Launch the first inferior (we shouldn't attach to this one). self._launch_and_wait_for_init() @@ -104,9 +104,6 @@ def test_launch_before_attach_with_vAttachOrWait(self): server = self.connect_to_debug_monitor() self.do_handshake() -if self._run_args: -self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) - inferior = self._launch_and_wait_for_init() # Add attach packets. @@ -147,9 +144,6 @@ def test_launch_after_attach_with_vAttachOrWait(self): server = self.connect_to_debug_monitor() self.do_handshake() -if self._run_args: -self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) - self.test_sequence.add_log_lines([self._attach_packet("vAttachOrWait")], True) # Run the stream until attachWait. context = self.expect_gdbremote_sequence() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestDebuggerAPI test on x86_64 Windows host (PR #90580)
https://github.com/slydiman edited https://github.com/llvm/llvm-project/pull/90580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the DAP tests in case of a remote target (PR #92416)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92416 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed unresolved test lldb-api python_api/debugger/TestDebuggerAPI.py on x86_64 host (PR #90580)
slydiman wrote: I have added [the issuee](https://github.com/llvm/llvm-project/issues/92419) and updated the test with @expectedFailureAll and the bugnumber. https://github.com/llvm/llvm-project/pull/90580 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed unresolved test lldb-api python_api/debugger/TestDebuggerAPI.py on x86_64 host (PR #90580)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/90580 >From 0d6ff964ed83e06ed3947d709884ed6dd43e90b5 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 30 Apr 2024 13:42:45 +0400 Subject: [PATCH 1/2] [lldb][Windows] Fixed unresolved test lldb-api python_api/debugger/TestDebuggerAPI.py It is necessary to select the expected platform at the beginning. In case of `Windows` host platform1.GetName() returned `host`. platform2.GetName() returned `remote-linux`, but platform2.GetWorkingDirectory() was None and finally ``` File "llvm-project\lldb\test\API\python_api\debugger\TestDebuggerAPI.py", line 108, in test_CreateTarget_platform platform2.GetWorkingDirectory().endswith("bar"), AttributeError: 'NoneType' object has no attribute 'endswith' ``` --- lldb/test/API/python_api/debugger/TestDebuggerAPI.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py index 522de2466012e..3d6484e5c9fbc 100644 --- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py +++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py @@ -95,6 +95,7 @@ def test_CreateTarget_platform(self): exe = self.getBuildArtifact("a.out") self.yaml2obj("elf.yaml", exe) error = lldb.SBError() +self.dbg.SetSelectedPlatform(lldb.SBPlatform("remote-linux")) target1 = self.dbg.CreateTarget(exe, None, "remote-linux", False, error) self.assertSuccess(error) platform1 = target1.GetPlatform() >From 012d95b3ed4c83c9d439cae1e2b53cbea5dcb441 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 21:25:51 +0400 Subject: [PATCH 2/2] Updated to use @expectedFailureAll with a bugnumber. --- lldb/test/API/python_api/debugger/TestDebuggerAPI.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py index 3d6484e5c9fbc..55071d6da8f8a 100644 --- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py +++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py @@ -91,11 +91,15 @@ def get_cache_line_size(): # Test the local property again, is it set to new_cache_line_size? self.assertEqual(get_cache_line_size(), new_cache_line_size) +@expectedFailureAll( +hostoslist=["windows"], +remote=True, +bugnumber="github.com/llvm/llvm-project/issues/92419", +) def test_CreateTarget_platform(self): exe = self.getBuildArtifact("a.out") self.yaml2obj("elf.yaml", exe) error = lldb.SBError() -self.dbg.SetSelectedPlatform(lldb.SBPlatform("remote-linux")) target1 = self.dbg.CreateTarget(exe, None, "remote-linux", False, error) self.assertSuccess(error) platform1 = target1.GetPlatform() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the DAP tests in case of a remote target (PR #92416)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92416 These tests are based on dap_server which runs locally. These tests failed in case of Windows host and Linux target. >From 1760995804d1a37e144fc778fcda7de23903e337 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 19:42:17 +0400 Subject: [PATCH] [lldb] Fixed the DAP tests in case of a remote target These tests are based on dap_server which runs locally. These tests failed in case of Windows host and Linux target. --- lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py | 1 + lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py | 1 + 2 files changed, 2 insertions(+) diff --git a/lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py b/lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py index 2b3ec656c107a..3250a5093cac4 100644 --- a/lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py +++ b/lldb/test/API/tools/lldb-dap/completions/TestDAP_completions.py @@ -19,6 +19,7 @@ def verify_completions(self, actual_list, expected_list, not_expected_list=[]): self.assertNotIn(not_expected_item, actual_list) @skipIfWindows +@skipIfRemote @skipIf(compiler="clang", compiler_version=["<", "17.0"]) def test_completions(self): """ diff --git a/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py b/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py index 8c2c0154ba65c..58a67d8164368 100644 --- a/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py +++ b/lldb/test/API/tools/lldb-dap/exception/TestDAP_exception.py @@ -9,6 +9,7 @@ class TestDAP_exception(lldbdap_testcase.DAPTestCaseBase): +@skipIfRemote @skipIfWindows def test_stopped_description(self): """ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target (PR #92413)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92413 Install `_exe_to_attach` to a remote target if necessary. >From d88cc6d992e1f753066aa5dccaa510d8a0a35b94 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 19:18:21 +0400 Subject: [PATCH] [lldb] Fixed the test TestGdbRemoteAttachWait running on a remote target Install `_exe_to_attach` to a remote target if necessary. --- .../lldb-server/attach-wait/TestGdbRemoteAttachWait.py | 9 + 1 file changed, 9 insertions(+) diff --git a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py index f4c31fe2f5c07..a8333210a72b1 100644 --- a/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py +++ b/lldb/test/API/tools/lldb-server/attach-wait/TestGdbRemoteAttachWait.py @@ -52,6 +52,9 @@ def test_attach_with_vAttachWait(self): server = self.connect_to_debug_monitor() self.do_handshake() +if self._run_args: +self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) + # Launch the first inferior (we shouldn't attach to this one). self._launch_and_wait_for_init() @@ -101,6 +104,9 @@ def test_launch_before_attach_with_vAttachOrWait(self): server = self.connect_to_debug_monitor() self.do_handshake() +if self._run_args: +self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) + inferior = self._launch_and_wait_for_init() # Add attach packets. @@ -141,6 +147,9 @@ def test_launch_after_attach_with_vAttachOrWait(self): server = self.connect_to_debug_monitor() self.do_handshake() +if self._run_args: +self._run_args[0] = lldbutil.install_to_target(self, self._run_args[0]) + self.test_sequence.add_log_lines([self._attach_packet("vAttachOrWait")], True) # Run the stream until attachWait. context = self.expect_gdbremote_sequence() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the DAP tests in case of a remote target (PR #92398)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92398 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed an invalid error message in the DAP disconnect response (PR #92345)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92345 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the DAP tests in case of a remote target (PR #92398)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92398 These tests failed in case of Windows host and Linux target, because dap_server tried to run ELF file on Windows. >From 74fd3f5b36c5a91a2269bff8261ba494ae6553cc Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 17:23:08 +0400 Subject: [PATCH] [lldb] Fixed the DAP tests in case of a remote target These tests failed in case of Windows host and Linux target, because dap_server tried to run ELF file on Windows. --- lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py | 2 ++ .../API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py | 1 + 2 files changed, 3 insertions(+) diff --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py index 226b9385fe719..bfdf9ef2897b2 100644 --- a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py +++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py @@ -7,6 +7,7 @@ class TestDAP_commands(lldbdap_testcase.DAPTestCaseBase): +@skipIfRemote def test_command_directive_quiet_on_success(self): program = self.getBuildArtifact("a.out") command_quiet = ( @@ -60,6 +61,7 @@ def test_command_directive_abort_on_error_launch_commands(self): def test_command_directive_abort_on_error_pre_run_commands(self): self.do_test_abort_on_error(use_pre_run_commands=True) +@skipIfRemote def test_command_directive_abort_on_error_post_run_commands(self): self.do_test_abort_on_error(use_post_run_commands=True) diff --git a/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py b/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py index fd48e69cae5e2..7700c65f862dc 100644 --- a/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py +++ b/lldb/test/API/tools/lldb-dap/startDebugging/TestDAP_startDebugging.py @@ -11,6 +11,7 @@ class TestDAP_startDebugging(lldbdap_testcase.DAPTestCaseBase): +@skipIfRemote def test_startDebugging(self): """ Tests the "startDebugging" reverse request. It makes sure that the IDE can ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed an invalid error message in the DAP disconnect response (PR #92345)
@@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object ) { g_dap.debugger.SetAsync(false); lldb::SBError error = terminateDebuggee ? process.Kill() : process.Detach(); if (!error.Success()) - response.try_emplace("error", error.GetCString()); + response.try_emplace("error", std::string(error.GetCString())); slydiman wrote: I have updated the patch. Thanks. https://github.com/llvm/llvm-project/pull/92345 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed an invalid error message in the DAP disconnect response (PR #92345)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92345 >From 95336abaa000fa889888ce0f17af8098dfaeb8ea Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 08:09:19 +0400 Subject: [PATCH 1/2] [lldb] Fixed an invalid error message in the DAP disconnect response The `disconnect` response contains the `error` message with invalid characters (a junk data). To reproduce this issue it is enough to run the TestDAP_commands test on Windows host and Linux target. The test will fail to run ELF file on Windows and dap_server will be disconnected unexpectedly. Note dap_server hangs if read_packet() cannot decode JSON with invalid characters. read_packet() must return None in this case instead of an exception. But dap_server does not require any fix after this patch. --- lldb/tools/lldb-dap/lldb-dap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index 96da458be21d1..e9810f83678eb 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object ) { g_dap.debugger.SetAsync(false); lldb::SBError error = terminateDebuggee ? process.Kill() : process.Detach(); if (!error.Success()) - response.try_emplace("error", error.GetCString()); + response.try_emplace("error", std::string(error.GetCString())); g_dap.debugger.SetAsync(true); break; } >From 6528ad5c4e21f5cecaafb7a3b06285936e8dc1b3 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 17:06:58 +0400 Subject: [PATCH 2/2] Replaced with EmplaceSafeString(). --- lldb/tools/lldb-dap/lldb-dap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index e9810f83678eb..170fa88f1e8b8 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object ) { g_dap.debugger.SetAsync(false); lldb::SBError error = terminateDebuggee ? process.Kill() : process.Detach(); if (!error.Success()) - response.try_emplace("error", std::string(error.GetCString())); + EmplaceSafeString(response, "error", error.GetCString()); g_dap.debugger.SetAsync(true); break; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Move TestBase.runCmd() to the Base class (PR #92252)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92252 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Disable the TestGdbRemoteLibrariesSvr4Support test for Windows host (PR #92341)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92341 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed an invalid error message in the DAP disconnect response (PR #92345)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92345 The `disconnect` response contains the `error` message with invalid characters (a junk data). To reproduce this issue it is enough to run the `TestDAP_commands` test on Windows host and Linux target. The test will fail to run ELF file on Windows and dap_server will be disconnected unexpectedly. Note dap_server hangs if read_packet() cannot decode JSON with invalid characters. read_packet() must return None in this case instead of an exception. But dap_server does not require any fix after this patch. >From 95336abaa000fa889888ce0f17af8098dfaeb8ea Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 08:09:19 +0400 Subject: [PATCH] [lldb] Fixed an invalid error message in the DAP disconnect response The `disconnect` response contains the `error` message with invalid characters (a junk data). To reproduce this issue it is enough to run the TestDAP_commands test on Windows host and Linux target. The test will fail to run ELF file on Windows and dap_server will be disconnected unexpectedly. Note dap_server hangs if read_packet() cannot decode JSON with invalid characters. read_packet() must return None in this case instead of an exception. But dap_server does not require any fix after this patch. --- lldb/tools/lldb-dap/lldb-dap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/lldb-dap.cpp b/lldb/tools/lldb-dap/lldb-dap.cpp index 96da458be21d1..e9810f83678eb 100644 --- a/lldb/tools/lldb-dap/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/lldb-dap.cpp @@ -977,7 +977,7 @@ void request_disconnect(const llvm::json::Object ) { g_dap.debugger.SetAsync(false); lldb::SBError error = terminateDebuggee ? process.Kill() : process.Detach(); if (!error.Success()) - response.try_emplace("error", error.GetCString()); + response.try_emplace("error", std::string(error.GetCString())); g_dap.debugger.SetAsync(true); break; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestFdLeak test (PR #92273)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92273 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Disable the TestGdbRemoteLibrariesSvr4Support test for Windows host (PR #92341)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92341 Windows does not allow quotes in file names. So it is impossible to build `libsvr4lib_b".so` on Windows. >From d1c9b46114621ca3c739b50a45d4aad9c20a2df1 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 07:37:33 +0400 Subject: [PATCH] [lldb][Windows] Disable the TestGdbRemoteLibrariesSvr4Support test for Windows host Windows does not allow quotes in file names. So it is impossible to build `libsvr4lib_b".so` on Windows. --- .../libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py b/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py index 846adade34402..02c9d318525fb 100644 --- a/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py +++ b/lldb/test/API/tools/lldb-server/libraries-svr4/TestGdbRemoteLibrariesSvr4Support.py @@ -4,6 +4,8 @@ from lldbsuite.test.lldbtest import * +# Windows does not allow quotes in file names. +@skipIf(hostoslist=["windows"]) class TestGdbRemoteLibrariesSvr4Support(gdbremote_testcase.GdbRemoteTestCaseBase): FEATURE_NAME = "qXfer:libraries-svr4:read" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestFdLeak test (PR #92273)
slydiman wrote: > Could this use `os.devnull` Sure. It is much better. I have updated the patch. Thanks. https://github.com/llvm/llvm-project/pull/92273 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestFdLeak test (PR #92273)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92273 >From 6341c038d41ac3b533314568187b8d5d390dc861 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 18:38:16 +0400 Subject: [PATCH 1/2] [lldb] Fixed the TestFdLeak test Use `NUL` instead of `/dev/null` in case of the Windows host. --- lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py index e4f5cd3a03f86..e292885ec390d 100644 --- a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py +++ b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py @@ -26,7 +26,10 @@ def test_fd_leak_basic(self): @skipIfTargetAndroid() # Android have some other file descriptors open by the shell @skipIfDarwinEmbedded # # debugserver on ios has an extra fd open on launch def test_fd_leak_log(self): -self.do_test(["log enable -f '/dev/null' lldb commands"]) +if lldbplatformutil.getHostPlatform() == "windows": +self.do_test(["log enable -f 'NUL' lldb commands"]) +else: +self.do_test(["log enable -f '/dev/null' lldb commands"]) def do_test(self, commands): self.build() >From bace750680865ff5edd0314c3c11418f45f96439 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Thu, 16 May 2024 02:10:23 +0400 Subject: [PATCH 2/2] Updated to use os.devnull --- lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py index e292885ec390d..c840d38df5c76 100644 --- a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py +++ b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py @@ -26,10 +26,7 @@ def test_fd_leak_basic(self): @skipIfTargetAndroid() # Android have some other file descriptors open by the shell @skipIfDarwinEmbedded # # debugserver on ios has an extra fd open on launch def test_fd_leak_log(self): -if lldbplatformutil.getHostPlatform() == "windows": -self.do_test(["log enable -f 'NUL' lldb commands"]) -else: -self.do_test(["log enable -f '/dev/null' lldb commands"]) +self.do_test(["log enable -f '{}' lldb commands".format(os.devnull)]) def do_test(self, commands): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the TestIOHandlerResizeNoEditline test (PR #92286)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92286 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestNetBSDCore test (PR #92285)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92285 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92281 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestNetBSDCore test (PR #92285)
@@ -147,12 +147,12 @@ def check_stack(self, process, pid, filename): self.check_backtrace(thread, filename, backtrace) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64(self): +def test_aarch64_A(self): slydiman wrote: Sure. I have renamed them to suggested names. Thanks. https://github.com/llvm/llvm-project/pull/92285 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestNetBSDCore test (PR #92285)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92285 >From cd181f2b87008ae86c4195a74e9405b8a6e78da2 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 19:39:05 +0400 Subject: [PATCH 1/2] [lldb] Fixed the TestNetBSDCore test TestNetBSDCore.py contains 3 classes with the same test names test_aarch64 and test_amd64. It causes conflicts because the same build dir. Add suffixes to avoid conflicts. The error message on the Windows host running with `-j 2` is the following: ``` PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'E:\\projects\\lldb\\build-lldb\\lldb-test-build.noindex\\functionalities\\postmortem\\netbsd-core\\TestNetBSDCore.test_aarch64\\Incomplete.log' ``` --- .../postmortem/netbsd-core/TestNetBSDCore.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py index 756f4d1e81caa..d56b38eb513e9 100644 --- a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py +++ b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py @@ -147,12 +147,12 @@ def check_stack(self, process, pid, filename): self.check_backtrace(thread, filename, backtrace) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64(self): +def test_aarch64_A(self): """Test single-threaded aarch64 core dump.""" self.do_test("1lwp_SIGSEGV.aarch64", pid=8339, region_count=32) @skipIfLLVMTargetMissing("X86") -def test_amd64(self): +def test_amd64_A(self): """Test single-threaded amd64 core dump.""" self.do_test("1lwp_SIGSEGV.amd64", pid=693, region_count=21) @@ -177,12 +177,12 @@ def check_stack(self, process, pid, filename): self.assertEqual(thread.GetStopReasonDataAtIndex(0), 0) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64(self): +def test_aarch64_B(self): """Test double-threaded aarch64 core dump where thread 2 is signalled.""" self.do_test("2lwp_t2_SIGSEGV.aarch64", pid=14142, region_count=31) @skipIfLLVMTargetMissing("X86") -def test_amd64(self): +def test_amd64_B(self): """Test double-threaded amd64 core dump where thread 2 is signalled.""" self.do_test("2lwp_t2_SIGSEGV.amd64", pid=622, region_count=24) @@ -207,11 +207,11 @@ def check_stack(self, process, pid, filename): self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64(self): +def test_aarch64_C(self): """Test double-threaded aarch64 core dump where process is signalled.""" self.do_test("2lwp_process_SIGSEGV.aarch64", pid=1403, region_count=30) @skipIfLLVMTargetMissing("X86") -def test_amd64(self): +def test_amd64_C(self): """Test double-threaded amd64 core dump where process is signalled.""" self.do_test("2lwp_process_SIGSEGV.amd64", pid=665, region_count=24) >From 9032144a256cf8ba2838e935dfc3fc79fddff9ce Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 21:00:30 +0400 Subject: [PATCH 2/2] Renamed to more meaningful names. --- .../postmortem/netbsd-core/TestNetBSDCore.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py index d56b38eb513e9..ff1ef21e02e31 100644 --- a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py +++ b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py @@ -147,12 +147,12 @@ def check_stack(self, process, pid, filename): self.check_backtrace(thread, filename, backtrace) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64_A(self): +def test_aarch64_single_threaded(self): """Test single-threaded aarch64 core dump.""" self.do_test("1lwp_SIGSEGV.aarch64", pid=8339, region_count=32) @skipIfLLVMTargetMissing("X86") -def test_amd64_A(self): +def test_amd64_single_threaded(self): """Test single-threaded amd64 core dump.""" self.do_test("1lwp_SIGSEGV.amd64", pid=693, region_count=21) @@ -177,12 +177,12 @@ def check_stack(self, process, pid, filename): self.assertEqual(thread.GetStopReasonDataAtIndex(0), 0) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64_B(self): +def test_aarch64_thread_signaled(self): """Test double-threaded aarch64 core dump where thread 2 is signalled.""" self.do_test("2lwp_t2_SIGSEGV.aarch64", pid=14142, region_count=31) @skipIfLLVMTargetMissing("X86") -def test_amd64_B(self): +def test_amd64_thread_signaled(self): """Test
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92088 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestGdbRemoteCompletion test (PR #92268)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92268 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
@@ -107,9 +107,20 @@ def test_process_unload(self): self, "// Break here", lldb.SBFileSpec("main.cpp") ) err = lldb.SBError() -self.process().LoadImage( -lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), err -) +if lldb.remote_platform: +self.process().LoadImage( +lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), +lldb.SBFileSpec( +lldbutil.append_to_process_working_directory(self, "libshared.so"), +False, +), +err, +) +else: +self.process().LoadImage( +lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), +err, +) slydiman wrote: I have updated the patch. Thanks. https://github.com/llvm/llvm-project/pull/92281 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92281 >From f2badfe871dc3d17d4053be1c25f9abdf8d10a0c Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 19:21:25 +0400 Subject: [PATCH 1/2] [lldb] Fixed the TestCompletion test running on a remote target Install the image to the remote target if necessary. Platform::LoadImage() uses the following logic before DoLoadImage() ``` if (IsRemote() || local_file != remote_file) { error = Install(local_file, remote_file); ... } ``` The FileSpec for the local path may be resolved, so it is necessary to use the condition `if lldb.remote_platform:`. --- .../completion/TestCompletion.py| 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py index 0d6907e0c3d22..9959c7363aa2b 100644 --- a/lldb/test/API/functionalities/completion/TestCompletion.py +++ b/lldb/test/API/functionalities/completion/TestCompletion.py @@ -107,9 +107,20 @@ def test_process_unload(self): self, "// Break here", lldb.SBFileSpec("main.cpp") ) err = lldb.SBError() -self.process().LoadImage( -lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), err -) +if lldb.remote_platform: +self.process().LoadImage( +lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), +lldb.SBFileSpec( +lldbutil.append_to_process_working_directory(self, "libshared.so"), +False, +), +err, +) +else: +self.process().LoadImage( +lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), +err, +) self.assertSuccess(err) self.complete_from_to("process unload ", "process unload 0") >From 3661437dd9df68210b5f92b03ac53abc65922189 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 20:43:42 +0400 Subject: [PATCH 2/2] Optimized. --- .../completion/TestCompletion.py | 24 --- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py index 9959c7363aa2b..63842487fc338 100644 --- a/lldb/test/API/functionalities/completion/TestCompletion.py +++ b/lldb/test/API/functionalities/completion/TestCompletion.py @@ -107,20 +107,16 @@ def test_process_unload(self): self, "// Break here", lldb.SBFileSpec("main.cpp") ) err = lldb.SBError() -if lldb.remote_platform: -self.process().LoadImage( -lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), -lldb.SBFileSpec( -lldbutil.append_to_process_working_directory(self, "libshared.so"), -False, -), -err, -) -else: -self.process().LoadImage( -lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), -err, +local_spec = lldb.SBFileSpec(self.getBuildArtifact("libshared.so")) +remote_spec = ( +lldb.SBFileSpec( +lldbutil.append_to_process_working_directory(self, "libshared.so"), +False, ) +if lldb.remote_platform +else lldb.SBFileSpec() +) +self.process().LoadImage(local_spec, remote_spec, err) self.assertSuccess(err) self.complete_from_to("process unload ", "process unload 0") @@ -484,7 +480,7 @@ def test_custom_command_completion(self): self.complete_from_to("my_test_cmd main.cp", ["main.cpp"]) self.expect("my_test_cmd main.cpp", substrs=["main.cpp"]) -@skipIfWindows +@skipIf(hostoslist=["windows"]) def test_completion_target_create_from_root_dir(self): """Tests source file completion by completing .""" root_dir = os.path.abspath(os.sep) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the TestIOHandlerResizeNoEditline test (PR #92286)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92286 This test caused python crash on Windows x86_64 host with the exit code 0xC409 (STATUS_STACK_BUFFER_OVERRUN). Close the input stream before exit to avoid this crash. >From b6d9b129dc92eea0bd7347ea6ae2a305178dbd46 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 19:47:48 +0400 Subject: [PATCH] [lldb][Windows] Fixed the TestIOHandlerResizeNoEditline test This test caused python crash on Windows x86_64 host with the exit code 0xC409 (STATUS_STACK_BUFFER_OVERRUN). Close the input stream before exit to avoid this crash. --- lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py b/lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py index 3c07554f6cafd..bbc2dcbe4e30a 100644 --- a/lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py +++ b/lldb/test/API/iohandler/resize/TestIOHandlerResizeNoEditline.py @@ -18,3 +18,4 @@ def test_resize_no_editline(self): dbg.RunCommandInterpreter(True, True, opts, 0, False, False) # Try resizing the terminal which shouldn't crash. dbg.SetTerminalWidth(47) +dbg.GetInputFile().Close() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestNetBSDCore test (PR #92285)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92285 TestNetBSDCore.py contains 3 classes with the same test names test_aarch64 and test_amd64. It causes conflicts because the same build dir. Add suffixes to avoid conflicts. The error message on the Windows host running with `-j 2` is the following: ``` PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'E:\\projects\\lldb\\build-lldb\\lldb-test-build.noindex\\functionalities\\postmortem\\netbsd-core\\TestNetBSDCore.test_aarch64\\Incomplete.log' ``` >From cd181f2b87008ae86c4195a74e9405b8a6e78da2 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 19:39:05 +0400 Subject: [PATCH] [lldb] Fixed the TestNetBSDCore test TestNetBSDCore.py contains 3 classes with the same test names test_aarch64 and test_amd64. It causes conflicts because the same build dir. Add suffixes to avoid conflicts. The error message on the Windows host running with `-j 2` is the following: ``` PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'E:\\projects\\lldb\\build-lldb\\lldb-test-build.noindex\\functionalities\\postmortem\\netbsd-core\\TestNetBSDCore.test_aarch64\\Incomplete.log' ``` --- .../postmortem/netbsd-core/TestNetBSDCore.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py index 756f4d1e81caa..d56b38eb513e9 100644 --- a/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py +++ b/lldb/test/API/functionalities/postmortem/netbsd-core/TestNetBSDCore.py @@ -147,12 +147,12 @@ def check_stack(self, process, pid, filename): self.check_backtrace(thread, filename, backtrace) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64(self): +def test_aarch64_A(self): """Test single-threaded aarch64 core dump.""" self.do_test("1lwp_SIGSEGV.aarch64", pid=8339, region_count=32) @skipIfLLVMTargetMissing("X86") -def test_amd64(self): +def test_amd64_A(self): """Test single-threaded amd64 core dump.""" self.do_test("1lwp_SIGSEGV.amd64", pid=693, region_count=21) @@ -177,12 +177,12 @@ def check_stack(self, process, pid, filename): self.assertEqual(thread.GetStopReasonDataAtIndex(0), 0) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64(self): +def test_aarch64_B(self): """Test double-threaded aarch64 core dump where thread 2 is signalled.""" self.do_test("2lwp_t2_SIGSEGV.aarch64", pid=14142, region_count=31) @skipIfLLVMTargetMissing("X86") -def test_amd64(self): +def test_amd64_B(self): """Test double-threaded amd64 core dump where thread 2 is signalled.""" self.do_test("2lwp_t2_SIGSEGV.amd64", pid=622, region_count=24) @@ -207,11 +207,11 @@ def check_stack(self, process, pid, filename): self.assertEqual(thread.GetStopReasonDataAtIndex(0), signal.SIGSEGV) @skipIfLLVMTargetMissing("AArch64") -def test_aarch64(self): +def test_aarch64_C(self): """Test double-threaded aarch64 core dump where process is signalled.""" self.do_test("2lwp_process_SIGSEGV.aarch64", pid=1403, region_count=30) @skipIfLLVMTargetMissing("X86") -def test_amd64(self): +def test_amd64_C(self): """Test double-threaded amd64 core dump where process is signalled.""" self.do_test("2lwp_process_SIGSEGV.amd64", pid=665, region_count=24) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestCompletion test running on a remote target (PR #92281)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92281 Install the image to the remote target if necessary. Platform::LoadImage() uses the following logic before DoLoadImage() ``` if (IsRemote() || local_file != remote_file) { error = Install(local_file, remote_file); ... } ``` The FileSpec for the local path may be resolved, so it is necessary to use the condition `if lldb.remote_platform:`. >From f2badfe871dc3d17d4053be1c25f9abdf8d10a0c Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 19:21:25 +0400 Subject: [PATCH] [lldb] Fixed the TestCompletion test running on a remote target Install the image to the remote target if necessary. Platform::LoadImage() uses the following logic before DoLoadImage() ``` if (IsRemote() || local_file != remote_file) { error = Install(local_file, remote_file); ... } ``` The FileSpec for the local path may be resolved, so it is necessary to use the condition `if lldb.remote_platform:`. --- .../completion/TestCompletion.py| 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lldb/test/API/functionalities/completion/TestCompletion.py b/lldb/test/API/functionalities/completion/TestCompletion.py index 0d6907e0c3d22..9959c7363aa2b 100644 --- a/lldb/test/API/functionalities/completion/TestCompletion.py +++ b/lldb/test/API/functionalities/completion/TestCompletion.py @@ -107,9 +107,20 @@ def test_process_unload(self): self, "// Break here", lldb.SBFileSpec("main.cpp") ) err = lldb.SBError() -self.process().LoadImage( -lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), err -) +if lldb.remote_platform: +self.process().LoadImage( +lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), +lldb.SBFileSpec( +lldbutil.append_to_process_working_directory(self, "libshared.so"), +False, +), +err, +) +else: +self.process().LoadImage( +lldb.SBFileSpec(self.getBuildArtifact("libshared.so")), +err, +) self.assertSuccess(err) self.complete_from_to("process unload ", "process unload 0") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestFdLeak test (PR #92273)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92273 Use `NUL` instead of `/dev/null` in case of the Windows host. >From 6341c038d41ac3b533314568187b8d5d390dc861 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 18:38:16 +0400 Subject: [PATCH] [lldb] Fixed the TestFdLeak test Use `NUL` instead of `/dev/null` in case of the Windows host. --- lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py index e4f5cd3a03f86..e292885ec390d 100644 --- a/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py +++ b/lldb/test/API/functionalities/avoids-fd-leak/TestFdLeak.py @@ -26,7 +26,10 @@ def test_fd_leak_basic(self): @skipIfTargetAndroid() # Android have some other file descriptors open by the shell @skipIfDarwinEmbedded # # debugserver on ios has an extra fd open on launch def test_fd_leak_log(self): -self.do_test(["log enable -f '/dev/null' lldb commands"]) +if lldbplatformutil.getHostPlatform() == "windows": +self.do_test(["log enable -f 'NUL' lldb commands"]) +else: +self.do_test(["log enable -f '/dev/null' lldb commands"]) def do_test(self, commands): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the TestGdbRemoteCompletion test (PR #92268)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92268 Do not try to run lldb-server on localhost in case of the remote target. >From 1b200d1844d0241459fdc11064dc6b61a963e62f Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 18:29:17 +0400 Subject: [PATCH] [lldb] Fixed the TestGdbRemoteCompletion test Do not try to run lldb-server on localhost in case of the remote target. --- lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py index 04d6abe9d88c1..58373d2f85bb9 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteCompletion.py @@ -26,6 +26,7 @@ def init_lldb_server(self): def generate_hex_path(self, target): return str(os.path.join(self.getBuildDir(), target)).encode().hex() +@skipIfRemote @add_test_categories(["llgs"]) def test_autocomplete_path(self): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)
slydiman wrote: Now we are in the middle of configuring buildbot and trying to get it green. I have added [the issues 92255](https://github.com/llvm/llvm-project/issues/92255). Hope we will fix it later. Thanks. https://github.com/llvm/llvm-project/pull/92088 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92088 >From 7dcfe773b6eef27aabbcc7fc68cd6448bc3c2e88 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 13:08:35 +0400 Subject: [PATCH 1/3] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile The tests `test_file_permissions` and `test_file_permissions_fallback` are disabled for Windows target. These tests use MockGDBServerResponder and do not depend on the real target. These tests failed in case of Windows host and Linux target. Disable them for Windows host too. --- .../gdb_remote_client/TestGDBRemotePlatformFile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py index 2be5ae3132038..9ef0954af1fe3 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py @@ -148,6 +148,7 @@ def vFile(self, packet): ) @skipIfWindows +@skipIf(hostoslist=["windows"]) def test_file_permissions(self): """Test 'platform get-permissions'""" @@ -168,6 +169,7 @@ def vFile(self, packet): ) @skipIfWindows +@skipIf(hostoslist=["windows"]) def test_file_permissions_fallback(self): """Test 'platform get-permissions' fallback to fstat""" >From 478d251691d511916cae5fc344d549450222d584 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 20:23:56 +0400 Subject: [PATCH 2/3] Removed @skipIfWindows --- .../gdb_remote_client/TestGDBRemotePlatformFile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py index 9ef0954af1fe3..b1c6f0822d1a8 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py @@ -147,7 +147,6 @@ def vFile(self, packet): log=server2.responder.packetLog, ) -@skipIfWindows @skipIf(hostoslist=["windows"]) def test_file_permissions(self): """Test 'platform get-permissions'""" @@ -168,7 +167,6 @@ def vFile(self, packet): ] ) -@skipIfWindows @skipIf(hostoslist=["windows"]) def test_file_permissions_fallback(self): """Test 'platform get-permissions' fallback to fstat""" >From 4f85d2379350306d915a94e0dd67377feb049fdb Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 17:10:26 +0400 Subject: [PATCH 3/3] Replaced @skipIf with @expectedFailureAll and bugnumber --- .../gdb_remote_client/TestGDBRemotePlatformFile.py| 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py index b1c6f0822d1a8..c902722a2f74b 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py @@ -147,7 +147,9 @@ def vFile(self, packet): log=server2.responder.packetLog, ) -@skipIf(hostoslist=["windows"]) +@expectedFailureAll( +hostoslist=["windows"], bugnumber="github.com/llvm/llvm-project/issues/92255" +) def test_file_permissions(self): """Test 'platform get-permissions'""" @@ -167,7 +169,9 @@ def vFile(self, packet): ] ) -@skipIf(hostoslist=["windows"]) +@expectedFailureAll( +hostoslist=["windows"], bugnumber="github.com/llvm/llvm-project/issues/92255" +) def test_file_permissions_fallback(self): """Test 'platform get-permissions' fallback to fstat""" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Move TestBase.runCmd() to the Base class (PR #92252)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92252 runCmd() is called from Base.getCPUInfo() but implemented only in TestBase(Base). Usually it works if TestBase is used. But call getCPUInfo() from a class based on Base will cause something like ``` File "E:\projects\llvm-nino\lldb\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 1256, in getCPUInfo self.runCmd('platform get-file "/proc/cpuinfo" ' + cpuinfo_path) AttributeError: 'TestGdbRemoteExpeditedRegisters' object has no attribute 'runCmd' ``` BTW, TestBase.setUp() called runCmd() before applying LLDB_MAX_LAUNCH_COUNT and LLDB_TIME_WAIT_NEXT_LAUNCH. This patch fixes the test TestGdbRemoteExpeditedRegisters in case of Windows host and Linux target. >From 3df0ffbf3ff66b6ee9419adf288efc2bbdd2c949 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Wed, 15 May 2024 15:54:25 +0400 Subject: [PATCH] [lldb] Move TestBase.runCmd() to the base class Base runCmd() is called from Base.getCPUInfo() but implemented only in TestBase(Base). Usually it works if TestBase is used. But call getCPUInfo() from a class based on Base will cause something like ``` File "E:\projects\llvm-nino\lldb\llvm-project\lldb\packages\Python\lldbsuite\test\lldbtest.py", line 1256, in getCPUInfo self.runCmd('platform get-file "/proc/cpuinfo" ' + cpuinfo_path) AttributeError: 'TestGdbRemoteExpeditedRegisters' object has no attribute 'runCmd' ``` BTW, TestBase.setUp() called runCmd() before applying LLDB_MAX_LAUNCH_COUNT and LLDB_TIME_WAIT_NEXT_LAUNCH. This patch fixes the test TestGdbRemoteExpeditedRegisters in case of Windows host and Linux target. --- .../Python/lldbsuite/test/lldbtest.py | 130 +- 1 file changed, 65 insertions(+), 65 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py index 5fd686c143e9f..1ad8ab6e6e462 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbtest.py +++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py @@ -531,6 +531,14 @@ class Base(unittest.TestCase): # Keep track of the old current working directory. oldcwd = None +# Maximum allowed attempts when launching the inferior process. +# Can be overridden by the LLDB_MAX_LAUNCH_COUNT environment variable. +maxLaunchCount = 1 + +# Time to wait before the next launching attempt in second(s). +# Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable. +timeWaitNextLaunch = 1.0 + @staticmethod def compute_mydir(test_file): """Subclasses should call this function to correctly calculate the @@ -796,6 +804,12 @@ def setUp(self): # import traceback # traceback.print_stack() +if "LLDB_MAX_LAUNCH_COUNT" in os.environ: +self.maxLaunchCount = int(os.environ["LLDB_MAX_LAUNCH_COUNT"]) + +if "LLDB_TIME_WAIT_NEXT_LAUNCH" in os.environ: +self.timeWaitNextLaunch = float(os.environ["LLDB_TIME_WAIT_NEXT_LAUNCH"]) + if "LIBCXX_PATH" in os.environ: self.libcxxPath = os.environ["LIBCXX_PATH"] else: @@ -937,6 +951,57 @@ def spawnSubprocess(self, executable, args=[], extra_env=None, install_remote=Tr self.subprocesses.append(proc) return proc +def runCmd(self, cmd, msg=None, check=True, trace=False, inHistory=False): +""" +Ask the command interpreter to handle the command and then check its +return status. +""" +# Fail fast if 'cmd' is not meaningful. +if cmd is None: +raise Exception("Bad 'cmd' parameter encountered") + +trace = True if traceAlways else trace + +if cmd.startswith("target create "): +cmd = cmd.replace("target create ", "file ") + +running = cmd.startswith("run") or cmd.startswith("process launch") + +for i in range(self.maxLaunchCount if running else 1): +with recording(self, trace) as sbuf: +print("runCmd:", cmd, file=sbuf) +if not check: +print("check of return status not required", file=sbuf) + +self.ci.HandleCommand(cmd, self.res, inHistory) + +with recording(self, trace) as sbuf: +if self.res.Succeeded(): +print("output:", self.res.GetOutput(), file=sbuf) +else: +print("runCmd failed!", file=sbuf) +print(self.res.GetError(), file=sbuf) + +if self.res.Succeeded(): +break +elif running: +# For process launch, wait some time before possible next try. +time.sleep(self.timeWaitNextLaunch) +with recording(self, trace) as sbuf: +print("Command '" + cmd + "' failed!", file=sbuf) + +if check: +output = "" +if self.res.GetOutput(): +
[Lldb-commits] [lldb] [lldb][Windows] Fixed tests TestPty and TestPtyServer (PR #92090)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92090 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)
slydiman wrote: The problem is here lldb\source\Plugins\Process\gdb-remote\GDBRemoteCommunicationClient.cpp, line 3235 inside GDBRemoteCommunicationClient::GetFilePermissions() ``` file_permissions = mode & (S_IRWXU | S_IRWXG | S_IRWXO); ``` But S_IRWXU, S_IRWXG and S_IRWXO are 0 on Windows. https://github.com/llvm/llvm-project/pull/92088 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)
slydiman wrote: I have removed @skipIfWindows because these tests are host specific. https://github.com/llvm/llvm-project/pull/92088 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92088 >From 7dcfe773b6eef27aabbcc7fc68cd6448bc3c2e88 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 13:08:35 +0400 Subject: [PATCH 1/2] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile The tests `test_file_permissions` and `test_file_permissions_fallback` are disabled for Windows target. These tests use MockGDBServerResponder and do not depend on the real target. These tests failed in case of Windows host and Linux target. Disable them for Windows host too. --- .../gdb_remote_client/TestGDBRemotePlatformFile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py index 2be5ae3132038..9ef0954af1fe3 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py @@ -148,6 +148,7 @@ def vFile(self, packet): ) @skipIfWindows +@skipIf(hostoslist=["windows"]) def test_file_permissions(self): """Test 'platform get-permissions'""" @@ -168,6 +169,7 @@ def vFile(self, packet): ) @skipIfWindows +@skipIf(hostoslist=["windows"]) def test_file_permissions_fallback(self): """Test 'platform get-permissions' fallback to fstat""" >From 478d251691d511916cae5fc344d549450222d584 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 20:23:56 +0400 Subject: [PATCH 2/2] Removed @skipIfWindows --- .../gdb_remote_client/TestGDBRemotePlatformFile.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py index 9ef0954af1fe3..b1c6f0822d1a8 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py @@ -147,7 +147,6 @@ def vFile(self, packet): log=server2.responder.packetLog, ) -@skipIfWindows @skipIf(hostoslist=["windows"]) def test_file_permissions(self): """Test 'platform get-permissions'""" @@ -168,7 +167,6 @@ def vFile(self, packet): ] ) -@skipIfWindows @skipIf(hostoslist=["windows"]) def test_file_permissions_fallback(self): """Test 'platform get-permissions' fallback to fstat""" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)
slydiman wrote: The problem is that fstat() is fake on Windows. File::GetPermissions() returns 0 always. The test got 'File permissions of /some/file.txt (remote): 0o' So any permissions manipulations are useles on Windows and these tests cannot be adapted. https://github.com/llvm/llvm-project/pull/92088 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestThreadStates when run with a remote target (PR #92086)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92086 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed tests TestPty and TestPtyServer (PR #92090)
slydiman wrote: Agreed. I have removed `@skipIfWindows`. @skipIfRemote is too much. These tests are still usable for Linux->Linux and such. https://github.com/llvm/llvm-project/pull/92090 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed tests TestPty and TestPtyServer (PR #92090)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/92090 >From b5b4b996bfa0cdba70f7935e452d6adde6b3cc15 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 13:18:42 +0400 Subject: [PATCH 1/2] [lldb][Windows] Fixed tests TestPty and TestPtyServer The tests TestPty and TestPtyServer use the Unix specific python builtin module termios. They are failed in case of Windows host and Linux target. Disable them for Windows host too. --- lldb/test/API/functionalities/gdb_remote_client/TestPty.py | 1 + lldb/test/API/tools/lldb-server/TestPtyServer.py | 1 + 2 files changed, 2 insertions(+) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestPty.py b/lldb/test/API/functionalities/gdb_remote_client/TestPty.py index 4d4dd489b294a..9e5c780a24b1b 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestPty.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestPty.py @@ -6,6 +6,7 @@ @skipIfWindows +@skipIf(hostoslist=["windows"]) class TestPty(GDBRemoteTestBase): server_socket_class = PtyServerSocket diff --git a/lldb/test/API/tools/lldb-server/TestPtyServer.py b/lldb/test/API/tools/lldb-server/TestPtyServer.py index aa5bd635650ac..7d91d762cb3ba 100644 --- a/lldb/test/API/tools/lldb-server/TestPtyServer.py +++ b/lldb/test/API/tools/lldb-server/TestPtyServer.py @@ -8,6 +8,7 @@ @skipIfWindows +@skipIf(hostoslist=["windows"]) class PtyServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): def setUp(self): super().setUp() >From 56cd7e510ddfd8b14f2e2da819bfe6b4a74e7b05 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 20:00:13 +0400 Subject: [PATCH 2/2] Removed @skipIfWindows. --- lldb/test/API/functionalities/gdb_remote_client/TestPty.py | 1 - lldb/test/API/tools/lldb-server/TestPtyServer.py | 1 - 2 files changed, 2 deletions(-) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestPty.py b/lldb/test/API/functionalities/gdb_remote_client/TestPty.py index 9e5c780a24b1b..94eeb6e3ba11a 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestPty.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestPty.py @@ -5,7 +5,6 @@ from lldbsuite.test.lldbgdbclient import GDBRemoteTestBase -@skipIfWindows @skipIf(hostoslist=["windows"]) class TestPty(GDBRemoteTestBase): server_socket_class = PtyServerSocket diff --git a/lldb/test/API/tools/lldb-server/TestPtyServer.py b/lldb/test/API/tools/lldb-server/TestPtyServer.py index 7d91d762cb3ba..4bfcf70bfa01b 100644 --- a/lldb/test/API/tools/lldb-server/TestPtyServer.py +++ b/lldb/test/API/tools/lldb-server/TestPtyServer.py @@ -7,7 +7,6 @@ import xml.etree.ElementTree as ET -@skipIfWindows @skipIf(hostoslist=["windows"]) class PtyServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): def setUp(self): ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestExec (PR #92082)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92082 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestDyldLaunchLinux (PR #92080)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/92080 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Enforce exec permission using Platform::Install() from Windows host (PR #91887)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/91887 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed tests TestPty and TestPtyServer (PR #92090)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92090 The tests TestPty and TestPtyServer use the Unix specific python builtin module termios. They are failed in case of Windows host and Linux target. Disable them for Windows host too. >From b5b4b996bfa0cdba70f7935e452d6adde6b3cc15 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 13:18:42 +0400 Subject: [PATCH] [lldb][Windows] Fixed tests TestPty and TestPtyServer The tests TestPty and TestPtyServer use the Unix specific python builtin module termios. They are failed in case of Windows host and Linux target. Disable them for Windows host too. --- lldb/test/API/functionalities/gdb_remote_client/TestPty.py | 1 + lldb/test/API/tools/lldb-server/TestPtyServer.py | 1 + 2 files changed, 2 insertions(+) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestPty.py b/lldb/test/API/functionalities/gdb_remote_client/TestPty.py index 4d4dd489b294a..9e5c780a24b1b 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestPty.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestPty.py @@ -6,6 +6,7 @@ @skipIfWindows +@skipIf(hostoslist=["windows"]) class TestPty(GDBRemoteTestBase): server_socket_class = PtyServerSocket diff --git a/lldb/test/API/tools/lldb-server/TestPtyServer.py b/lldb/test/API/tools/lldb-server/TestPtyServer.py index aa5bd635650ac..7d91d762cb3ba 100644 --- a/lldb/test/API/tools/lldb-server/TestPtyServer.py +++ b/lldb/test/API/tools/lldb-server/TestPtyServer.py @@ -8,6 +8,7 @@ @skipIfWindows +@skipIf(hostoslist=["windows"]) class PtyServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): def setUp(self): super().setUp() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile (PR #92088)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92088 The tests `test_file_permissions` and `test_file_permissions_fallback` are disabled for Windows target. These tests use MockGDBServerResponder and do not depend on the real target. These tests failed in case of Windows host and Linux target. Disable them for Windows host too. >From 7dcfe773b6eef27aabbcc7fc68cd6448bc3c2e88 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 13:08:35 +0400 Subject: [PATCH] [lldb][Windows] Fixed the test gdb_remote_client/TestGDBRemotePlatformFile The tests `test_file_permissions` and `test_file_permissions_fallback` are disabled for Windows target. These tests use MockGDBServerResponder and do not depend on the real target. These tests failed in case of Windows host and Linux target. Disable them for Windows host too. --- .../gdb_remote_client/TestGDBRemotePlatformFile.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py index 2be5ae3132038..9ef0954af1fe3 100644 --- a/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py +++ b/lldb/test/API/functionalities/gdb_remote_client/TestGDBRemotePlatformFile.py @@ -148,6 +148,7 @@ def vFile(self, packet): ) @skipIfWindows +@skipIf(hostoslist=["windows"]) def test_file_permissions(self): """Test 'platform get-permissions'""" @@ -168,6 +169,7 @@ def vFile(self, packet): ) @skipIfWindows +@skipIf(hostoslist=["windows"]) def test_file_permissions_fallback(self): """Test 'platform get-permissions' fallback to fstat""" ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestThreadStates when run with a remote target (PR #92086)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92086 self.wait_for_running_event(process) is always called after self.runCmd("continue"). It is strange to expect eStateConnected here. This test failed in case of a remote target. The correct state is eStateRunning. Removed incorrect checking. >From 27df461f6a03581cdcdb6911a943e694125061ee Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 12:52:20 +0400 Subject: [PATCH] [lldb] Fixed the test TestThreadStates when run with a remote target self.wait_for_running_event(process) is always called after self.runCmd("continue"). It is strange to expect eStateConnected here. This test failed in case of a remote target. The correct state is eStateRunning. Removed incorrect checking. --- .../test/API/functionalities/thread/state/TestThreadStates.py | 4 1 file changed, 4 deletions(-) diff --git a/lldb/test/API/functionalities/thread/state/TestThreadStates.py b/lldb/test/API/functionalities/thread/state/TestThreadStates.py index f4c17df523382..4dbe230c0ce85 100644 --- a/lldb/test/API/functionalities/thread/state/TestThreadStates.py +++ b/lldb/test/API/functionalities/thread/state/TestThreadStates.py @@ -102,10 +102,6 @@ def thread_state_after_breakpoint_test(self): def wait_for_running_event(self, process): listener = self.dbg.GetListener() -if lldb.remote_platform: -lldbutil.expect_state_changes( -self, listener, process, [lldb.eStateConnected] -) lldbutil.expect_state_changes(self, listener, process, [lldb.eStateRunning]) def thread_state_after_continue_test(self): ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestDyldLaunchLinux (PR #92080)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92080 Install a.out and libsignal_file.so to the remote target if necessary. >From a5b005cbbfd25c9fb3e59f2cb0f98c2f6a3e405d Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 12:05:27 +0400 Subject: [PATCH] [lldb] Fixed the test TestDyldLaunchLinux Install a.out and libsignal_file.so to the remote target if necessary. --- .../dyld-launch-linux/TestDyldLaunchLinux.py| 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py b/lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py index 26360c20db1e2..016b60ec88111 100644 --- a/lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py +++ b/lldb/test/API/functionalities/dyld-launch-linux/TestDyldLaunchLinux.py @@ -7,6 +7,7 @@ from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil class TestLinux64LaunchingViaDynamicLoader(TestBase): @@ -39,11 +40,14 @@ def test(self): breakpoint_shared_library = target.BreakpointCreateBySourceRegex( "get_signal_crash", lldb.SBFileSpec("signal_file.cpp") ) +inferior_exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out")) +lldbutil.install_to_target(self, self.getBuildArtifact("libsignal_file.so")) + launch_info = lldb.SBLaunchInfo( [ "--library-path", self.get_process_working_directory(), -self.getBuildArtifact("a.out"), +inferior_exe_path, ] ) launch_info.SetWorkingDirectory(self.get_process_working_directory()) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Fixed the test TestGdbRemoteMemoryTagging (PR #92077)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/92077 Windows path is case insensitive. Tests `test_QMemTags_packets` and `test_qMemTags_packets` will use the same build dir and conflict. Added a suffix to resolve conflicts. >From 2b75da41ef3a0056375d01d45954d0ef033414c4 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Tue, 14 May 2024 11:51:12 +0400 Subject: [PATCH] [lldb][Windows] Fixed the test TestGdbRemoteMemoryTagging Windows path is case insensitive. Tests `test_QMemTags_packets` and `test_qMemTags_packets` will use the same build dir and conflict. Added a suffix to resolve conflicts. --- .../lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py b/lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py index 584de5e2ef49e..e14c7b4a39d58 100644 --- a/lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py +++ b/lldb/test/API/tools/lldb-server/memory-tagging/TestGdbRemoteMemoryTagging.py @@ -84,7 +84,7 @@ def prep_memtags_test(self): @skipUnlessArch("aarch64") @skipUnlessPlatform(["linux"]) @skipUnlessAArch64MTELinuxCompiler -def test_qMemTags_packets(self): +def test_qMemTags_packets_A(self): """Test that qMemTags packets are parsed correctly and/or rejected.""" buf_address, page_size = self.prep_memtags_test() @@ -154,7 +154,7 @@ def check_tag_write(self, body, expected): @skipUnlessArch("aarch64") @skipUnlessPlatform(["linux"]) @skipUnlessAArch64MTELinuxCompiler -def test_QMemTags_packets(self): +def test_QMemTags_packets_B(self): """Test that QMemTags packets are parsed correctly and/or rejected.""" buf_address, page_size = self.prep_memtags_test() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/91931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix the test TestGdbRemotePlatformFile (PR #91918)
@@ -108,6 +109,20 @@ def test_platform_file_wronly_fail(self): ) self.expect_gdbremote_sequence() +def remote_install(self, path, filename="test"): +if lldb.remote_platform: +remote_path = lldbutil.append_to_process_working_directory(self, filename) +err = lldb.remote_platform.Install( +lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) +) +if err.Fail(): +raise Exception( +"remote_platform.Install('%s', '%s') failed: %s" +% (path, remote_path, err) +) +path = remote_path +return path slydiman wrote: I have updated this patch using lldbutil.install_to_target(). https://github.com/llvm/llvm-project/pull/91918 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix the test TestGdbRemotePlatformFile (PR #91918)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/91918 >From 4eee83a3a6b923075a9e6db217349726780c31f4 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 10:34:04 +0400 Subject: [PATCH] [lldb] Fix the test TestGdbRemotePlatformFile It is necessary to transfer the test file to/from the really remote target (for example Windows host and Linux target). Also ignore chmod check in case of Windows host. --- .../lldb-server/TestGdbRemotePlatformFile.py | 33 +-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py b/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py index 4c8ce01e8ba31..2e1c72ee56d7a 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemotePlatformFile.py @@ -1,6 +1,7 @@ # lldb test suite imports from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import TestBase +from lldbsuite.test import lldbutil # gdb-remote-specific imports import lldbgdbserverutils @@ -117,6 +118,7 @@ def test_platform_file_wronly_creat_excl_fail(self): temp_file = self.getBuildArtifact("test") with open(temp_file, "wb"): pass +temp_file = lldbutil.install_to_target(self, temp_file) # attempt to open the file with O_CREAT|O_EXCL self.do_handshake() @@ -140,6 +142,7 @@ def test_platform_file_size(self): test_data = b"test data of some length" with open(temp_path, "wb") as temp_file: temp_file.write(test_data) +temp_path = lldbutil.install_to_target(self, temp_path) self.do_handshake() self.test_sequence.add_log_lines( @@ -167,7 +170,11 @@ def test_platform_file_mode(self): test_mode = 0o751 with open(temp_path, "wb") as temp_file: -os.chmod(temp_file.fileno(), test_mode) +if lldbplatformutil.getHostPlatform() == "windows": +test_mode = 0o700 +else: +os.chmod(temp_file.fileno(), test_mode) +temp_path = lldbutil.install_to_target(self, temp_path) self.do_handshake() self.test_sequence.add_log_lines( @@ -213,6 +220,7 @@ def test_platform_file_exists(self): temp_path = self.getBuildArtifact("test") with open(temp_path, "wb"): pass +temp_path = lldbutil.install_to_target(self, temp_path) self.do_handshake() self.test_sequence.add_log_lines( @@ -244,6 +252,10 @@ def test_platform_file_exists_not(self): self.expect_gdbremote_sequence() @skipIfWindows +# FIXME: lldb.remote_platform.Install() cannot copy opened temp file on Windows. +# It is possible to use tempfile.NamedTemporaryFile(..., delete=False) and +# delete the temp file manually at the end. +@skipIf(hostoslist=["windows"]) @add_test_categories(["llgs"]) def test_platform_file_fstat(self): server = self.connect_to_debug_monitor() @@ -252,12 +264,13 @@ def test_platform_file_fstat(self): with tempfile.NamedTemporaryFile() as temp_file: temp_file.write(b"some test data for stat") temp_file.flush() +temp_path = lldbutil.install_to_target(self, temp_file.name) self.do_handshake() self.test_sequence.add_log_lines( [ "read packet: $vFile:open:%s,0,0#00" -% (binascii.b2a_hex(temp_file.name.encode()).decode(),), +% (binascii.b2a_hex(temp_path.encode()).decode(),), { "direction": "send", "regex": r"^\$F([0-9a-fA-F]+)#[0-9a-fA-F]{2}$", @@ -359,9 +372,12 @@ def vFile_test( if creat: self.assertFalse(os.path.exists(temp_path)) +if lldb.remote_platform: +temp_path = lldbutil.append_to_process_working_directory(self, "test") else: with open(temp_path, "wb") as temp_file: temp_file.write(test_data.encode()) +temp_path = lldbutil.install_to_target(self, temp_path) # open the file for reading self.do_handshake() @@ -448,8 +464,19 @@ def vFile_test( if write: # check if the data was actually written +if lldb.remote_platform: +local_path = self.getBuildArtifact("file_from_target") +error = lldb.remote_platform.Get( +lldb.SBFileSpec(temp_path, False), lldb.SBFileSpec(local_path, True) +) +self.assertTrue( +error.Success(), +"Reading file {0} failed: {1}".format(temp_path, error), +) +temp_path = local_path + with open(temp_path, "rb") as temp_file: -if
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/91931 >From 361cd689e3900c5ab542a5158807eb532879677e Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 11:26:03 +0400 Subject: [PATCH] [lldb] Fixed the test TestGdbRemoteLaunch Install `a.out` to the remote target (after handshake) if necessary and use the remote path to call vRun. --- .../tools/lldb-server/TestGdbRemoteLaunch.py | 41 +-- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py index 78a4d326c12d1..ad84a40932c65 100644 --- a/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py +++ b/lldb/test/API/tools/lldb-server/TestGdbRemoteLaunch.py @@ -12,13 +12,13 @@ class GdbRemoteLaunchTestCase(gdbremote_testcase.GdbRemoteTestCaseBase): @add_test_categories(["llgs"]) def test_launch_via_A(self): self.build() -exe_path = self.getBuildArtifact("a.out") -args = [exe_path, "stderr:arg1", "stderr:arg2", "stderr:arg3"] -hex_args = [seven.hexlify(x) for x in args] - server = self.connect_to_debug_monitor() self.assertIsNotNone(server) self.do_handshake() +exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out")) +args = [exe_path, "stderr:arg1", "stderr:arg2", "stderr:arg3"] +hex_args = [seven.hexlify(x) for x in args] + # NB: strictly speaking we should use %x here but this packet # is deprecated, so no point in changing lldb-server's expectations self.test_sequence.add_log_lines( @@ -38,13 +38,13 @@ def test_launch_via_A(self): @add_test_categories(["llgs"]) def test_launch_via_vRun(self): self.build() -exe_path = self.getBuildArtifact("a.out") -args = [exe_path, "stderr:arg1", "stderr:arg2", "stderr:arg3"] -hex_args = [seven.hexlify(x) for x in args] - server = self.connect_to_debug_monitor() self.assertIsNotNone(server) self.do_handshake() +exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out")) +args = [exe_path, "stderr:arg1", "stderr:arg2", "stderr:arg3"] +hex_args = [seven.hexlify(x) for x in args] + self.test_sequence.add_log_lines( [ "read packet: $vRun;%s;%s;%s;%s#00" % tuple(hex_args), @@ -60,12 +60,12 @@ def test_launch_via_vRun(self): @add_test_categories(["llgs"]) def test_launch_via_vRun_no_args(self): self.build() -exe_path = self.getBuildArtifact("a.out") -hex_path = seven.hexlify(exe_path) - server = self.connect_to_debug_monitor() self.assertIsNotNone(server) self.do_handshake() +exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out")) +hex_path = seven.hexlify(exe_path) + self.test_sequence.add_log_lines( [ "read packet: $vRun;%s#00" % (hex_path,), @@ -78,6 +78,7 @@ def test_launch_via_vRun_no_args(self): self.expect_gdbremote_sequence() @add_test_categories(["llgs"]) +@skipIfRemote def test_launch_failure_via_vRun(self): self.build() exe_path = self.getBuildArtifact("a.out") @@ -110,14 +111,13 @@ def test_launch_failure_via_vRun(self): @add_test_categories(["llgs"]) def test_QEnvironment(self): self.build() -exe_path = self.getBuildArtifact("a.out") -env = {"FOO": "test", "BAR": "a=z"} -args = [exe_path, "print-env:FOO", "print-env:BAR"] -hex_args = [seven.hexlify(x) for x in args] - server = self.connect_to_debug_monitor() self.assertIsNotNone(server) self.do_handshake() +exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out")) +env = {"FOO": "test", "BAR": "a=z"} +args = [exe_path, "print-env:FOO", "print-env:BAR"] +hex_args = [seven.hexlify(x) for x in args] for key, value in env.items(): self.test_sequence.add_log_lines( @@ -143,14 +143,13 @@ def test_QEnvironment(self): @add_test_categories(["llgs"]) def test_QEnvironmentHexEncoded(self): self.build() -exe_path = self.getBuildArtifact("a.out") -env = {"FOO": "test", "BAR": "a=z", "BAZ": "a*}#z"} -args = [exe_path, "print-env:FOO", "print-env:BAR", "print-env:BAZ"] -hex_args = [seven.hexlify(x) for x in args] - server = self.connect_to_debug_monitor() self.assertIsNotNone(server) self.do_handshake() +exe_path = lldbutil.install_to_target(self, self.getBuildArtifact("a.out")) +env = {"FOO": "test", "BAR": "a=z", "BAZ": "a*}#z"} +args = [exe_path, "print-env:FOO", "print-env:BAR", "print-env:BAZ"] +hex_args = [seven.hexlify(x) for x in args] for key,
[Lldb-commits] [lldb] [lldb] Add lldbutil.install_to_target() helper (PR #91944)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/91944 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add lldbutil.install_to_target() helper (PR #91944)
https://github.com/slydiman edited https://github.com/llvm/llvm-project/pull/91944 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Enforce exec permission using Platform::Install() from Windows host (PR #91887)
slydiman wrote: @labath, Sorry for not being clear with my comment. Let me re-phrase. I think unconditionally setting the executable flag for everything installed by Platform::Install by default for all platforms is overkill. BTW, there is no API to change this behavior, so `by default` means always. Implementation details aside. Test files have the correct permissions set if the host allows it. Platform::Install copies the host file permissions to the target. This seems a correct behavior except for the case when the host has a smaller set of permissions than the target, or permission sets on the host and the target do not match significantly. I'm aware of the only such case: Windows host and POSIX target. Do you know more? https://github.com/llvm/llvm-project/pull/91887 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)
@@ -1654,6 +1654,26 @@ def find_library_callable(test): ) +def target_install(test, filename=None, path=None): +test.assertTrue(filename or path, "filename or path must be specified.") +if filename is None: +filename = os.path.basename(path) +if path is None: +path = test.getBuildArtifact(filename) slydiman wrote: Ok. I kept only the full path parameter. Updated. Thanks. https://github.com/llvm/llvm-project/pull/91944 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/91944 >From de7135a8a4a40b5aa5ac1f44e58d62874c96448b Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 14:45:33 +0400 Subject: [PATCH 1/4] [lldb] Add lldbutil.target_install() helper It can be used in tests #91918, #91931 and such. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 16 1 file changed, 16 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 58eb37fd742d7..e67b68b727b80 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,6 +1654,22 @@ def find_library_callable(test): ) +def target_install(test, filename): +path = test.getBuildArtifact(filename) +if lldb.remote_platform: +remote_path = lldbutil.append_to_process_working_directory(test, filename) +err = lldb.remote_platform.Install( +lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) +) +if err.Fail(): +raise Exception( +"remote_platform.Install('%s', '%s') failed: %s" +% (path, remote_path, err) +) +path = remote_path +return path + + def read_file_on_target(test, remote): if lldb.remote_platform: local = test.getBuildArtifact("file_from_target") >From b4f5798258b29996b6805037bed70a819a671618 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 15:51:36 +0400 Subject: [PATCH 2/4] Added the full local path as optional parameter. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index e67b68b727b80..4290fe94590a1 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,10 +1654,14 @@ def find_library_callable(test): ) -def target_install(test, filename): -path = test.getBuildArtifact(filename) +def target_install(test, filename=None, path=None): +test.assertTrue(filename or path, "filename or path must be specified.") +if filename is None: +filename = os.path.basename(path) +if path is None: +path = test.getBuildArtifact(filename) if lldb.remote_platform: -remote_path = lldbutil.append_to_process_working_directory(test, filename) +remote_path = append_to_process_working_directory(test, filename) err = lldb.remote_platform.Install( lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) ) >From 79831a4c0e276caf4952b4d5748d5d7ba9e59365 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 20:02:41 +0400 Subject: [PATCH 3/4] Renamed to `install_to_target`. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 4290fe94590a1..e1aa8d63b9b72 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,7 +1654,7 @@ def find_library_callable(test): ) -def target_install(test, filename=None, path=None): +def install_to_target(test, filename=None, path=None): test.assertTrue(filename or path, "filename or path must be specified.") if filename is None: filename = os.path.basename(path) >From eb1d82b19891b0369aa80cc6202b4c7e5c2e66c3 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 20:23:57 +0400 Subject: [PATCH 4/4] Simplified. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index e1aa8d63b9b72..1ec036f885e7e 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,13 +1654,9 @@ def find_library_callable(test): ) -def install_to_target(test, filename=None, path=None): -test.assertTrue(filename or path, "filename or path must be specified.") -if filename is None: -filename = os.path.basename(path) -if path is None: -path = test.getBuildArtifact(filename) +def install_to_target(test, path): if lldb.remote_platform: +filename = os.path.basename(path) remote_path = append_to_process_working_directory(test, filename) err = lldb.remote_platform.Install( lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) ___ lldb-commits mailing list lldb-commits@lists.llvm.org
[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)
https://github.com/slydiman edited https://github.com/llvm/llvm-project/pull/91944 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)
@@ -1654,6 +1654,26 @@ def find_library_callable(test): ) +def target_install(test, filename=None, path=None): slydiman wrote: Updated. Thanks. https://github.com/llvm/llvm-project/pull/91944 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/91944 >From de7135a8a4a40b5aa5ac1f44e58d62874c96448b Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 14:45:33 +0400 Subject: [PATCH 1/3] [lldb] Add lldbutil.target_install() helper It can be used in tests #91918, #91931 and such. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 16 1 file changed, 16 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 58eb37fd742d7..e67b68b727b80 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,6 +1654,22 @@ def find_library_callable(test): ) +def target_install(test, filename): +path = test.getBuildArtifact(filename) +if lldb.remote_platform: +remote_path = lldbutil.append_to_process_working_directory(test, filename) +err = lldb.remote_platform.Install( +lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) +) +if err.Fail(): +raise Exception( +"remote_platform.Install('%s', '%s') failed: %s" +% (path, remote_path, err) +) +path = remote_path +return path + + def read_file_on_target(test, remote): if lldb.remote_platform: local = test.getBuildArtifact("file_from_target") >From b4f5798258b29996b6805037bed70a819a671618 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 15:51:36 +0400 Subject: [PATCH 2/3] Added the full local path as optional parameter. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index e67b68b727b80..4290fe94590a1 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,10 +1654,14 @@ def find_library_callable(test): ) -def target_install(test, filename): -path = test.getBuildArtifact(filename) +def target_install(test, filename=None, path=None): +test.assertTrue(filename or path, "filename or path must be specified.") +if filename is None: +filename = os.path.basename(path) +if path is None: +path = test.getBuildArtifact(filename) if lldb.remote_platform: -remote_path = lldbutil.append_to_process_working_directory(test, filename) +remote_path = append_to_process_working_directory(test, filename) err = lldb.remote_platform.Install( lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) ) >From 79831a4c0e276caf4952b4d5748d5d7ba9e59365 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 20:02:41 +0400 Subject: [PATCH 3/3] Renamed to `install_to_target`. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 4290fe94590a1..e1aa8d63b9b72 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,7 +1654,7 @@ def find_library_callable(test): ) -def target_install(test, filename=None, path=None): +def install_to_target(test, filename=None, path=None): test.assertTrue(filename or path, "filename or path must be specified.") if filename is None: filename = os.path.basename(path) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)
@@ -1654,6 +1654,26 @@ def find_library_callable(test): ) +def target_install(test, filename=None, path=None): +test.assertTrue(filename or path, "filename or path must be specified.") +if filename is None: +filename = os.path.basename(path) +if path is None: +path = test.getBuildArtifact(filename) slydiman wrote: I expected the following usage: 1: Use filename ``` target_path = lldbutil.install_to_target(self, "a.out") ``` 2: Use path ``` local_path = self.getBuildArtifact("some_file") # write to local_path here ... # avoid typing "some_file" constant twice, just extract the filename from the local_path target_path = lldbutil.install_to_target(self, path=local_path) ``` 3: Use both ``` # "temp" is the filename on the remote target target_path = lldbutil.install_to_target(self, "temp", local_temp_path_outside_build_dir) ``` https://github.com/llvm/llvm-project/pull/91944 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestPlatformProcessLaunch running on a remote target (PR #91923)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/91923 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Disable macOS specific test for Windows host instead of Windows target (PR #91942)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/91942 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Disable macOS specific test for Windows host instead of Windows target (PR #91942)
slydiman wrote: Agreed. It seems the real problem is that `ar` is missing on the Windows host. We will try to use cross `llvm-ar` instead. I will close this MR. Thanks. https://github.com/llvm/llvm-project/pull/91942 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Windows] Enforce exec permission using Platform::Install() from Windows host (PR #91887)
slydiman wrote: Target::Install() and Platform::Install() are used indirectly in many cases. For example look at the test `lldb/test/API/python_api/hello_world/TestHelloWorld.py`. target.LaunchSimple() uses Target::Install() and there is no problem with the exec permission. spawnSubprocess() uses the class _RemoteProcess and finally Platform::Install(). spawnSubprocess() is used in 27 test files and they are failed is case of Windows host and Linux target. > Target::Install does (i.e., set the execute flag unconditionally) Target::Install() checks is_main_executable enumerating all modules. But Target::Install()'s logic is not applicable in most cases where Platform::Install() is used. I think `Target::Install` is not a workaround and we cannot remove this code. I'd say this patch is a workaround for the case host=Windows and target!=Windows. We can even add a comment FIXME:... if someone will have an idea how to fix it better way. https://github.com/llvm/llvm-project/pull/91887 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestQuoting (PR #91886)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/91886 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestSettings when run with a remote target (PR #91915)
https://github.com/slydiman closed https://github.com/llvm/llvm-project/pull/91915 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/91944 >From de7135a8a4a40b5aa5ac1f44e58d62874c96448b Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 14:45:33 +0400 Subject: [PATCH 1/2] [lldb] Add lldbutil.target_install() helper It can be used in tests #91918, #91931 and such. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 16 1 file changed, 16 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 58eb37fd742d7..e67b68b727b80 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,6 +1654,22 @@ def find_library_callable(test): ) +def target_install(test, filename): +path = test.getBuildArtifact(filename) +if lldb.remote_platform: +remote_path = lldbutil.append_to_process_working_directory(test, filename) +err = lldb.remote_platform.Install( +lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) +) +if err.Fail(): +raise Exception( +"remote_platform.Install('%s', '%s') failed: %s" +% (path, remote_path, err) +) +path = remote_path +return path + + def read_file_on_target(test, remote): if lldb.remote_platform: local = test.getBuildArtifact("file_from_target") >From b4f5798258b29996b6805037bed70a819a671618 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 15:51:36 +0400 Subject: [PATCH 2/2] Added the full local path as optional parameter. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index e67b68b727b80..4290fe94590a1 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,10 +1654,14 @@ def find_library_callable(test): ) -def target_install(test, filename): -path = test.getBuildArtifact(filename) +def target_install(test, filename=None, path=None): +test.assertTrue(filename or path, "filename or path must be specified.") +if filename is None: +filename = os.path.basename(path) +if path is None: +path = test.getBuildArtifact(filename) if lldb.remote_platform: -remote_path = lldbutil.append_to_process_working_directory(test, filename) +remote_path = append_to_process_working_directory(test, filename) err = lldb.remote_platform.Install( lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) ) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fixed the test TestGdbRemoteLaunch (PR #91931)
slydiman wrote: @DavidSpickett Please look at #91944. https://github.com/llvm/llvm-project/pull/91931 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix the test TestGdbRemotePlatformFile (PR #91918)
@@ -108,6 +109,20 @@ def test_platform_file_wronly_fail(self): ) self.expect_gdbremote_sequence() +def remote_install(self, path, filename="test"): +if lldb.remote_platform: +remote_path = lldbutil.append_to_process_working_directory(self, filename) +err = lldb.remote_platform.Install( +lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) +) +if err.Fail(): +raise Exception( +"remote_platform.Install('%s', '%s') failed: %s" +% (path, remote_path, err) +) +path = remote_path +return path slydiman wrote: Sure. Please look at #91944. https://github.com/llvm/llvm-project/pull/91918 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add lldbutil.target_install() helper (PR #91944)
https://github.com/slydiman created https://github.com/llvm/llvm-project/pull/91944 It can be used in tests #91918, #91931 and such. >From de7135a8a4a40b5aa5ac1f44e58d62874c96448b Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 13 May 2024 14:45:33 +0400 Subject: [PATCH] [lldb] Add lldbutil.target_install() helper It can be used in tests #91918, #91931 and such. --- lldb/packages/Python/lldbsuite/test/lldbutil.py | 16 1 file changed, 16 insertions(+) diff --git a/lldb/packages/Python/lldbsuite/test/lldbutil.py b/lldb/packages/Python/lldbsuite/test/lldbutil.py index 58eb37fd742d7..e67b68b727b80 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbutil.py +++ b/lldb/packages/Python/lldbsuite/test/lldbutil.py @@ -1654,6 +1654,22 @@ def find_library_callable(test): ) +def target_install(test, filename): +path = test.getBuildArtifact(filename) +if lldb.remote_platform: +remote_path = lldbutil.append_to_process_working_directory(test, filename) +err = lldb.remote_platform.Install( +lldb.SBFileSpec(path, True), lldb.SBFileSpec(remote_path, False) +) +if err.Fail(): +raise Exception( +"remote_platform.Install('%s', '%s') failed: %s" +% (path, remote_path, err) +) +path = remote_path +return path + + def read_file_on_target(test, remote): if lldb.remote_platform: local = test.getBuildArtifact("file_from_target") ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits