aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/ios
diff options
context:
space:
mode:
authorGravatar stephana <stephana@chromium.org>2015-05-05 07:55:06 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-05 07:55:06 -0700
commitdeee2980f41cb9586bb7a596cf99d25775f7c698 (patch)
treecb90d17de32a90fb473aec5fdbbb71c82d1f5b4a /platform_tools/ios
parent7d3bdc3aa53ef953318db2611c51e0eef4ee4214 (diff)
cleanup
Diffstat (limited to 'platform_tools/ios')
-rwxr-xr-xplatform_tools/ios/bin/ios_cat_file21
-rwxr-xr-xplatform_tools/ios/bin/ios_install (renamed from platform_tools/ios/bin/ios_mount.sh)8
-rwxr-xr-xplatform_tools/ios/bin/ios_mkdir2
-rwxr-xr-xplatform_tools/ios/bin/ios_mount (renamed from platform_tools/ios/bin/ios_umount.sh)9
-rwxr-xr-xplatform_tools/ios/bin/ios_ninja10
-rwxr-xr-xplatform_tools/ios/bin/ios_path_exists11
-rwxr-xr-xplatform_tools/ios/bin/ios_pull_if_needed10
-rwxr-xr-xplatform_tools/ios/bin/ios_push_file7
-rwxr-xr-xplatform_tools/ios/bin/ios_push_if_needed7
-rwxr-xr-xplatform_tools/ios/bin/ios_rm (renamed from platform_tools/ios/bin/ios_pull.sh)11
-rwxr-xr-xplatform_tools/ios/bin/ios_run_skia18
-rwxr-xr-xplatform_tools/ios/bin/ios_setup.sh86
-rwxr-xr-xplatform_tools/ios/bin/ios_umount (renamed from platform_tools/ios/bin/ios_rmdir)7
13 files changed, 130 insertions, 77 deletions
diff --git a/platform_tools/ios/bin/ios_cat_file b/platform_tools/ios/bin/ios_cat_file
new file mode 100755
index 0000000000..2e712ca961
--- /dev/null
+++ b/platform_tools/ios/bin/ios_cat_file
@@ -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.
+###############################################################################
+#
+# Writes the content of the file identified by the first argument to standard
+# output. The path is relative to the Documents directory of the installed app.
+#
+
+# Do not set -x here, since we only want the content of the file sent to
+# standard out.
+set -e
+
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+
+ios_cat $1
diff --git a/platform_tools/ios/bin/ios_mount.sh b/platform_tools/ios/bin/ios_install
index 06d23e013f..7dfe3b66de 100755
--- a/platform_tools/ios/bin/ios_mount.sh
+++ b/platform_tools/ios/bin/ios_install
@@ -7,8 +7,12 @@
# found in the LICENSE file.
###############################################################################
#
+# Installs the app on the device.
+#
+
+set -e -x
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-source $SCRIPT_DIR/ios_setup.sh
+source $SCRIPT_DIR/ios_setup.sh
ios_install_app
-ios_mount
diff --git a/platform_tools/ios/bin/ios_mkdir b/platform_tools/ios/bin/ios_mkdir
index 713702b524..9bc50944d1 100755
--- a/platform_tools/ios/bin/ios_mkdir
+++ b/platform_tools/ios/bin/ios_mkdir
@@ -7,6 +7,8 @@
###############################################################################
#
# Create a directory relative to the Documents directory.
+#
+set -e -x
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/ios_setup.sh
diff --git a/platform_tools/ios/bin/ios_umount.sh b/platform_tools/ios/bin/ios_mount
index 07598b073f..d71e32df0e 100755
--- a/platform_tools/ios/bin/ios_umount.sh
+++ b/platform_tools/ios/bin/ios_mount
@@ -7,9 +7,12 @@
# found in the LICENSE file.
###############################################################################
#
-# Mount the ios device.
+# Mounts the iOS device locally. See the value of IOS_MOUNT_POINT in
+# ios_setup.sh for the exact location.
#
+set -x -e
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-source $SCRIPT_DIR/ios_setup.sh
+source $SCRIPT_DIR/ios_setup.sh
-ios_umount
+ios_mount
diff --git a/platform_tools/ios/bin/ios_ninja b/platform_tools/ios/bin/ios_ninja
index 054f1084e9..55f30bb0f3 100755
--- a/platform_tools/ios/bin/ios_ninja
+++ b/platform_tools/ios/bin/ios_ninja
@@ -7,14 +7,16 @@
# found in the LICENSE file.
###############################################################################
#
-# Build the skia for ios. This assumes that GYP_DEFINES has been set.
+# Build the skia for ios. This assumes that GYP_DEFINES has been set.
#
+set -x -e
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/ios_setup.sh
-pushd
-cd ${SKIA_SRC_DIR}
+OLD_DIR=`pwd`
+cd ${SKIA_SRC_DIR}
"${SKIA_SRC_DIR}/gyp_skia"
xcodebuild -project "$SKIA_SRC_DIR/out/gyp/iOSShell.xcodeproj"\
-configuration "$BUILDTYPE"
-popd
+cd $OLD_DIR
diff --git a/platform_tools/ios/bin/ios_path_exists b/platform_tools/ios/bin/ios_path_exists
index 06794eec3d..42a4f7ef5f 100755
--- a/platform_tools/ios/bin/ios_path_exists
+++ b/platform_tools/ios/bin/ios_path_exists
@@ -6,16 +6,19 @@
# 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.
#
+# Check if ios path exists.
+#
+
+set -x -e
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/ios_setup.sh
-if [[ "$#" -ne "1" ]]; then
+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
+exit $RET
diff --git a/platform_tools/ios/bin/ios_pull_if_needed b/platform_tools/ios/bin/ios_pull_if_needed
index 46ad89437e..25edfd9732 100755
--- a/platform_tools/ios/bin/ios_pull_if_needed
+++ b/platform_tools/ios/bin/ios_pull_if_needed
@@ -7,12 +7,14 @@
# found in the LICENSE file.
###############################################################################
#
-# Pull the given file/directory off the device.
+# Pull the given file/directory off the device.
#
+set -x -e
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/ios_setup.sh
-HOST_PATH=$1
-DEVICE_PATH=$2
+DEVICE_PATH=$1
+HOST_PATH=$2
-ios_pull $HOST_PATH $DEVICE_PATH
+ios_pull $DEVICE_PATH $HOST_PATH
diff --git a/platform_tools/ios/bin/ios_push_file b/platform_tools/ios/bin/ios_push_file
index 263b7c0a63..504f0ccb0a 100755
--- a/platform_tools/ios/bin/ios_push_file
+++ b/platform_tools/ios/bin/ios_push_file
@@ -5,9 +5,10 @@
# 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
+#
+# Copies a single file from the host to the device.
+#
+set -x -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/ios_setup.sh
diff --git a/platform_tools/ios/bin/ios_push_if_needed b/platform_tools/ios/bin/ios_push_if_needed
index adb1afe34c..11b9dfa767 100755
--- a/platform_tools/ios/bin/ios_push_if_needed
+++ b/platform_tools/ios/bin/ios_push_if_needed
@@ -5,6 +5,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
###############################################################################
+#
+# Copies the files identified by the first argument from the host to the target
+# path on the device. The path on the devide is relative to the Documents
+# directory.
+#
+
+set -x -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/ios_setup.sh
diff --git a/platform_tools/ios/bin/ios_pull.sh b/platform_tools/ios/bin/ios_rm
index 531fccfaaf..1d606fcd89 100755
--- a/platform_tools/ios/bin/ios_pull.sh
+++ b/platform_tools/ios/bin/ios_rm
@@ -1,5 +1,4 @@
#!/bin/bash
-#
###############################################################################
# Copyright 2015 Google Inc.
#
@@ -7,10 +6,12 @@
# found in the LICENSE file.
###############################################################################
#
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-source $SCRIPT_DIR/ios_setup.sh
+# Removes the path identified by the first argument from the directory.
+#
-TARGET_DIR=$1
+set -x -e
-ios_pull "*" "$TARGET_DIR"
+SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $SCRIPT_DIR/ios_setup.sh
+ios_rm $1
diff --git a/platform_tools/ios/bin/ios_run_skia b/platform_tools/ios/bin/ios_run_skia
index bdeaece9d7..248593a66e 100755
--- a/platform_tools/ios/bin/ios_run_skia
+++ b/platform_tools/ios/bin/ios_run_skia
@@ -9,18 +9,12 @@
# ios_run_skia: starts the correct skia program on the device, prints the
# output, and kills the app if interrupted.
+set -x -e
+
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'
+# Run the application.
+IOS_DEPLOY_ARGS="${SKIA_SRC_DIR}/xcodebuild/${BUILDTYPE}-iphoneos/iOSShell.app --args \"${*}\""
+CMD="ios-deploy -I -m -b ${IOS_DEPLOY_ARGS}"
+eval $CMD
diff --git a/platform_tools/ios/bin/ios_setup.sh b/platform_tools/ios/bin/ios_setup.sh
index 5df7ac00d2..7b42e21c52 100755
--- a/platform_tools/ios/bin/ios_setup.sh
+++ b/platform_tools/ios/bin/ios_setup.sh
@@ -8,47 +8,43 @@
#
# ios_setup.sh: Sets environment variables used by other iOS scripts.
-# File system location where we mount the ios devices.
+# 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.
+# 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.
+# 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.
+# Bundle id of the app that runs the tests.
TEST_RUNNER_BUNDLE_ID="com.google.iOSShell"
-# Directory with the Skia source.
+# 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 - 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 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
+# BUILDTYPE is 'Debug' by default.
+if [[ -z "$BUILDTYPE" ]]; then
+ BUILDTYPE="Debug"
fi
-set -x
-
ios_uninstall_app() {
ideviceinstaller -U "$IOS_BUNDLE_ID"
}
ios_install_app() {
- rm -rf $IOS_PCKG_DIR
+ 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`
@@ -58,12 +54,12 @@ ios_install_app() {
cd $RET_DIR
}
-ios_rmdir() {
+ios_rm() {
local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1"
- ios_mount
+ ios_mount
rm -rf "$TARGET"
- ios_umount
+ ios_umount
}
ios_mkdir() {
@@ -73,43 +69,55 @@ ios_mkdir() {
ios_umount
}
-# ios_mount: mounts the iOS device for reading or writing.
+ios_cat() {
+ local TARGET="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1"
+ ios_mount
+ RET="$(cat $TARGET)"
+ ios_umount
+ echo -e "$RET"
+}
+
+# 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."
+ # If this is already mounted we unmount it.
+ if $(mount | grep --quiet "$IOS_MOUNT_POINT"); then
+ >&2 echo "Device already mounted at: $IOS_MOUNT_POINT - Unmounting."
ios_umount
fi
- # Ensure there is a mount directory.
- if [[ ! -d "$IOS_MOUNT_POINT" ]]; then
+ # Ensure there is a mount directory.
+ if [[ ! -d "$IOS_MOUNT_POINT" ]]; then
mkdir -p $IOS_MOUNT_POINT
- fi
+ fi
ifuse --container $TEST_RUNNER_BUNDLE_ID $IOS_MOUNT_POINT
sleep 1
- echo "Successfully mounted device."
+ >&2 echo "Successfully mounted device."
}
-# ios_umount: unmounts the ios device.
+# ios_umount: unmounts the ios device.
ios_umount() {
- umount $IOS_MOUNT_POINT
+ umount $IOS_MOUNT_POINT
sleep 1
}
-# ios_restart: restarts the iOS device.
+# 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(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 IOS_SRC="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1"
local HOST_DST="$2"
ios_mount
- cp -r $IOS_MOUNT_POINT/$IOS_DOCS_DIR/$IOS_SRC $HOST_DST
+ if [[ -d "${HOST_DST}" ]]; then
+ cp -r "$IOS_SRC/" "$HOST_DST"
+ else
+ cp -r "$IOS_SRC" "$HOST_DST"
+ fi
ios_umount
}
@@ -118,9 +126,9 @@ 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
+ rm -rf $IOS_DST
mkdir -p "$(dirname $IOS_DST)"
cp -r "$HOST_SRC" "$IOS_DST"
ios_umount
@@ -128,11 +136,11 @@ ios_push() {
ios_path_exists() {
local TARGET_PATH="$IOS_MOUNT_POINT/$IOS_DOCS_DIR/$1"
- local RET=1
+ local RET=1
ios_mount
- if [[ -e $TARGET_PATH ]]; then
+ if [[ -e $TARGET_PATH ]]; then
RET=0
- fi
+ fi
ios_umount
return $RET
}
diff --git a/platform_tools/ios/bin/ios_rmdir b/platform_tools/ios/bin/ios_umount
index 127127341d..ddc477c1fb 100755
--- a/platform_tools/ios/bin/ios_rmdir
+++ b/platform_tools/ios/bin/ios_umount
@@ -1,12 +1,17 @@
#!/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.
+#
+set -x -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $SCRIPT_DIR/ios_setup.sh
-ios_rmdir $1
+ios_umount