[llvm-bugs] [Bug 48049] New: platform shell doesn't fail if the shell command fails
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 2 07:48:40 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48049
Bug ID: 48049
Summary: platform shell doesn't fail if the shell command fails
Product: lldb
Version: 11.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: lldb-dev at lists.llvm.org
Reporter: david.spickett at linaro.org
CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20201102/34096c3b/attachment.html>
More information about the llvm-bugs
mailing list