1
0
mirror of https://github.com/golang/go synced 2024-11-19 10:04:56 -07:00
go/src/nacltest.bash
Dave Cheney e6fbce3596 cmd/dist: reactivate vfp detection on linux/arm
Fixes #9732
Fixes #9819

Rather than detecting vfp support via catching SIGILL signals,
parse the contents of /proc/cpuinfo.

As the GOARM values for NaCl and freebsd are hard coded, this parsing
logic only needs to support linux/arm.

This change also fixes the nacl/arm build which is broken because the
first stage of nacltest.bash is executed with GOARM=5, embedding that
into 5g.

The second stage of nacltest.bash correctly detects GOARM=7, but this is
ignored as we pass --no-clean at that point, and thus do not replace
the compiler.

Lastyly, include a fix to error message in nacltest.bash

Change-Id: I13f306ff07a99b44b493fade72ac00d0d5097e1c
Reviewed-on: https://go-review.googlesource.com/3981
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-02-10 00:17:06 +00:00

81 lines
1.9 KiB
Bash
Executable File

#!/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.
#
# Assumes that sel_ldr binaries and go_nacl_$GOARCH_exec scripts are in $PATH;
# see ../misc/nacl/README.
set -e
ulimit -c 0
# 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
# 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
;;
arm)
if ! which sel_ldr_arm >/dev/null; then
echo 'cannot find sel_ldr_arm' 1>&2
exit 1
fi
;;
*)
echo 'unsupported $GOARCH for nacl: '"$naclGOARCH" 1>&2
exit 1
esac
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
# Run host build to get toolchain for running zip generator.
unset GOOS GOARCH
if [ ! -f make.bash ]; then
echo 'nacltest.bash must be run from $GOROOT/src' 1>&2
exit 1
fi
GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH ./make.bash
# the builder might have set GOROOT_FINAL.
export GOROOT=$(pwd)/..
# Build zip file embedded in package syscall.
gobin=${GOBIN:-$(pwd)/../bin}
rm -f syscall/fstest_nacl.go
GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH $gobin/go run ../misc/nacl/mkzip.go -p syscall -r .. ../misc/nacl/testzip.proto syscall/fstest_nacl.go
# Run standard build and tests.
export PATH=$(pwd)/../misc/nacl:$PATH
GOOS=nacl GOARCH=$naclGOARCH ./all.bash --no-clean