Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: testing/gtest_ios/run-unittest.sh

Issue 10832030: Add a helper script to run unit test targets for iOS (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Switch to 5.1 Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/gtest.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash -p
2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 set -eu
8
9 # Environment sanitization. Set a known-safe PATH. Clear environment variables
10 # that might impact the interpreter's operation. The |bash -p| invocation
11 # on the #! line takes the bite out of BASH_ENV, ENV, and SHELLOPTS (among
12 # other features), but clearing them here ensures that they won't impact any
13 # shell scripts used as utility programs. SHELLOPTS is read-only and can't be
14 # unset, only unexported.
15 export PATH="/usr/bin:/bin:/usr/sbin:/sbin"
16 unset BASH_ENV CDPATH ENV GLOBIGNORE IFS POSIXLY_CORRECT
17 export -n SHELLOPTS
18
19 readonly ScriptDir=$(dirname "$(echo ${0} | sed -e "s,^\([^/]\),$(pwd)/\1,")")
20 readonly ScriptName=$(basename "${0}")
21 readonly ThisScript="${ScriptDir}/${ScriptName}"
22 readonly SimExecutable="${BUILD_DIR}/${CONFIGURATION}/iossim"
23
24 # Helper to print a line formatted for Xcodes build output parser.
25 XcodeNote() {
26 echo "${ThisScript}:${1}: note: ${2}"
27 }
28
29 # Helper to print a divider to make things stick out in a busy output window.
30 XcodeHeader() {
31 echo "note: _________________________________________________________________"
32 echo "note: _________________________________________________________________"
33 echo "note: _________________________________________________________________"
34 XcodeNote "$1" ">>>>> $2"
35 echo "note: _________________________________________________________________"
36 echo "note: _________________________________________________________________"
37 echo "note: _________________________________________________________________"
38 }
39
40 # Kills the iPhone Simulator if it is running.
41 KillSimulator() {
42 /usr/bin/killall "iPhone Simulator" 2> /dev/null || true
43 }
44
45 # Runs tests via the iPhone Simulator for multiple devices.
46 RunTests() {
47 local -r appPath="${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app"
48
49 if [[ ! -x "${SimExecutable}" ]]; then
50 echo "Unable to run tests: ${SimExecutable} was not found/executable."
51 exit 1
52 fi
53
54 for device in 'iPhone' 'iPad'; do
55 iosVersion="5.1"
56 KillSimulator
57 local command=(
58 "${SimExecutable}" "-d${device}" "-s${iosVersion}" "${appPath}"
59 )
60 # Pass along any command line flags
61 if [[ "$#" -gt 0 ]]; then
62 command+=( "--" "${@}" )
63 fi
64 XcodeHeader ${LINENO} "Launching tests for ${device} (iOS ${iosVersion})"
65 "${command[@]}"
66
67 # If the command didn't exit successfully, abort.
68 if [[ $? -ne 0 ]]; then
69 exit $?;
70 fi
71 done
72 }
73
74 # Time to get to work.
75
76 if [[ "${PLATFORM_NAME}" != "iphonesimulator" ]]; then
77 XcodeNote ${LINENO} "Skipping running of unittests for device build."
78 else
79 if [[ "$#" -gt 0 ]]; then
80 RunTests "${@}"
81 else
82 RunTests
83 fi
84 KillSimulator
85 fi
86
87 exit 0
OLDNEW
« no previous file with comments | « testing/gtest.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698