aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/ios
diff options
context:
space:
mode:
authorGravatar stephana <stephana@chromium.org>2015-04-21 08:31:59 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-04-21 08:31:59 -0700
commitcdec56e72b2dbb3fd15b77ed7ec949322ae731b8 (patch)
tree7db63c10f9c2c7e6fada7b2c37c5e67bd7ab099d /platform_tools/ios
parenta4a0aeb74808a0860f3e94588d0ceb0da9fed386 (diff)
Landing directly for testing the ios buildbot code.
BUG=skia: TBR=borenet Review URL: https://codereview.chromium.org/1087653005
Diffstat (limited to 'platform_tools/ios')
-rwxr-xr-xplatform_tools/ios/bin/ios_mkdir14
-rwxr-xr-xplatform_tools/ios/bin/ios_mount.sh14
-rwxr-xr-xplatform_tools/ios/bin/ios_ninja20
-rwxr-xr-xplatform_tools/ios/bin/ios_path_exists21
-rwxr-xr-xplatform_tools/ios/bin/ios_pull.sh16
-rwxr-xr-xplatform_tools/ios/bin/ios_pull_if_needed18
-rwxr-xr-xplatform_tools/ios/bin/ios_push_file18
-rwxr-xr-xplatform_tools/ios/bin/ios_push_if_needed15
-rwxr-xr-xplatform_tools/ios/bin/ios_rmdir12
-rwxr-xr-xplatform_tools/ios/bin/ios_run_skia26
-rwxr-xr-xplatform_tools/ios/bin/ios_setup.sh179
-rwxr-xr-xplatform_tools/ios/bin/ios_umount.sh15
12 files changed, 368 insertions, 0 deletions
diff --git a/platform_tools/ios/bin/ios_mkdir b/platform_tools/ios/bin/ios_mkdir
new file mode 100755
index 0000000000..713702b524
--- /dev/null
+++ b/platform_tools/ios/bin/ios_mkdir
@@ -0,0 +1,14 @@
+#!/bin/bash
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+# Create a directory relative to the Documents directory.
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+ios_mkdir $1
diff --git a/platform_tools/ios/bin/ios_mount.sh b/platform_tools/ios/bin/ios_mount.sh
new file mode 100755
index 0000000000..06d23e013f
--- /dev/null
+++ b/platform_tools/ios/bin/ios_mount.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+#
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+ios_install_app
+ios_mount
diff --git a/platform_tools/ios/bin/ios_ninja b/platform_tools/ios/bin/ios_ninja
new file mode 100755
index 0000000000..054f1084e9
--- /dev/null
+++ b/platform_tools/ios/bin/ios_ninja
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+# Build the skia for ios. This assumes that GYP_DEFINES has been set.
+#
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+pushd
+cd ${SKIA_SRC_DIR}
+"${SKIA_SRC_DIR}/gyp_skia"
+xcodebuild -project "$SKIA_SRC_DIR/out/gyp/iOSShell.xcodeproj"\
+ -configuration "$BUILDTYPE"
+popd
diff --git a/platform_tools/ios/bin/ios_path_exists b/platform_tools/ios/bin/ios_path_exists
new file mode 100755
index 0000000000..06794eec3d
--- /dev/null
+++ b/platform_tools/ios/bin/ios_path_exists
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+# Check if ios path exists.
+#
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+if [[ "$#" -ne "1" ]]; then
+ echo "Usage: ios_path_exists <path_in_Documents_folder_of_ios_device>"
+ exit 1
+fi
+
+RET=ios_path_exists $1
+exit $RET
diff --git a/platform_tools/ios/bin/ios_pull.sh b/platform_tools/ios/bin/ios_pull.sh
new file mode 100755
index 0000000000..531fccfaaf
--- /dev/null
+++ b/platform_tools/ios/bin/ios_pull.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+TARGET_DIR=$1
+
+ios_pull "*" "$TARGET_DIR"
+
diff --git a/platform_tools/ios/bin/ios_pull_if_needed b/platform_tools/ios/bin/ios_pull_if_needed
new file mode 100755
index 0000000000..46ad89437e
--- /dev/null
+++ b/platform_tools/ios/bin/ios_pull_if_needed
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+# Pull the given file/directory off the device.
+#
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+HOST_PATH=$1
+DEVICE_PATH=$2
+
+ios_pull $HOST_PATH $DEVICE_PATH
diff --git a/platform_tools/ios/bin/ios_push_file b/platform_tools/ios/bin/ios_push_file
new file mode 100755
index 0000000000..263b7c0a63
--- /dev/null
+++ b/platform_tools/ios/bin/ios_push_file
@@ -0,0 +1,18 @@
+#!/bin/bash
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+
+# Fail-fast if anything in the script fails.
+set -e
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+HOST_PATH=$1
+DEVICE_PATH=$2
+
+ios_push $HOST_PATH $DEVICE_PATH
diff --git a/platform_tools/ios/bin/ios_push_if_needed b/platform_tools/ios/bin/ios_push_if_needed
new file mode 100755
index 0000000000..adb1afe34c
--- /dev/null
+++ b/platform_tools/ios/bin/ios_push_if_needed
@@ -0,0 +1,15 @@
+#!/bin/bash
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+HOST_PATH=$1
+DEVICE_PATH=$2
+
+ios_push $HOST_PATH $DEVICE_PATH
diff --git a/platform_tools/ios/bin/ios_rmdir b/platform_tools/ios/bin/ios_rmdir
new file mode 100755
index 0000000000..127127341d
--- /dev/null
+++ b/platform_tools/ios/bin/ios_rmdir
@@ -0,0 +1,12 @@
+#!/bin/bash
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+ios_rmdir $1
diff --git a/platform_tools/ios/bin/ios_run_skia b/platform_tools/ios/bin/ios_run_skia
new file mode 100755
index 0000000000..bdeaece9d7
--- /dev/null
+++ b/platform_tools/ios/bin/ios_run_skia
@@ -0,0 +1,26 @@
+#!/bin/bash
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+# ios_run_skia: starts the correct skia program on the device, prints the
+# output, and kills the app if interrupted.
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+# (Re-)Install the app to create the necessary directories.
+ios_uninstall_app
+ios_install_app
+
+# Move the resources to the Documents forlder of the iOS device.
+# Note: The iOSShell app expects 'resources' in the Documents folder.
+ios_push "${SKIA_SRC_DIR}/resources" ""
+
+# Run the application.
+ios-deploy -I -m -b "$SKIA_SRC_DIR/xcodebuild/${BUILDTYPE}-iphoneos/iOSShell.app --args '""$ARGS""'"
+
+#ios-deploy -I -m -b "$SKIA_SRC_DIR/xcodebuild/${BUILDTYPE}-iphoneos/iOSShell.app --args '""$ARGS""'-v --writePath results --dm --nogpu --threads 0 --src gm tests --config 8888 --match ~Threaded ~Math ~VarAlloc'
diff --git a/platform_tools/ios/bin/ios_setup.sh b/platform_tools/ios/bin/ios_setup.sh
new file mode 100755
index 0000000000..5df7ac00d2
--- /dev/null
+++ b/platform_tools/ios/bin/ios_setup.sh
@@ -0,0 +1,179 @@
+#!/bin/bash
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+# ios_setup.sh: Sets environment variables used by other iOS scripts.
+
+# File system location where we mount the ios devices.
+IOS_MOUNT_POINT="/tmp/mnt_iosdevice"
+
+# Location on the ios device where all data are stored. This is
+# relative to the mount point.
+IOS_DOCS_DIR="Documents"
+
+# Temporary location to assemble the app into an .ipa package.
+IOS_PCKG_DIR="/tmp/ios_pckg"
+
+# Bundle id of the app that runs the tests.
+TEST_RUNNER_BUNDLE_ID="com.google.iOSShell"
+
+# Directory with the Skia source.
+SKIA_SRC_DIR=$(cd "${SCRIPT_DIR}/../../.."; pwd)
+
+# BuildTYPE is 'Debug' by default.
+BUILDTYPE="Debug"
+
+# Provisioning profile - this needs to be set up on the local machine.
+PROVISIONING_PROFILE="9e88090d-abed-4e89-b106-3eff3512d31f"
+
+# Code Signing identity - this needs to be set up on the local machine.
+CODE_SIGN_IDENTITY="iPhone Developer: Google Development (3F4Y5873JF)"
+
+IOS_BUNDLE_ID="com.google.iOSShell"
+
+IOS_RESULTS_DIR="results"
+
+if [[ $# -ge 1 ]]; then
+ BUILDTYPE=$1
+fi
+
+set -x
+
+ios_uninstall_app() {
+ ideviceinstaller -U "$IOS_BUNDLE_ID"
+}
+
+ios_install_app() {
+ rm -rf $IOS_PCKG_DIR
+ mkdir -p $IOS_PCKG_DIR/Payload # this directory must be named 'Payload'
+ cp -rf "${SKIA_SRC_DIR}/xcodebuild/${BUILDTYPE}-iphoneos/iOSShell.app" "${IOS_PCKG_DIR}/Payload/"
+ local RET_DIR=`pwd`
+ cd $IOS_PCKG_DIR
+ zip -r iOSShell.ipa Payload
+ ideviceinstaller -i ./iOSShell.ipa
+ cd $RET_DIR
+}
+
+ios_rmdir() {
+ local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1"
+
+ ios_mount
+ rm -rf "$TARGET"
+ ios_umount
+}
+
+ios_mkdir() {
+ local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1"
+ ios_mount
+ mkdir -p "$TARGET"
+ ios_umount
+}
+
+# ios_mount: mounts the iOS device for reading or writing.
+ios_mount() {
+ # If this is already mounted we return.
+ if $(mount | grep --quiet "$IOS_MOUNT_POINT"); then
+ echo "Device already mounted at: $IOS_MOUNT_POINT - Unmounting."
+ ios_umount
+ fi
+
+ # Ensure there is a mount directory.
+ if [[ ! -d "$IOS_MOUNT_POINT" ]]; then
+ mkdir -p $IOS_MOUNT_POINT
+ fi
+ ifuse --container $TEST_RUNNER_BUNDLE_ID $IOS_MOUNT_POINT
+ sleep 1
+ echo "Successfully mounted device."
+}
+
+# ios_umount: unmounts the ios device.
+ios_umount() {
+ umount $IOS_MOUNT_POINT
+ sleep 1
+}
+
+# ios_restart: restarts the iOS device.
+ios_restart() {
+ idevicediagnostics restart
+}
+
+# ios_pull(ios_src, host_dst): Copies the content of ios_src to host_dst.
+# The path is relative to the 'Documents' folder on the device.
+ios_pull() {
+ # read input params
+ local IOS_SRC="$1"
+ local HOST_DST="$2"
+
+ ios_mount
+ cp -r $IOS_MOUNT_POINT/$IOS_DOCS_DIR/$IOS_SRC $HOST_DST
+ ios_umount
+}
+
+# ios_push(host_src, ios_dst)
+ios_push() {
+ # read input params
+ local HOST_SRC="$1"
+ local IOS_DST="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$2"
+
+ ios_mount
+ rm -rf $IOS_DST
+ mkdir -p "$(dirname $IOS_DST)"
+ cp -r "$HOST_SRC" "$IOS_DST"
+ ios_umount
+}
+
+ios_path_exists() {
+ local TARGET_PATH="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1"
+ local RET=1
+ ios_mount
+ if [[ -e $TARGET_PATH ]]; then
+ RET=0
+ fi
+ ios_umount
+ return $RET
+}
+
+# ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST`
+# HOST_LS=`ls -ld $HOST_SRC`
+# if [ "${ANDROID_LS:0:1}" == "d" -a "${HOST_LS:0:1}" == "-" ];
+# then
+# ANDROID_DST="${ANDROID_DST}/$(basename ${HOST_SRC})"
+# fi
+
+
+# ANDROID_LS=`$ADB $DEVICE_SERIAL shell ls -ld $ANDROID_DST`
+# if [ "${ANDROID_LS:0:1}" == "-" ]; then
+# #get the MD5 for dst and src
+# ANDROID_MD5=`$ADB $DEVICE_SERIAL shell md5 $ANDROID_DST`
+# if [ $(uname) == "Darwin" ]; then
+# HOST_MD5=`md5 -q $HOST_SRC`
+# else
+# HOST_MD5=`md5sum $HOST_SRC`
+# fi
+
+# if [ "${ANDROID_MD5:0:32}" != "${HOST_MD5:0:32}" ]; then
+# echo -n "$ANDROID_DST "
+# $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST
+# fi
+# elif [ "${ANDROID_LS:0:1}" == "d" ]; then
+# for FILE_ITEM in `ls $HOST_SRC`; do
+# adb_push_if_needed "${HOST_SRC}/${FILE_ITEM}" "${ANDROID_DST}/${FILE_ITEM}"
+# done
+# else
+# HOST_LS=`ls -ld $HOST_SRC`
+# if [ "${HOST_LS:0:1}" == "d" ]; then
+# $ADB $DEVICE_SERIAL shell mkdir -p $ANDROID_DST
+# adb_push_if_needed $HOST_SRC $ANDROID_DST
+# else
+# echo -n "$ANDROID_DST "
+# $ADB $DEVICE_SERIAL shell mkdir -p "$(dirname "$ANDROID_DST")"
+# $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST
+# fi
+# fi
+# }
+
+# setup_device "${DEVICE_ID}"
diff --git a/platform_tools/ios/bin/ios_umount.sh b/platform_tools/ios/bin/ios_umount.sh
new file mode 100755
index 0000000000..07598b073f
--- /dev/null
+++ b/platform_tools/ios/bin/ios_umount.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+#
+###############################################################################
+# Copyright 2015 Google Inc.
+#
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+###############################################################################
+#
+# Mount the ios device.
+#
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+ios_umount