summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
committerpatrick <patrick@openbsd.org>2020-08-03 14:33:06 +0000
commit061da546b983eb767bad15e67af1174fb0bcf31c (patch)
tree83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps
parentImport LLVM 10.0.0 release including clang, lld and lldb. (diff)
downloadwireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz
wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/Makefile10
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/TestTargetCreateDeps.py113
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/a.cpp12
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/main.cpp16
4 files changed, 151 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/Makefile
new file mode 100644
index 00000000000..3e5b1049b5a
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/Makefile
@@ -0,0 +1,10 @@
+LD_EXTRAS := -L. -lload_a
+CXX_SOURCES := main.cpp
+
+a.out: libload_a
+
+include Makefile.rules
+
+libload_a:
+ $(MAKE) -f $(MAKEFILE_RULES) \
+ DYLIB_ONLY=YES DYLIB_NAME=load_a DYLIB_CXX_SOURCES=a.cpp
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/TestTargetCreateDeps.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/TestTargetCreateDeps.py
new file mode 100644
index 00000000000..31be1cc86fa
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/TestTargetCreateDeps.py
@@ -0,0 +1,113 @@
+"""
+Test that loading of dependents works correctly for all the potential
+combinations.
+"""
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+@skipIfWindows # Windows deals differently with shared libs.
+class TargetDependentsTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def setUp(self):
+ TestBase.setUp(self)
+ self.build()
+
+ def has_exactly_one_image(self, matching, msg=""):
+ self.expect(
+ "image list",
+ "image list should contain at least one image",
+ substrs=['[ 0]'])
+ should_match = not matching
+ self.expect(
+ "image list", msg, matching=should_match, substrs=['[ 1]'])
+
+
+ @expectedFailureAll(oslist=["linux"],
+ triple=no_match(".*-android"))
+ #linux does not support loading dependent files, but android does
+ @expectedFailureNetBSD
+ def test_dependents_implicit_default_exe(self):
+ """Test default behavior"""
+ exe = self.getBuildArtifact("a.out")
+ self.runCmd("target create " + exe, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(False)
+
+ @expectedFailureAll(oslist=["linux"],
+ triple=no_match(".*-android"))
+ #linux does not support loading dependent files, but android does
+ @expectedFailureNetBSD
+ def test_dependents_explicit_default_exe(self):
+ """Test default behavior"""
+ exe = self.getBuildArtifact("a.out")
+ self.runCmd("target create -ddefault " + exe, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(False)
+
+ def test_dependents_explicit_true_exe(self):
+ """Test default behavior"""
+ exe = self.getBuildArtifact("a.out")
+ self.runCmd("target create -dtrue " + exe, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(True)
+
+ @expectedFailureAll(oslist=["linux"],
+ triple=no_match(".*-android"))
+ #linux does not support loading dependent files, but android does
+ @expectedFailureNetBSD
+ def test_dependents_explicit_false_exe(self):
+ """Test default behavior"""
+ exe = self.getBuildArtifact("a.out")
+ self.runCmd("target create -dfalse " + exe, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(False)
+
+ def test_dependents_implicit_false_exe(self):
+ """Test default behavior"""
+ exe = self.getBuildArtifact("a.out")
+ self.runCmd("target create -d " + exe, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(True)
+
+ @expectedFailureAndroid # android will return mutiple images
+ def test_dependents_implicit_default_lib(self):
+ ctx = self.platformContext
+ dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension
+ lib = self.getBuildArtifact(dylibName)
+ self.runCmd("target create " + lib, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(True)
+
+ def test_dependents_explicit_default_lib(self):
+ ctx = self.platformContext
+ dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension
+ lib = self.getBuildArtifact(dylibName)
+ self.runCmd("target create -ddefault " + lib, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(True)
+
+ def test_dependents_explicit_true_lib(self):
+ ctx = self.platformContext
+ dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension
+ lib = self.getBuildArtifact(dylibName)
+ self.runCmd("target create -dtrue " + lib, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(True)
+
+ @expectedFailureAll(oslist=["linux"],
+ triple=no_match(".*-android"))
+ #linux does not support loading dependent files, but android does
+ @expectedFailureNetBSD
+ def test_dependents_explicit_false_lib(self):
+ ctx = self.platformContext
+ dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension
+ lib = self.getBuildArtifact(dylibName)
+ self.runCmd("target create -dfalse " + lib, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(False)
+
+ def test_dependents_implicit_false_lib(self):
+ ctx = self.platformContext
+ dylibName = ctx.shlib_prefix + 'load_a.' + ctx.shlib_extension
+ lib = self.getBuildArtifact(dylibName)
+ self.runCmd("target create -d " + lib, CURRENT_EXECUTABLE_SET)
+ self.has_exactly_one_image(True)
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/a.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/a.cpp
new file mode 100644
index 00000000000..e80612bd5cc
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/a.cpp
@@ -0,0 +1,12 @@
+//===-- b.c -----------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+int a_function ()
+{
+ return 500;
+}
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/main.cpp
new file mode 100644
index 00000000000..7ee1981a4c2
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-deps/main.cpp
@@ -0,0 +1,16 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+extern int a_function ();
+extern int b_function ();
+
+int
+main (int argc, char const *argv[])
+{
+ return a_function();
+}