summaryrefslogtreecommitdiff
path: root/lldb/test/API/commands/target/basic/TestTargetCommand.py
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-07-29 08:59:57 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2020-07-29 10:30:20 -0700
commit4add853647b358d9bb7f162682e806725888848b (patch)
treeb9d1905dd32c969fab474896debcfb190c6afb96 /lldb/test/API/commands/target/basic/TestTargetCommand.py
parente7196bdf81251a4df97746fd54b7db749ca99097 (diff)
[lldb] Improve platform handling in CreateTargetInternal
Currently, `target create` has no --platform option. However, TargetList::CreateTargetInternal which is called under the hood, will return an error when either no platform or multiple matching platforms are found, saying that a platform should be specified with --platform. This patch adds the platform option, but that doesn't solve either of these errors. - If more than one platform matches, specifying the platform isn't going to fix that. The current code will only look at the architecture instead. I've updated the error message to ask the user to specify an architecture. - If no architecture is found, specifying a new one via platform isn't going to change that either because we already try to find one that matches the given architecture. Differential revision: https://reviews.llvm.org/D84809
Diffstat (limited to 'lldb/test/API/commands/target/basic/TestTargetCommand.py')
-rw-r--r--lldb/test/API/commands/target/basic/TestTargetCommand.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/test/API/commands/target/basic/TestTargetCommand.py b/lldb/test/API/commands/target/basic/TestTargetCommand.py
index 83e27e272464..be6eeb938ab8 100644
--- a/lldb/test/API/commands/target/basic/TestTargetCommand.py
+++ b/lldb/test/API/commands/target/basic/TestTargetCommand.py
@@ -115,6 +115,33 @@ class targetCommandTestCase(TestBase):
self.runCmd("target list")
+ @no_debug_info_test
+ def test_target_create_invalid_arch(self):
+ exe = self.getBuildArtifact("a.out")
+ self.expect("target create {} --arch doesntexist".format(exe), error=True,
+ patterns=["error: invalid triple 'doesntexist'"])
+
+ @no_debug_info_test
+ def test_target_create_platform(self):
+ self.buildB()
+ exe = self.getBuildArtifact("b.out")
+ self.expect("target create {} --platform host".format(exe))
+
+ @no_debug_info_test
+ def test_target_create_unsupported_platform(self):
+ yaml = os.path.join(self.getSourceDir(), "bogus.yaml")
+ exe = self.getBuildArtifact("bogus")
+ self.yaml2obj(yaml, exe)
+ self.expect("target create {}".format(exe), error=True,
+ patterns=['error: no matching platforms found for this file'])
+
+ @no_debug_info_test
+ def test_target_create_invalid_platform(self):
+ self.buildB()
+ exe = self.getBuildArtifact("b.out")
+ self.expect("target create {} --platform doesntexist".format(exe), error=True,
+ patterns=['error: unable to find a plug-in for the platform named "doesntexist"'])
+
def do_target_variable_command(self, exe_name):
"""Exercise 'target variable' command before and after starting the inferior."""
self.runCmd("file " + self.getBuildArtifact(exe_name),