summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-21 20:43:58 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-21 20:43:58 +0000
commit3e03f76d51790d48d79e4b8f0eb4492a9b1eb261 (patch)
tree72ca4b97e71fb1943aeb3d15164b80d3e898c70a /native_client_sdk
parent37f27b626247f572c576e5ab0f743c8e5e84e603 (diff)
downloadchromium_src-3e03f76d51790d48d79e4b8f0eb4492a9b1eb261.zip
chromium_src-3e03f76d51790d48d79e4b8f0eb4492a9b1eb261.tar.gz
chromium_src-3e03f76d51790d48d79e4b8f0eb4492a9b1eb261.tar.bz2
[NaCl SDK] Turn on pyauto testing on SDK builders
Previous review, reverted: http://codereview.chromium.org/10541089/ BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/10541116 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-xnative_client_sdk/src/build_tools/build_sdk.py59
-rw-r--r--native_client_sdk/src/build_tools/buildbot_common.py16
-rw-r--r--native_client_sdk/src/examples/sine_synth/index.html4
3 files changed, 64 insertions, 15 deletions
diff --git a/native_client_sdk/src/build_tools/build_sdk.py b/native_client_sdk/src/build_tools/build_sdk.py
index ba44579..f071cd8 100755
--- a/native_client_sdk/src/build_tools/build_sdk.py
+++ b/native_client_sdk/src/build_tools/build_sdk.py
@@ -17,6 +17,7 @@ and whether it should upload an SDK to file storage (GSTORE)
# std python includes
+import copy
import generate_make
import optparse
import os
@@ -400,6 +401,9 @@ def main(args):
action='store_true', dest='only_examples', default=False)
parser.add_option('--update', help='Only build the updater.',
action='store_true', dest='only_updater', default=False)
+ parser.add_option('--test-examples',
+ help='Run the pyauto tests for examples.', action='store_true',
+ dest='test_examples', default=False)
parser.add_option('--skip-tar', help='Skip generating a tarball.',
action='store_true', dest='skip_tar', default=False)
parser.add_option('--archive', help='Force the archive step.',
@@ -415,6 +419,11 @@ def main(args):
if builder_name.find('pnacl') >= 0 and builder_name.find('sdk') >= 0:
options.pnacl = True
+ # TODO(binji) for now, only test examples on non-trybots. Trybots don't build
+ # pyauto Chrome.
+ if buildbot_common.IsSDKBuilder():
+ options.test_examples = True
+
if options.pnacl:
toolchains = ['pnacl']
else:
@@ -427,6 +436,8 @@ def main(args):
skip_untar = skip
skip_build = skip
skip_test_updater = skip
+ skip_test_examples = skip_examples or not options.test_examples
+ skip_test_build_tools = skip
skip_tar = skip or options.skip_tar
if options.archive and (options.only_examples or options.skip_tar):
@@ -501,9 +512,10 @@ def main(args):
'pepper_' + pepper_ver], cwd=NACL_DIR)
# Run build tests
- buildbot_common.BuildStep('Run build_tools tests')
- buildbot_common.Run([sys.executable,
- os.path.join(SDK_SRC_DIR, 'build_tools', 'tests', 'test_all.py')])
+ if not skip_test_build_tools:
+ buildbot_common.BuildStep('Run build_tools tests')
+ buildbot_common.Run([sys.executable,
+ os.path.join(SDK_SRC_DIR, 'build_tools', 'tests', 'test_all.py')])
# build sdk update
if not skip_update:
@@ -564,7 +576,7 @@ def main(args):
# build examples.
if not skip_examples:
- buildbot_common.BuildStep('Test Build Examples')
+ buildbot_common.BuildStep('Build Examples')
example_dir = os.path.join(pepperdir, 'examples')
makefile = os.path.join(example_dir, 'Makefile')
if os.path.isfile(makefile):
@@ -573,18 +585,35 @@ def main(args):
cwd=os.path.abspath(example_dir), shell=True)
# test examples.
- skip_test_examples = True
- if not skip_examples:
- if not skip_test_examples:
- run_script_path = os.path.join(SRC_DIR, 'chrome', 'test', 'functional')
- buildbot_common.Run([sys.executable, 'nacl_sdk_example_test.py',
- 'nacl_sdk_example_test.NaClSDKTest.testNaClSDK'], cwd=run_script_path,
- env=dict(os.environ.items()+{'pepper_ver':pepper_ver,
- 'OUT_DIR':OUT_DIR}.items()))
+ if not skip_examples and not skip_test_examples:
+ buildbot_common.BuildStep('Test Examples')
+ env = copy.copy(os.environ)
+ env['PEPPER_VER'] = pepper_ver
+ env['NACL_SDK_ROOT'] = pepperdir
+
+ pyauto_script = os.path.join(SRC_DIR, 'chrome', 'test', 'functional',
+ 'nacl_sdk.py')
+ pyauto_script_args = ['nacl_sdk.NaClSDKTest.NaClSDKExamples']
+
+ if platform == 'linux' and buildbot_common.IsSDKBuilder():
+ # linux buildbots need to run the pyauto tests through xvfb. Running
+ # using runtest.py does this.
+ #env['PYTHON_PATH'] = '.:' + env.get('PYTHON_PATH', '.')
+ build_dir = os.path.dirname(SRC_DIR)
+ runtest_py = os.path.join(build_dir, '..', '..', '..', 'scripts', 'slave',
+ 'runtest.py')
+ buildbot_common.Run([sys.executable, runtest_py, '--target', 'Release',
+ '--build-dir', 'src/build', sys.executable,
+ pyauto_script] + pyauto_script_args,
+ cwd=build_dir, env=env)
+ else:
+ buildbot_common.Run([sys.executable, 'nacl_sdk.py',
+ 'nacl_sdk.NaClSDKTest.NaClSDKExamples'],
+ cwd=os.path.dirname(pyauto_script),
+ env=env)
# Archive on non-trybots.
- buildername = os.environ.get('BUILDBOT_BUILDERNAME', '')
- if options.archive or '-sdk' in buildername:
+ if options.archive or buildbot_common.IsSDKBuilder():
buildbot_common.BuildStep('Archive build')
bucket_path = 'nativeclient-mirror/nacl/nacl_sdk/%s' % \
build_utils.ChromeVersion()
@@ -592,7 +621,7 @@ def main(args):
if not skip_update:
# Only push up sdk_tools.tgz on the linux buildbot.
- if buildername == 'linux-sdk-multi':
+ if builder_name == 'linux-sdk-multi':
sdk_tools = os.path.join(OUT_DIR, 'sdk_tools.tgz')
buildbot_common.Archive('sdk_tools.tgz', bucket_path, OUT_DIR,
step_link=False)
diff --git a/native_client_sdk/src/build_tools/buildbot_common.py b/native_client_sdk/src/build_tools/buildbot_common.py
index d375027..636db8f 100644
--- a/native_client_sdk/src/build_tools/buildbot_common.py
+++ b/native_client_sdk/src/build_tools/buildbot_common.py
@@ -18,6 +18,22 @@ sys.path.append(os.path.join(SDK_SRC_DIR, 'tools'))
import oshelpers
+def IsSDKBuilder():
+ """Returns True if this script is running on an SDK builder.
+
+ False means it is either running on a trybot, or a user's machine.
+
+ Trybot names:
+ naclsdkm-((pnacl-)?linux|mac|windows(32|64))
+
+ Builder names:
+ (pnacl-)?(windows|mac|linux)-sdk-multi(rel)?
+
+ except there are currently no pnacl multirel bots, and
+ pnacl-windows-sdk-multi is actually called pnacl-win-sdk-multi."""
+ return '-sdk-multi' in os.getenv('BUILDBOT_BUILDERNAME', '')
+
+
def ErrorExit(msg):
"""Write and error to stderr, then exit with 1 signaling failure."""
sys.stderr.write(msg + '\n')
diff --git a/native_client_sdk/src/examples/sine_synth/index.html b/native_client_sdk/src/examples/sine_synth/index.html
index 8cbac21..eb1717b 100644
--- a/native_client_sdk/src/examples/sine_synth/index.html
+++ b/native_client_sdk/src/examples/sine_synth/index.html
@@ -24,6 +24,10 @@
function changeFrequency(freq) {
naclModule.postMessage('setFrequency:' + freq);
}
+
+ function handleMessage(e) {
+ document.getElementById('frequency_field').value = message_event.data;
+ }
</script>
</head>
<body onload="pageDidLoad('<NAME>', '<tc>')">