Black Lives Matter. Support the Equal Justice Initiative.

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/arm64 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" != "arm64" ]; then
    24	echo "iostest.bash requires GOARCH=arm64, got GOARCH=$GOARCH" 1>&2
    25	exit 1
    26fi
    27
    28if [ "$1" = "-restart" ]; then
    29	# Reboot to make sure previous runs do not interfere with the current run.
    30	# It is reasonably easy for a bad program leave an iOS device in an
    31	# almost unusable state.
    32	IDEVARGS=
    33	if [ -n "$GOIOS_DEVICE_ID" ]; then
    34		IDEVARGS="-u $GOIOS_DEVICE_ID"
    35	fi
    36	idevicediagnostics $IDEVARGS restart
    37	# Initial sleep to make sure we are restarting before we start polling.
    38	sleep 30
    39	# Poll until the device has restarted.
    40	until idevicediagnostics $IDEVARGS diagnostics; do
    41		# TODO(crawshaw): replace with a test app using go_darwin_arm_exec.
    42		echo "waiting for idevice to come online"
    43		sleep 10
    44	done
    45	# Diagnostics are reported during boot before the device can start an
    46	# app. Wait a little longer before trying to use the device.
    47	sleep 30
    48fi
    49
    50unset GOBIN
    51export GOROOT=$(dirname $(pwd))
    52export PATH=$GOROOT/bin:$PATH
    53export CGO_ENABLED=1
    54export CC_FOR_TARGET=$GOROOT/misc/ios/clangwrap.sh
    55
    56# Run the build for the host bootstrap, so we can build detect.go.
    57# Also lets us fail early before the (slow) ios-deploy if the build is broken.
    58./make.bash
    59
    60if [ "$GOIOS_DEV_ID" = "" ]; then
    61	echo "detecting iOS development identity"
    62	eval $(GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH go run ../misc/ios/detect.go)
    63fi
    64
    65# Run standard tests.
    66bash run.bash --no-rebuild

View as plain text