[Lldb-commits] [lldb] r189405 - Fix 'platform shell' command for Linux host and remote lldb-platform connections
Daniel Malea
daniel.malea at intel.com
Tue Aug 27 14:01:01 PDT 2013
Author: dmalea
Date: Tue Aug 27 16:01:01 2013
New Revision: 189405
URL: http://llvm.org/viewvc/llvm-project?rev=189405&view=rev
Log:
Fix 'platform shell' command for Linux host and remote lldb-platform connections
- add default timeout of 10s (unil qPlatform_RunCommand supports timeout packets and CommandObjectPlatform is updated to read a timeout flag/setting)
- add a few tests for platform shell
Modified:
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
lldb/trunk/test/functionalities/platform/TestPlatformCommand.py
Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=189405&r1=189404&r2=189405&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Tue Aug 27 16:01:01 2013
@@ -1949,7 +1949,8 @@ public:
public:
CommandOptions (CommandInterpreter &interpreter) :
- Options(interpreter)
+ Options(interpreter),
+ timeout(10)
{
}
@@ -1999,7 +2000,6 @@ public:
virtual void
OptionParsingStarting ()
{
- timeout = 10;
}
// Options table: Required for subclasses of Options.
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp?rev=189405&r1=189404&r2=189405&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp Tue Aug 27 16:01:01 2013
@@ -1254,7 +1254,9 @@ GDBRemoteCommunicationServer::Handle_qPl
return false;
if (packet.GetChar() != ',')
return false;
- uint32_t timeout = packet.GetHexMaxU32(false, 32);
+ // FIXME: add timeout to qPlatform_RunCommand packet
+ // uint32_t timeout = packet.GetHexMaxU32(false, 32);
+ uint32_t timeout = 10;
if (packet.GetChar() == ',')
packet.GetHexByteString(working_dir);
int status, signo;
Modified: lldb/trunk/test/functionalities/platform/TestPlatformCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/platform/TestPlatformCommand.py?rev=189405&r1=189404&r2=189405&view=diff
==============================================================================
--- lldb/trunk/test/functionalities/platform/TestPlatformCommand.py (original)
+++ lldb/trunk/test/functionalities/platform/TestPlatformCommand.py Tue Aug 27 16:01:01 2013
@@ -32,6 +32,23 @@ class PlatformCommandTestCase(TestBase):
self.expect("platform status",
substrs = ['Platform', 'Triple', 'OS Version', 'Kernel', 'Hostname'])
+ def test_shell(self):
+ """ Test that the platform shell command can invoke ls. """
+ self.expect("platform shell ls /",
+ substrs = ["dev", "tmp", "usr"])
+
+ def test_shell_builtin(self):
+ """ Test a shell built-in command (echo) """
+ self.expect("platform shell echo hello lldb",
+ substrs = ["hello lldb"])
+
+ #FIXME: re-enable once platform shell -t can specify the desired timeout
+ def test_shell_timeout(self):
+ """ Test a shell built-in command (sleep) that times out """
+ self.skipTest("due to taking too long to complete.")
+ self.expect("platform shell sleep 15", error=True,
+ substrs = ["error: timed out waiting for shell command to complete"])
+
if __name__ == '__main__':
import atexit
More information about the lldb-commits
mailing list