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

llvm-svn: 189405
diff --git a/lldb/test/functionalities/platform/TestPlatformCommand.py b/lldb/test/functionalities/platform/TestPlatformCommand.py
index 6c9143b..2803e71 100644
--- a/lldb/test/functionalities/platform/TestPlatformCommand.py
+++ b/lldb/test/functionalities/platform/TestPlatformCommand.py
@@ -32,6 +32,23 @@
         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