yuvald-sweet-security wrote: > I'm just thinking about whether there's a way to test this. You've said that > there's a test for the scenario where lldb-server and lldb are not in the > same directory. Which one is it? Would it be possible to use a similar > approach to test this scenario as well?
I think all the tests for LLDB Python API indirectly test this code, when I tried my initial approach (always relying on `GetProgramFileSpec` for locating the directory of lldb-server), many tests failed due to not finding lldb-server, e.g.: ``` _bk;t=1742219200805 ******************** TEST 'lldb-api :: commands/disassemble/basic/TestDisassembleBreakpoint.py' FAILED ******************** _bk;t=1742219200805 Script: _bk;t=1742219200805 -- _bk;t=1742219200805 /usr/bin/python3.10 /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/./lib --env LLVM_INCLUDE_DIR=/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/include --env LLVM_TOOLS_DIR=/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/./bin --arch x86_64 --build-dir /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/lldb-test-build.noindex --lldb-module-cache-dir /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/./bin/lldb --compiler /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/./bin/clang --dsymutil /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/./bin --lldb-obj-root /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/tools/lldb --lldb-libs-dir /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/./lib /var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/lldb/test/API/commands/disassemble/basic -p TestDisassembleBreakpoint.py _bk;t=1742219200806 -- _bk;t=1742219200806 Exit Code: 1 _bk;t=1742219200806 _bk;t=1742219200806 Command Output (stdout): _bk;t=1742219200806 -- _bk;t=1742219200806 lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision f47298e0f29a2a73d656ba5270557ca139688499) _bk;t=1742219200806 clang revision f47298e0f29a2a73d656ba5270557ca139688499 _bk;t=1742219200806 llvm revision f47298e0f29a2a73d656ba5270557ca139688499 _bk;t=1742219200806 Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc'] _bk;t=1742219200806 _bk;t=1742219200806 -- _bk;t=1742219200806 Command Output (stderr): _bk;t=1742219200806 -- _bk;t=1742219200806 FAIL: LLDB (/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/bin/clang-x86_64) :: test (TestDisassembleBreakpoint.DisassemblyTestCase) _bk;t=1742219200806 ====================================================================== _bk;t=1742219200806 FAIL: test (TestDisassembleBreakpoint.DisassemblyTestCase) _bk;t=1742219200806 ---------------------------------------------------------------------- _bk;t=1742219200806 Traceback (most recent call last): _bk;t=1742219200806 File "/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/lldb/test/API/commands/disassemble/basic/TestDisassembleBreakpoint.py", line 17, in test _bk;t=1742219200806 target, _, _, bkpt = lldbutil.run_to_source_breakpoint( _bk;t=1742219200806 File "/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/lldb/packages/Python/lldbsuite/test/lldbutil.py", line 1016, in run_to_source_breakpoint _bk;t=1742219200806 return run_to_breakpoint_do_run( _bk;t=1742219200806 File "/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/lldb/packages/Python/lldbsuite/test/lldbutil.py", line 896, in run_to_breakpoint_do_run _bk;t=1742219200806 test.assertFalse(error.Fail(), "Process launch failed: %s" % (error.GetCString())) _bk;t=1742219200806 AssertionError: True is not false : Process launch failed: unable to locate lldb-server _bk;t=1742219200806 Config=x86_64-/var/lib/buildkite-agent/builds/linux-56-59b8f5d88-bt7k7-1/llvm-project/github-pull-requests/build/bin/clang _bk;t=1742219200806 ---------------------------------------------------------------------- _bk;t=1742219200806 Ran 1 test in 0.224s _bk;t=1742219200806 _bk;t=1742219200806 FAILED (failures=1) _bk;t=1742219200806 ``` I'm assuming this is because the python executable used to execute the test code is not in the same directory with lldb-server. But I'm not sure if this helps our cause if what you mean is that you want a test that tests the exact scenario in the description, i.e. running lldb-server from a symlink and seeing that it correctly finds itself as a gdb-server https://github.com/llvm/llvm-project/pull/131609 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits