[Lldb-commits] [lldb] [lldb-dap][test] Set disableASLR to False for tests (PR #113593)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 25 03:34:36 PDT 2024


https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/113593

>From 135092caf94e69c0aac25bcb73190ea69776d60e Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Thu, 24 Oct 2024 17:50:02 +0100
Subject: [PATCH 1/2] [lldb-dap][test] Set disableASLR to False for tests

When running in constrained environments like docker,
disable ASLR might fail with errors like:
```
AssertionError: False is not true : launch failed (Cannot launch
'/__w/.../lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.test_subtleFrames/a.out':
personality set failed: Operation not permitted)
```
E.g., https://github.com/llvm/llvm-project/pull/110303

Hence we already run `settings set target.disable-aslr false`
as part of the init-commands for the non-DAP tests (see
https://github.com/llvm/llvm-project/pull/88312 and
https://discourse.llvm.org/t/running-lldb-in-a-container/76801).

But we never adjusted it for the DAP tests. Hence we get conflicting
test houtput like:
```
 {
    "arguments": {
      "commandEscapePrefix": null,
      "disableASLR": true,
     ....
      "initCommands": [
        ...
        "settings set target.disable-aslr false",
```

Disabling ASLR by default in tests isn't useulf (it's only really
a debugging aid for users). So this patch sets `disableASLR=False`
by default.
---
 .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 7e80912be44642..cf30aad6b7f35b 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -367,7 +367,7 @@ def launch(
         cwd=None,
         env=None,
         stopOnEntry=False,
-        disableASLR=True,
+        disableASLR=False,
         disableSTDIO=False,
         shellExpandArguments=False,
         trace=False,

>From 4a5ac981186af407aa79483bd95d86542ad11172 Mon Sep 17 00:00:00 2001
From: Michael Buch <michaelbuch12 at gmail.com>
Date: Fri, 25 Oct 2024 11:34:25 +0100
Subject: [PATCH 2/2] fixup! also set disableASLR=False in build_and_launch
 method

---
 .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index cf30aad6b7f35b..a25466f07fa557 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -451,7 +451,7 @@ def build_and_launch(
         cwd=None,
         env=None,
         stopOnEntry=False,
-        disableASLR=True,
+        disableASLR=False,
         disableSTDIO=False,
         shellExpandArguments=False,
         trace=False,



More information about the lldb-commits mailing list