1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/tools/gyp/buildbot/buildbot_run.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,98 @@ 1.4 +#!/usr/bin/env python 1.5 +# Copyright (c) 2012 Google Inc. All rights reserved. 1.6 +# Use of this source code is governed by a BSD-style license that can be 1.7 +# found in the LICENSE file. 1.8 + 1.9 + 1.10 +"""Argument-less script to select what to run on the buildbots.""" 1.11 + 1.12 + 1.13 +import os 1.14 +import shutil 1.15 +import subprocess 1.16 +import sys 1.17 + 1.18 + 1.19 +if sys.platform in ['win32', 'cygwin']: 1.20 + EXE_SUFFIX = '.exe' 1.21 +else: 1.22 + EXE_SUFFIX = '' 1.23 + 1.24 + 1.25 +BUILDBOT_DIR = os.path.dirname(os.path.abspath(__file__)) 1.26 +TRUNK_DIR = os.path.dirname(BUILDBOT_DIR) 1.27 +ROOT_DIR = os.path.dirname(TRUNK_DIR) 1.28 +OUT_DIR = os.path.join(TRUNK_DIR, 'out') 1.29 + 1.30 + 1.31 +def GypTestFormat(title, format=None, msvs_version=None): 1.32 + """Run the gyp tests for a given format, emitting annotator tags. 1.33 + 1.34 + See annotator docs at: 1.35 + https://sites.google.com/a/chromium.org/dev/developers/testing/chromium-build-infrastructure/buildbot-annotations 1.36 + Args: 1.37 + format: gyp format to test. 1.38 + Returns: 1.39 + 0 for sucesss, 1 for failure. 1.40 + """ 1.41 + if not format: 1.42 + format = title 1.43 + 1.44 + print '@@@BUILD_STEP ' + title + '@@@' 1.45 + sys.stdout.flush() 1.46 + env = os.environ.copy() 1.47 + # TODO(bradnelson): remove this when this issue is resolved: 1.48 + # http://code.google.com/p/chromium/issues/detail?id=108251 1.49 + if format == 'ninja': 1.50 + env['NOGOLD'] = '1' 1.51 + if msvs_version: 1.52 + env['GYP_MSVS_VERSION'] = msvs_version 1.53 + retcode = subprocess.call(' '.join( 1.54 + [sys.executable, 'trunk/gyptest.py', 1.55 + '--all', 1.56 + '--passed', 1.57 + '--format', format, 1.58 + '--chdir', 'trunk', 1.59 + '--path', '../scons']), 1.60 + cwd=ROOT_DIR, env=env, shell=True) 1.61 + if retcode: 1.62 + # Emit failure tag, and keep going. 1.63 + print '@@@STEP_FAILURE@@@' 1.64 + return 1 1.65 + return 0 1.66 + 1.67 + 1.68 +def GypBuild(): 1.69 + # Dump out/ directory. 1.70 + print '@@@BUILD_STEP cleanup@@@' 1.71 + print 'Removing %s...' % OUT_DIR 1.72 + shutil.rmtree(OUT_DIR, ignore_errors=True) 1.73 + print 'Done.' 1.74 + 1.75 + retcode = 0 1.76 + if sys.platform.startswith('linux'): 1.77 + retcode += GypTestFormat('ninja') 1.78 + retcode += GypTestFormat('scons') 1.79 + retcode += GypTestFormat('make') 1.80 + elif sys.platform == 'darwin': 1.81 + retcode += GypTestFormat('ninja') 1.82 + retcode += GypTestFormat('xcode') 1.83 + retcode += GypTestFormat('make') 1.84 + elif sys.platform == 'win32': 1.85 + retcode += GypTestFormat('ninja') 1.86 + retcode += GypTestFormat('msvs-2008', format='msvs', msvs_version='2008') 1.87 + if os.environ['BUILDBOT_BUILDERNAME'] == 'gyp-win64': 1.88 + retcode += GypTestFormat('msvs-2010', format='msvs', msvs_version='2010') 1.89 + else: 1.90 + raise Exception('Unknown platform') 1.91 + if retcode: 1.92 + # TODO(bradnelson): once the annotator supports a postscript (section for 1.93 + # after the build proper that could be used for cumulative failures), 1.94 + # use that instead of this. This isolates the final return value so 1.95 + # that it isn't misattributed to the last stage. 1.96 + print '@@@BUILD_STEP failures@@@' 1.97 + sys.exit(retcode) 1.98 + 1.99 + 1.100 +if __name__ == '__main__': 1.101 + GypBuild()