[Lldb-commits] [lldb] r136409 - in /lldb/trunk/test/expression_command/radar_9673664: ./ Makefile TestExprHelpExamples.py main.c

Johnny Chen johnny.chen at apple.com
Thu Jul 28 15:12:13 PDT 2011


Author: johnny
Date: Thu Jul 28 17:12:12 2011
New Revision: 136409

URL: http://llvm.org/viewvc/llvm-project?rev=136409&view=rev
Log:
Add test case for rdar://problem/9673664.

Added:
    lldb/trunk/test/expression_command/radar_9673664/
    lldb/trunk/test/expression_command/radar_9673664/Makefile
    lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py
    lldb/trunk/test/expression_command/radar_9673664/main.c

Added: lldb/trunk/test/expression_command/radar_9673664/Makefile
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/radar_9673664/Makefile?rev=136409&view=auto
==============================================================================
--- lldb/trunk/test/expression_command/radar_9673664/Makefile (added)
+++ lldb/trunk/test/expression_command/radar_9673664/Makefile Thu Jul 28 17:12:12 2011
@@ -0,0 +1,5 @@
+LEVEL = ../../make
+
+C_SOURCES := main.c
+
+include $(LEVEL)/Makefile.rules

Added: lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py?rev=136409&view=auto
==============================================================================
--- lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py (added)
+++ lldb/trunk/test/expression_command/radar_9673664/TestExprHelpExamples.py Thu Jul 28 17:12:12 2011
@@ -0,0 +1,47 @@
+"""
+Test example snippets from the lldb 'help expression' output.
+"""
+
+import os, time
+import unittest2
+import lldb
+from lldbtest import *
+
+class Radar9673644TestCase(TestBase):
+
+    mydir = os.path.join("expression_command", "radar_9673664")
+
+    def setUp(self):
+        # Call super's setUp().
+        TestBase.setUp(self)
+        # Find the line number to break inside main().
+        self.main_source = "main.c"
+        self.line = line_number(self.main_source, '// Set breakpoint here.')
+
+    # rdar://problem/9673664
+    @unittest2.expectedFailure
+    def test_expr_commands(self):
+        """The following expression commands should just work."""
+        self.buildDefault()
+
+        self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
+
+        self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
+                    BREAKPOINT_CREATED,
+            startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+                        (self.main_source, self.line))
+
+        self.runCmd("run", RUN_SUCCEEDED)
+
+        # rdar://problem/9673664 lldb expression evaluation problem
+
+        self.runCmd('expr char c[] = "foo"; c[0]')
+        # Fill in an example output here.
+        # And change self.runCmd() -> self.expect()...
+
+
+if __name__ == '__main__':
+    import atexit
+    lldb.SBDebugger.Initialize()
+    atexit.register(lambda: lldb.SBDebugger.Terminate())
+    unittest2.main()

Added: lldb/trunk/test/expression_command/radar_9673664/main.c
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/radar_9673664/main.c?rev=136409&view=auto
==============================================================================
--- lldb/trunk/test/expression_command/radar_9673664/main.c (added)
+++ lldb/trunk/test/expression_command/radar_9673664/main.c Thu Jul 28 17:12:12 2011
@@ -0,0 +1,16 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdio.h>
+
+int main (int argc, char const *argv[])
+{
+    printf("Hello, world.\n"); // Set breakpoint here.
+    
+    return 0;
+}





More information about the lldb-commits mailing list