summaryrefslogtreecommitdiffstats
path: root/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch
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-no-such-arch
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-no-such-arch')
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/Makefile3
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/TestNoSuchArch.py33
-rw-r--r--gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/main.cpp3
3 files changed, 39 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/Makefile
new file mode 100644
index 00000000000..99998b20bcb
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/TestNoSuchArch.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/TestNoSuchArch.py
new file mode 100644
index 00000000000..622a813ed41
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/TestNoSuchArch.py
@@ -0,0 +1,33 @@
+"""
+Test that using a non-existent architecture name does not crash LLDB.
+"""
+
+
+import lldb
+from lldbsuite.test.lldbtest import *
+import lldbsuite.test.lldbutil as lldbutil
+
+
+class NoSuchArchTestCase(TestBase):
+
+ mydir = TestBase.compute_mydir(__file__)
+ NO_DEBUG_INFO_TESTCASE = True
+
+ def test(self):
+ self.build()
+ exe = self.getBuildArtifact("a.out")
+
+ # Check that passing an invalid arch via the command-line fails but
+ # doesn't crash
+ self.expect(
+ "target create --arch nothingtoseehere %s" %
+ (exe), error=True, substrs=["error: invalid triple 'nothingtoseehere'"])
+
+ # Check that passing an invalid arch via the SB API fails but doesn't
+ # crash
+ target = self.dbg.CreateTargetWithFileAndArch(exe, "nothingtoseehere")
+ self.assertFalse(target.IsValid(), "This target should not be valid")
+
+ # Now just create the target with the default arch and check it's fine
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target.IsValid(), "This target should now be valid")
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/main.cpp b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/main.cpp
new file mode 100644
index 00000000000..4cce7f667ff
--- /dev/null
+++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/commands/target/create-no-such-arch/main.cpp
@@ -0,0 +1,3 @@
+int main() {
+ return 0;
+}