Text file src/iostest.bash

Documentation: Index

     1#!/usr/bin/env bash
     2# Copyright 2015 The Go Authors. All rights reserved.
     3# Use of this source code is governed by a BSD-style
     4# license that can be found in the LICENSE file.
     5
     6# For testing darwin/arm{,64} on iOS.
     7
     8set -e
     9ulimit -c 0 # no core files
    10
    11if [ ! -f make.bash ]; then
    12	echo 'iostest.bash must be run from $GOROOT/src' 1>&2
    13	exit 1
    14fi
    15
    16if [ -z $GOOS ]; then
    17	export GOOS=darwin
    18fi
    19if [ "$GOOS" != "darwin" ]; then
    20	echo "iostest.bash requires GOOS=darwin, got GOOS=$GOOS" 1>&2
    21	exit 1
    22fi
    23if [ "$GOARCH" != "arm" ] && [ "$GOARCH" != "arm64" ]; then
    24	echo "iostest.bash requires GOARCH=arm or GOARCH=arm64, got GOARCH=$GOARCH" 1>&2
    25	exit 1
    26fi
    27if [ "$GOARCH" = "arm" ]; then
    28	export GOARM=7
    29fi
    30
    31if [ "$1" = "-restart" ]; then
    32	# Reboot to make sure previous runs do not interfere with the current run.
    33	# It is reasonably easy for a bad program leave an iOS device in an
    34	# almost unusable state.
    35	IDEVARGS=
    36	if [ -n "$GOIOS_DEVICE_ID" ]; then
    37		IDEVARGS="-u $GOIOS_DEVICE_ID"
    38	fi
    39	idevicediagnostics $IDEVARGS restart
    40	# Initial sleep to make sure we are restarting before we start polling.
    41	sleep 30
    42	# Poll until the device has restarted.
    43	until idevicediagnostics $IDEVARGS diagnostics; do
    44		# TODO(crawshaw): replace with a test app using go_darwin_arm_exec.
    45		echo "waiting for idevice to come online"
    46		sleep 10
    47	done
    48	# Diagnostics are reported during boot before the device can start an
    49	# app. Wait a little longer before trying to use the device.
    50	sleep 30
    51fi
    52
    53unset GOBIN
    54export GOROOT=$(dirname $(pwd))
    55export PATH=$GOROOT/bin:$PATH
    56export CGO_ENABLED=1
    57export CC_FOR_TARGET=$GOROOT/misc/ios/clangwrap.sh
    58
    59# Run the build for the host bootstrap, so we can build detect.go.
    60# Also lets us fail early before the (slow) ios-deploy if the build is broken.
    61./make.bash
    62
    63if [ "$GOIOS_DEV_ID" = "" ]; then
    64	echo "detecting iOS development identity"
    65	eval $(GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go run ../misc/ios/detect.go)
    66fi
    67
    68# Run standard tests.
    69bash run.bash --no-rebuild

View as plain text