[Lldb-commits] [lldb] r155252 - in /lldb/branches/lldb-platform-work/test: dotest.py lldb-pre-post-flight.py lldbtest.py types/AbstractBase.py
Johnny Chen
johnny.chen at apple.com
Fri Apr 20 15:47:58 PDT 2012
Author: johnny
Date: Fri Apr 20 17:47:58 2012
New Revision: 155252
URL: http://llvm.org/viewvc/llvm-project?rev=155252&view=rev
Log:
Some tweaking to enable running the 'types' testsuite directory remotely.
The typical scenario is for the test case to run the inferior to gather the so-called golden output,
then lldb will debug and break into the inferior program to compare its output against the golden output.
Add an additional lldbtest_remote_shell_template variable into the lldb namespace for our test infrastructure.
Modified:
lldb/branches/lldb-platform-work/test/dotest.py
lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py
lldb/branches/lldb-platform-work/test/lldbtest.py
lldb/branches/lldb-platform-work/test/types/AbstractBase.py
Modified: lldb/branches/lldb-platform-work/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/dotest.py?rev=155252&r1=155251&r2=155252&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/dotest.py (original)
+++ lldb/branches/lldb-platform-work/test/dotest.py Fri Apr 20 17:47:58 2012
@@ -99,8 +99,9 @@
# The pre_flight and post_flight functions come from reading a config file.
pre_flight = None
post_flight = None
-# So does the lldbtest_remote_sandbox variable.
+# So do the lldbtest_remote_sandbox and lldbtest_remote_shell_template variables.
lldbtest_remote_sandbox = None
+lldbtest_remote_shell_template = None
# The 'archs' and 'compilers' can be specified via either command line or configFile,
# with the command line overriding the configFile. When specified, they should be
@@ -665,7 +666,7 @@
# respectively.
#
# See also lldb-trunk/example/test/usage-config.
- global config, pre_flight, post_flight, lldbtest_remote_sandbox
+ global config, pre_flight, post_flight, lldbtest_remote_sandbox, lldbtest_remote_shell_template
if configFile:
# Pass config (a dictionary) as the locals namespace for side-effect.
execfile(configFile, globals(), config)
@@ -682,6 +683,8 @@
sys.exit(1)
if "lldbtest_remote_sandbox" in config:
lldbtest_remote_sandbox = config["lldbtest_remote_sandbox"]
+ if "lldbtest_remote_shell_template" in config:
+ lldbtest_remote_shell_template = config["lldbtest_remote_shell_template"]
#print "sys.stderr:", sys.stderr
#print "sys.stdout:", sys.stdout
@@ -1061,8 +1064,10 @@
else:
lldb.test_remote = False
-# So does the lldbtest_remote_sandbox variable.
+# So do the lldbtest_remote_sandbox and lldbtest_remote_shell_template variables.
lldb.lldbtest_remote_sandbox = lldbtest_remote_sandbox
+lldb.lldbtest_remote_sandboxed_executable = None
+lldb.lldbtest_remote_shell_template = lldbtest_remote_shell_template
# Put all these test decorators in the lldb namespace.
lldb.dont_do_python_api_test = dont_do_python_api_test
Modified: 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=155252&r1=155251&r2=155252&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py (original)
+++ lldb/branches/lldb-platform-work/test/lldb-pre-post-flight.py Fri Apr 20 17:47:58 2012
@@ -31,3 +31,4 @@
test.runCmd('platform disconnect')
lldbtest_remote_sandbox = os.environ['LLDBTEST_REMOTE_SANDBOX'] if 'LLDBTEST_REMOTE_SANDBOX' in os.environ else None
+lldbtest_remote_shell_template = os.environ['LLDBTEST_REMOTE_SHELL_TEMPLATE'] if 'LLDBTEST_REMOTE_SHELL_TEMPLATE' in os.environ else None
Modified: lldb/branches/lldb-platform-work/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/lldbtest.py?rev=155252&r1=155251&r2=155252&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/lldbtest.py (original)
+++ lldb/branches/lldb-platform-work/test/lldbtest.py Fri Apr 20 17:47:58 2012
@@ -1128,7 +1128,13 @@
print >> sbuf, "Insert this command to be run first: %s" % platform_target_install_command
self.ci.HandleCommand(platform_target_install_command, self.res)
# And this is the file command we want to execute, instead.
- cmd = "file -P %s %s" % (target.replace(parent_dir, lldb.lldbtest_remote_sandbox), target)
+ #
+ # Warning: SIDE EFFECT AHEAD!!!
+ # Populate the remote executable pathname into the lldb namespace,
+ # so that test cases can grab this thing out of the namespace.
+ #
+ lldb.lldbtest_remote_sandboxed_executable = target.replace(parent_dir, lldb.lldbtest_remote_sandbox)
+ cmd = "file -P %s %s" % lldb.lldbtest_remote_sandboxed_executable, target)
print >> sbuf, "And this is the replaced file command: %s" % cmd
running = (cmd.startswith("run") or cmd.startswith("process launch"))
Modified: lldb/branches/lldb-platform-work/test/types/AbstractBase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/branches/lldb-platform-work/test/types/AbstractBase.py?rev=155252&r1=155251&r2=155252&view=diff
==============================================================================
--- lldb/branches/lldb-platform-work/test/types/AbstractBase.py (original)
+++ lldb/branches/lldb-platform-work/test/types/AbstractBase.py Fri Apr 20 17:47:58 2012
@@ -29,12 +29,6 @@
# used for all the test cases.
self.exe_name = self.testMethodName
- def tearDown(self):
- """Cleanup the test byproducts."""
- TestBase.tearDown(self)
- #print "Removing golden-output.txt..."
- os.remove("golden-output.txt")
-
#==========================================================================#
# Functions build_and_run() and build_and_run_expr() are generic functions #
# which are called from the Test*Types*.py test cases. The API client is #
@@ -85,10 +79,14 @@
# First, capture the golden output emitted by the oracle, i.e., the
# series of printf statements.
- self.runCmd("process launch -o golden-output.txt")
- with open("golden-output.txt") as f:
- go = f.read()
-
+ if lldb.lldbtest_remote_sandbox:
+ if not lldb.lldbtest_remote_sandboxed_executable:
+ raise Exception("To execute 'types' testsuite remotely, the remote sandboxed executable path needs to be defined by the infrastructure")
+ if not lldb.lldbtest_remote_shell_template:
+ raise Exception("To execute 'types' testsuite remotely, make sure you have the remote shell template defined in your config file")
+ go = system(lldb.lldbtest_remote_shell_template % lldb.lldbtest_remote_sandboxed_executable, sender=self)[0]
+ else:
+ go = system("./%s" % exe_name, sender=self)[0]
# This golden list contains a list of (variable, value) pairs extracted
# from the golden output.
gl = []
@@ -162,10 +160,7 @@
# First, capture the golden output emitted by the oracle, i.e., the
# series of printf statements.
- self.runCmd("process launch -o golden-output.txt")
- with open("golden-output.txt") as f:
- go = f.read()
-
+ go = system("./%s" % exe_name, sender=self)[0]
# This golden list contains a list of (variable, value) pairs extracted
# from the golden output.
gl = []
More information about the lldb-commits
mailing list