2014-05-20 10:10:19 -06:00
|
|
|
#!/bin/bash
|
|
|
|
# Copyright 2014 The Go Authors. All rights reserved.
|
|
|
|
# Use of this source code is governed by a BSD-style
|
|
|
|
# license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
# For testing Native Client on builders or locally.
|
|
|
|
# Builds a test file system and embeds it into package syscall
|
|
|
|
# in every generated binary.
|
|
|
|
#
|
2014-06-10 18:20:49 -06:00
|
|
|
# Assumes that sel_ldr binaries and go_nacl_$GOARCH_exec scripts are in $PATH;
|
|
|
|
# see ../misc/nacl/README.
|
2014-05-20 10:10:19 -06:00
|
|
|
|
|
|
|
set -e
|
|
|
|
ulimit -c 0
|
|
|
|
|
2014-07-10 13:15:41 -06:00
|
|
|
# guess GOARCH if not set
|
|
|
|
naclGOARCH=$GOARCH
|
|
|
|
if [ -z "$naclGOARCH" ]; then
|
|
|
|
case "$(uname -m)" in
|
|
|
|
x86_64)
|
|
|
|
naclGOARCH=amd64p32
|
|
|
|
;;
|
|
|
|
armv7l) # NativeClient on ARM only supports ARMv7A.
|
|
|
|
naclGOARCH=arm
|
|
|
|
;;
|
|
|
|
i?86)
|
|
|
|
naclGOARCH=386
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2014-05-20 10:10:19 -06:00
|
|
|
# Check GOARCH.
|
|
|
|
case "$naclGOARCH" in
|
|
|
|
amd64p32)
|
|
|
|
if ! which sel_ldr_x86_64 >/dev/null; then
|
|
|
|
echo 'cannot find sel_ldr_x86_64' 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
386)
|
|
|
|
if ! which sel_ldr_x86_32 >/dev/null; then
|
|
|
|
echo 'cannot find sel_ldr_x86_32' 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
2014-07-10 13:15:41 -06:00
|
|
|
arm)
|
|
|
|
if ! which sel_ldr_arm >/dev/null; then
|
|
|
|
echo 'cannot find sel_ldr_arm' 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
;;
|
2014-05-20 10:10:19 -06:00
|
|
|
*)
|
|
|
|
echo 'unsupported $GOARCH for nacl: '"$naclGOARCH" 1>&2
|
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
|
2014-06-10 18:20:49 -06:00
|
|
|
if ! which go_nacl_${naclGOARCH}_exec >/dev/null; then
|
|
|
|
echo "cannot find go_nacl_${naclGOARCH}_exec, see ../misc/nacl/README." 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-05-20 10:10:19 -06:00
|
|
|
unset GOOS GOARCH
|
|
|
|
if [ ! -f make.bash ]; then
|
2015-02-05 17:44:09 -07:00
|
|
|
echo 'nacltest.bash must be run from $GOROOT/src' 1>&2
|
2014-05-20 10:10:19 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-07-10 13:36:48 -06:00
|
|
|
# the builder might have set GOROOT_FINAL.
|
|
|
|
export GOROOT=$(pwd)/..
|
|
|
|
|
2014-05-20 10:10:19 -06:00
|
|
|
# Build zip file embedded in package syscall.
|
2015-03-24 00:23:22 -06:00
|
|
|
echo "##### Building fake file system zip for nacl"
|
2014-09-07 22:22:40 -06:00
|
|
|
rm -f syscall/fstest_nacl.go
|
2015-03-24 00:23:22 -06:00
|
|
|
GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
|
|
|
|
gobin=$GOROOT_BOOTSTRAP/bin
|
|
|
|
GOROOT=$GOROOT_BOOTSTRAP $gobin/go run ../misc/nacl/mkzip.go -p syscall -r .. ../misc/nacl/testzip.proto syscall/fstest_nacl.go
|
2014-05-20 10:10:19 -06:00
|
|
|
|
|
|
|
# Run standard build and tests.
|
|
|
|
export PATH=$(pwd)/../misc/nacl:$PATH
|
2015-03-24 00:23:22 -06:00
|
|
|
GOOS=nacl GOARCH=$naclGOARCH ./all.bash
|
2015-05-01 19:56:28 -06:00
|
|
|
|
|
|
|
rm -f syscall/fstest_nacl.go
|