[Lldb-commits] [lldb] r154954 - /lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py

Johnny Chen johnny.chen at apple.com
Tue Apr 17 14:51:56 PDT 2012


Author: johnny
Date: Tue Apr 17 16:51:56 2012
New Revision: 154954

URL: http://llvm.org/viewvc/llvm-project?rev=154954&view=rev
Log:
Add an example config file for the test driver to supply the pre/post-flight functions to the test suite.

Added:
    lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py

Added: lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py?rev=154954&view=auto
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py (added)
+++ lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py Tue Apr 17 16:51:56 2012
@@ -0,0 +1,35 @@
+"""
+Example config file for the test driver to supply the pre/post-flight functions to the test suite.
+The pre-flight code gets executed during setUp() after the debugger instance is avilable and
+the post-flight code gets executed during tearDown() after the debugger instance has done killing
+the inferior and deleting all the target programs.
+
+See lldb/test/dotest.py and lldbtest.py which work together to provide config-able pre/post-flight capabilities.
+See also lldb/examples/test/usage-pre-post-flight for a usage scenario.
+"""
+
+import os
+import unittest2
+
+def pre_flight(test):
+    __import__("lldb")
+    __import__("lldbtest")
+    __import__("pexpect")
+    print "\nRunning pre-flight function:"
+    print "for test case:", test
+    # Examples:
+    #test.runCmd('platform select remote-macosx')
+    #test.runCmd('platform connect connect://localhost:12345 -r -R "-avz"')
+    lldbtest_platform = os.environ['LLDBTEST_PLATFORM'] if 'LLDBTEST_PLATFORM' in os.environ else 'remote-macosx'
+    lldbtest_platform_url = os.environ['LLDBTEST_PLATFORM_URL'] if 'LLDBTEST_PLATFORM_URL' in os.environ else 'connect://localhost:12345 -r -R "-avz"'
+    test.runCmd('platform select %s' % lldbtest_platform)
+    test.runCmd('platform connect %s' % lldbtest_platform_url)
+
+def post_flight(test):
+    __import__("lldb")
+    __import__("lldbtest")
+    __import__("pexpect")
+    print "\nRunning post-flight function:"
+    print "for test case:", test
+    test.runCmd('platform disconnect')
+





More information about the lldb-commits mailing list