<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - platform shell doesn't fail if the shell command fails"
href="https://bugs.llvm.org/show_bug.cgi?id=48049">48049</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>platform shell doesn't fail if the shell command fails
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>11.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>david.spickett@linaro.org
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>In an interactive shell we get all the output you'd expect:
$ ./bin/lldb
(lldb) platform shell not_a_cmd
/bin/bash: not_a_cmd: command not found
error: command returned with status 127
But when using the API (via the test framework) the command is marked as
succeeded even though it failed on the platform:
@no_debug_info_test
+ def test_shell_command_failure(self):
+ """ Test that the platform shell command passes on command failures"""
+ triple = self.dbg.GetSelectedPlatform().GetTriple()
+ # TODO: windows/android like above
+ self.runCmd("platform shell definitley_not_a_command", check=False)
+ self.assertFalse(self.res.Succeeded())
FAIL: test_shell_command_failure (TestPlatformCommand.PlatformCommandTestCase)
Test that the platform shell command passes on command failures
----------------------------------------------------------------------
Traceback (most recent call last):
File
"/work/open_source/nightly-llvm/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py",
line 346, in wrapper
return func(self, *args, **kwargs)
File
"/work/open_source/nightly-llvm/llvm-project/lldb/test/API/commands/platform/basic/TestPlatformCommand.py",
line 85, in test_shell_command_failure
self.assertFalse(self.res.Succeeded())
AssertionError: True is not False
I can see some logic in saying it's a success because lldb successfully sent
the command text to and from the platform. Whether the command itself was
successful is the user's business. Is that intentional or just how "platform
shell" happens to act?
I initially assumed that a failed shell command would be a failed lldb command.
I couldn't find mention of this in the docs.
The one existing test using SBPlatformCommand is:
API/python_api/sbplatform/TestSBPlatform.py
Which also checks that the command output contains the expected text.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>