This revision was automatically updated to reflect the committed changes.
Closed by commit rG251165b2e482: [lldb] [test] Use raise(SIGSTOP) instead of 
trap in fork tests (authored by mgorny).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D128780?vs=440852&id=440989#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128780/new/

https://reviews.llvm.org/D128780

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
  lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
  lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
  lldb/test/API/tools/lldb-server/main.cpp

Index: lldb/test/API/tools/lldb-server/main.cpp
===================================================================
--- lldb/test/API/tools/lldb-server/main.cpp
+++ lldb/test/API/tools/lldb-server/main.cpp
@@ -353,6 +353,10 @@
       printf("%s\n", value ? value : "__unset__");
     } else if (consume_front(arg, "trap")) {
       trap();
+#if !defined(_WIN32)
+    } else if (arg == "stop") {
+      raise(SIGSTOP);
+#endif
     } else {
       // Treat the argument as text for stdout.
       printf("%s\n", argv[i]);
Index: lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemoteForkNonStop.py
@@ -99,16 +99,12 @@
         self.vkill_test(kill_parent=True, kill_child=True, nonstop=True)
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_c_interspersed_nonstop(self):
         self.resume_one_test(run_order=["parent", "child", "parent", "child"],
                              nonstop=True)
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_vCont_interspersed_nonstop(self):
         self.resume_one_test(run_order=["parent", "child", "parent", "child"],
Index: lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
===================================================================
--- lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
+++ lldb/test/API/tools/lldb-server/TestGdbRemoteFork.py
@@ -154,73 +154,53 @@
         self.vkill_test(kill_parent=True, kill_child=True)
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_c_parent(self):
         self.resume_one_test(run_order=["parent", "parent"])
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_c_child(self):
         self.resume_one_test(run_order=["child", "child"])
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_c_parent_then_child(self):
         self.resume_one_test(run_order=["parent", "parent", "child", "child"])
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_c_child_then_parent(self):
         self.resume_one_test(run_order=["child", "child", "parent", "parent"])
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_c_interspersed(self):
         self.resume_one_test(run_order=["parent", "child", "parent", "child"])
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_vCont_parent(self):
         self.resume_one_test(run_order=["parent", "parent"], use_vCont=True)
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_vCont_child(self):
         self.resume_one_test(run_order=["child", "child"], use_vCont=True)
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_vCont_parent_then_child(self):
         self.resume_one_test(run_order=["parent", "parent", "child", "child"],
                              use_vCont=True)
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_vCont_child_then_parent(self):
         self.resume_one_test(run_order=["child", "child", "parent", "parent"],
                              use_vCont=True)
 
     @expectedFailureAll(archs=["arm"])  # TODO
-    @expectedFailureAll(archs=["aarch64"],
-                        bugnumber="https://github.com/llvm/llvm-project/issues/56268";)
     @add_test_categories(["fork"])
     def test_vCont_interspersed(self):
         self.resume_one_test(run_order=["parent", "child", "parent", "child"],
@@ -229,7 +209,7 @@
     @add_test_categories(["fork"])
     def test_vCont_two_processes(self):
         parent_pid, parent_tid, child_pid, child_tid = (
-            self.start_fork_test(["fork", "trap"]))
+            self.start_fork_test(["fork", "stop"]))
 
         self.test_sequence.add_log_lines([
             # try to resume both processes
@@ -241,7 +221,7 @@
 
     @add_test_categories(["fork"])
     def test_vCont_all_processes_explicit(self):
-        self.start_fork_test(["fork", "trap"])
+        self.start_fork_test(["fork", "stop"])
 
         self.test_sequence.add_log_lines([
             # try to resume all processes implicitly
@@ -252,7 +232,7 @@
 
     @add_test_categories(["fork"])
     def test_vCont_all_processes_implicit(self):
-        self.start_fork_test(["fork", "trap"])
+        self.start_fork_test(["fork", "stop"])
 
         self.test_sequence.add_log_lines([
             # try to resume all processes implicitly
@@ -265,7 +245,7 @@
     @add_test_categories(["fork"])
     def test_threadinfo(self):
         parent_pid, parent_tid, child_pid, child_tid = (
-            self.start_fork_test(["fork", "thread:new", "trap"]))
+            self.start_fork_test(["fork", "thread:new", "stop"]))
         pidtids = [
             (parent_pid, parent_tid),
             (child_pid, child_tid),
@@ -285,7 +265,7 @@
                  "send packet: $OK#00",
                  "read packet: $c#00",
                  {"direction": "send",
-                  "regex": "^[$]T05thread:p{}.{}.*".format(*pidtid),
+                  "regex": self.stop_regex.format(*pidtid),
                   },
                  ], True)
             self.add_threadinfo_collection_packets()
@@ -317,7 +297,7 @@
                            "get-data-address-hex:g_message",
                            "fork",
                            "print-message:",
-                           "trap",
+                           "stop",
                            ])
         self.add_qSupported_packets(["multiprocess+",
                                      "fork-events+"])
@@ -366,7 +346,7 @@
                   "regex": self.maybe_strict_output_regex(r"message: (.*)\r\n"),
                   "capture": {1: "printed_message"}},
                  {"direction": "send",
-                  "regex": "^[$]T05thread:p{}.{}.*".format(*pidtid),
+                  "regex": self.stop_regex.format(*pidtid),
                   },
                  ], True)
             ret = self.expect_gdbremote_sequence()
@@ -399,7 +379,7 @@
     @add_test_categories(["fork"])
     def test_register_read_write(self):
         parent_pid, parent_tid, child_pid, child_tid = (
-            self.start_fork_test(["fork", "thread:new", "trap"]))
+            self.start_fork_test(["fork", "thread:new", "stop"]))
         pidtids = [
             (parent_pid, parent_tid),
             (child_pid, child_tid),
@@ -411,7 +391,7 @@
                  "send packet: $OK#00",
                  "read packet: $c#00",
                  {"direction": "send",
-                  "regex": "^[$]T05thread:p{}.{}.*".format(*pidtid),
+                  "regex": self.stop_regex.format(*pidtid),
                   },
                  ], True)
 
