Author: Pavel Labath Date: 2021-04-01T14:20:20+02:00 New Revision: 48e3da13519dea3bd91ab7de656c7d46105c2c01
URL: https://github.com/llvm/llvm-project/commit/48e3da13519dea3bd91ab7de656c7d46105c2c01 DIFF: https://github.com/llvm/llvm-project/commit/48e3da13519dea3bd91ab7de656c7d46105c2c01.diff LOG: [lldb] Rewrite TestAutoInstallMainExecutable logic The test uses debug info from one binary to debug a different one. This does not work on macos, and its pure luck that it works elsewhere (the variable that it inspects happens to have the same address in both). The purpose of this test is to verify that lldb has not overwritten the target executable. That can be more easily achieved by checking the exit code of the binary, so change the test to do that. Also remove the llgs_test decorator, as it's preventing the test from running on macos. All the test needs is the platform functionality of lldb-server, which is available everywhere. Added: Modified: lldb/test/API/commands/target/auto-install-main-executable/Makefile lldb/test/API/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py lldb/test/API/commands/target/auto-install-main-executable/main.cpp Removed: ################################################################################ diff --git a/lldb/test/API/commands/target/auto-install-main-executable/Makefile b/lldb/test/API/commands/target/auto-install-main-executable/Makefile index 1354ec49464a8..07e6c9a1d0f15 100644 --- a/lldb/test/API/commands/target/auto-install-main-executable/Makefile +++ b/lldb/test/API/commands/target/auto-install-main-executable/Makefile @@ -1,9 +1,9 @@ CXX_SOURCES := main.cpp -CXXFLAGS := -DBUILD=\"stock\" +CXXFLAGS := -DBUILD=47 a.out: a.device.out include Makefile.rules a.device.out: - $(CXX) $(CXXFLAGS) -DBUILD=\"device\" -o $@ $(SRCDIR)/main.cpp + $(CXX) $(CXXFLAGS) -DBUILD=74 -o $@ $(SRCDIR)/main.cpp diff --git a/lldb/test/API/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py b/lldb/test/API/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py index 862943c41aa37..410e1f108c16a 100644 --- a/lldb/test/API/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py +++ b/lldb/test/API/commands/target/auto-install-main-executable/TestAutoInstallMainExecutable.py @@ -15,10 +15,11 @@ class TestAutoInstallMainExecutable(TestBase): mydir = TestBase.compute_mydir(__file__) NO_DEBUG_INFO_TESTCASE = True - @llgs_test @skipIfRemote @expectedFailureAll(oslist=["windows"]) # process modules not loaded def test_target_auto_install_main_executable(self): + if lldbgdbserverutils.get_lldb_server_exe() is None: + self.skipTest("lldb-server not found") self.build() hostname = socket.getaddrinfo("localhost", 0, proto=socket.IPPROTO_TCP)[0][4][0] @@ -69,23 +70,4 @@ def test_target_auto_install_main_executable(self): (dest.fullpath, self.getBuildArtifact("a.out"))) - target = self.dbg.GetSelectedTarget() - breakpoint = target.BreakpointCreateByName("main") - - launch_info = target.GetLaunchInfo() - error = lldb.SBError() - process = target.Launch(launch_info, error) - self.assertTrue(process, PROCESS_IS_VALID) - - thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint) - self.assertTrue( - thread.IsValid(), - "There should be a thread stopped due to breakpoint") - - frame = thread.GetFrameAtIndex(0) - self.assertEqual(frame.GetFunction().GetName(), "main") - - self.expect("target variable build", substrs=['"device"'], - msg="Magic in the binary is wrong") - - process.Continue() + self.expect("process launch", substrs=["exited with status = 74"]) diff --git a/lldb/test/API/commands/target/auto-install-main-executable/main.cpp b/lldb/test/API/commands/target/auto-install-main-executable/main.cpp index 373f1a724e288..f9fb9978a208e 100644 --- a/lldb/test/API/commands/target/auto-install-main-executable/main.cpp +++ b/lldb/test/API/commands/target/auto-install-main-executable/main.cpp @@ -1,8 +1,5 @@ -#include <cstdio> +int build = BUILD; -const char* build = BUILD; - -int main(int argc, char **argv) { - printf("argc: %d\n", argc); - return argv[0][0]; +int main() { + return BUILD; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits