From 2f6c37672cb2eefba8cdd0feb2cdee3e4464d0db Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Fri, 6 Nov 2015 23:36:07 -0800 Subject: [PATCH] Run unit tests on Travis --- .travis.yml | 7 +++++++ travis/download_tester.py | 40 +++++++++++++++++++++++++++++++++++++++ travis/setup.sh | 5 ++++- travis/test.sh | 1 + 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100755 travis/download_tester.py diff --git a/.travis.yml b/.travis.yml index 169eacda8d..6d38aa0d41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,13 @@ language: dart sudo: false dart: - stable +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - gcc-4.8 + - g++-4.8 before_script: - ./travis/setup.sh script: diff --git a/travis/download_tester.py b/travis/download_tester.py new file mode 100755 index 0000000000..3ec5db5692 --- /dev/null +++ b/travis/download_tester.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python +# Copyright 2015 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import argparse +import os +import subprocess +import sys + +def download(base_url, out_dir, name): + url = '%s/%s' % (base_url, name) + dst = os.path.join(out_dir, name) + print 'Downloading', url + subprocess.call([ 'curl', '-o', dst, url ]) + +def main(): + parser = argparse.ArgumentParser(description='Downloads test artifacts from Google storage') + parser.add_argument('revision_file') + parser.add_argument('out_dir') + args = parser.parse_args() + + out_dir = args.out_dir + if not os.path.exists(out_dir): + os.makedirs(out_dir) + + revision = None + with open(args.revision_file, 'r') as f: + revision = f.read() + + base_url = 'https://storage.googleapis.com/mojo/sky/shell/linux-x64/%s' % revision + download(base_url, out_dir, 'sky_shell') + download(base_url, out_dir, 'icudtl.dat') + download(base_url, out_dir, 'sky_snapshot') + + subprocess.call([ 'chmod', 'a+x', os.path.join(out_dir, 'sky_shell' )]) + subprocess.call([ 'chmod', 'a+x', os.path.join(out_dir, 'sky_snapshot' )]) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/travis/setup.sh b/travis/setup.sh index 840196f80c..59e2192561 100755 --- a/travis/setup.sh +++ b/travis/setup.sh @@ -1,8 +1,11 @@ #!/bin/bash set -ex +pub global activate tuneup + (cd packages/cassowary; pub get) (cd packages/newton; pub get) (cd packages/flutter_tools; pub get) +(cd packages/unit; pub get) -pub global activate tuneup +./travis/download_tester.py packages/unit/packages/sky_engine/REVISION bin/cache/travis/out/Debug diff --git a/travis/test.sh b/travis/test.sh index d819706b35..9684171da1 100755 --- a/travis/test.sh +++ b/travis/test.sh @@ -4,3 +4,4 @@ set -ex (cd packages/cassowary; pub global run tuneup check; pub run test -j1) (cd packages/newton; pub global run tuneup check; pub run test -j1) (cd packages/flutter_tools; pub global run tuneup check; pub run test -j1) +./dev/run_tests --engine-dir bin/cache/travis