@@ -496,7 +476,7 @@
     @add_test_categories(["fork"])
     def test_qC(self):
         parent_pid, parent_tid, child_pid, child_tid = (
-            self.start_fork_test(["fork", "thread:new", "trap"]))
+            self.start_fork_test(["fork", "thread:new", "stop"]))
         pidtids = [
             (parent_pid, parent_tid),
             (child_pid, child_tid),
@@ -508,7 +488,7 @@
                  "send packet: $OK#00",
                  "read packet: $c#00",
                  {"direction": "send",
-                  "regex": "^[$]T05thread:p{}.{}.*".format(*pidtid),
+                  "regex": self.stop_regex.format(*pidtid),
                   },
                  ], True)
 
@@ -531,7 +511,7 @@
     @add_test_categories(["fork"])
     def test_T(self):
         parent_pid, parent_tid, child_pid, child_tid = (
-            self.start_fork_test(["fork", "thread:new", "trap"]))
+            self.start_fork_test(["fork", "thread:new", "stop"]))
         pidtids = [
             (parent_pid, parent_tid),
             (child_pid, child_tid),
@@ -543,7 +523,7 @@
                  "send packet: $OK#00",
                  "read packet: $c#00",
                  {"direction": "send",
-                  "regex": "^[$]T05thread:p{}.{}.*".format(*pidtid),
+                  "regex": self.stop_regex.format(*pidtid),
                   },
                  ], True)
 
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
===================================================================
--- lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-server/fork_testbase.py
@@ -8,6 +8,8 @@
                           "{}:p([0-9a-f]+)[.]([0-9a-f]+).*")
     fork_capture = {1: "parent_pid", 2: "parent_tid",
                     3: "child_pid", 4: "child_tid"}
+    stop_regex_base = "T[0-9a-fA-F]{{2}}thread:p{}.{};.*reason:signal.*"
+    stop_regex = "^[$]" + stop_regex_base
 
     def start_fork_test(self, args, variant="fork", nonstop=False):
         self.build()
@@ -149,14 +151,14 @@
 
     def resume_one_test(self, run_order, use_vCont=False, nonstop=False):
         parent_pid, parent_tid, child_pid, child_tid = (
-            self.start_fork_test(["fork", "trap"], nonstop=nonstop))
+            self.start_fork_test(["fork", "stop"], nonstop=nonstop))
 
         parent_expect = [
-            "T05thread:p{}.{};.*".format(parent_pid, parent_tid),
+            self.stop_regex_base.format(parent_pid, parent_tid),
             "W00;process:{}#.*".format(parent_pid),
         ]
         child_expect = [
-            "T05thread:p{}.{};.*".format(child_pid, child_tid),
+            self.stop_regex_base.format(child_pid, child_tid),
             "W00;process:{}#.*".format(child_pid),
         ]
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to