diff options
| author | Android (Google) Code Review <android-gerrit@google.com> | 2009-07-01 11:19:12 -0700 |
|---|---|---|
| committer | The Android Open Source Project <initial-contribution@android.com> | 2009-07-01 11:19:12 -0700 |
| commit | 7236fbf8d4fe620562bb6d255472ddc4cf613548 (patch) | |
| tree | 843f39d0ef82982108e2d0ae197600d6b7fbf35e /testrunner | |
| parent | cf2ec6185b4338dc3dbd2b4928d0349244b7285e (diff) | |
| parent | 5dffb0649b9bf2c73f36db8a0cc00535bd36385d (diff) | |
| download | android_development-7236fbf8d4fe620562bb6d255472ddc4cf613548.tar.gz android_development-7236fbf8d4fe620562bb6d255472ddc4cf613548.tar.bz2 android_development-7236fbf8d4fe620562bb6d255472ddc4cf613548.zip | |
am 5dffb064: Merge change 5727 into donut
Merge commit '5dffb0649b9bf2c73f36db8a0cc00535bd36385d'
* commit '5dffb0649b9bf2c73f36db8a0cc00535bd36385d':
runtest: Remove run_command -> android_build dependency.
Diffstat (limited to 'testrunner')
| -rwxr-xr-x | testrunner/run_command.py | 7 | ||||
| -rw-r--r-- | testrunner/test_defs/native_test.py | 27 |
2 files changed, 26 insertions, 8 deletions
diff --git a/testrunner/run_command.py b/testrunner/run_command.py index 8cf385b87..7d1f547ea 100755 --- a/testrunner/run_command.py +++ b/testrunner/run_command.py @@ -23,7 +23,6 @@ import threading import time # local imports -import android_build import errors import logger @@ -129,16 +128,14 @@ def RunHostCommand(binary, valgrind=False): output are always discarded. Args: - binary: basename of the file to be run. It is expected to be under - out/host/<os>-<arch>/bin. + binary: full path of the file to be run. valgrind: If True the command will be run under valgrind. Returns: The command exit code (int) """ - full_path = os.path.join(android_build.GetHostBin(), binary) if not valgrind: - subproc = subprocess.Popen(full_path, stdout=subprocess.PIPE, + subproc = subprocess.Popen(binary, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) subproc.wait() if subproc.returncode != 0: # In case of error print the output diff --git a/testrunner/test_defs/native_test.py b/testrunner/test_defs/native_test.py index e27f3e6d0..1541cc1ec 100644 --- a/testrunner/test_defs/native_test.py +++ b/testrunner/test_defs/native_test.py @@ -18,6 +18,7 @@ """TestSuite for running native Android tests.""" # python imports +import re import os # local imports @@ -93,9 +94,9 @@ class NativeTestSuite(AbstractTestSuite): full_path = os.path.join(os.sep, "system", "bin", f) # Single quotes are needed to prevent the shell splitting it. - output = self._adb.SendShellCommand("'%s 2>&1;echo -n exit code:$?'" % - full_path, - int(self._options.timeout)) + output = adb.SendShellCommand("'%s 2>&1;echo -n exit code:$?'" % + full_path, + int(options.timeout)) success = output.endswith("exit code:0") logger.Log("%s... %s" % (f, success and "ok" or "failed")) # Print the captured output when the test failed. @@ -150,3 +151,23 @@ class NativeTestSuite(AbstractTestSuite): if os.path.exists(full_path): binaries.append(binary) return binaries + + def _RunHostCommand(self, binary, valgrind=False): + """Run a command on the host (opt using valgrind). + + Runs the host binary and returns the exit code. + If successfull, the output (stdout and stderr) are discarded, + but printed in case of error. + The command can be run under valgrind in which case all the + output are always discarded. + + Args: + binary: basename of the file to be run. It is expected to be under + out/host/<os>-<arch>/bin. + valgrind: If True the command will be run under valgrind. + + Returns: + The command exit code (int) + """ + full_path = os.path.join(android_build.GetHostBin(), binary) + return run_command.RunHostCommand(full_path, valgrind=valgrind) |
