diff options
author | George Burgess IV <gbiv@google.com> | 2024-05-01 15:45:35 -0600 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2024-05-06 14:44:12 +0000 |
commit | d234c9dc27b23d86c2af783a549ef3918e011548 (patch) | |
tree | 4307830eb2820f73edfbe2a3dce183e55d1bcbb8 | |
parent | ad94e5d073310ce3a439acafec4e0af133abad94 (diff) | |
download | toolchain-utils-d234c9dc27b23d86c2af783a549ef3918e011548.tar.gz |
go: remove old go building scripts
These scripts seem to have been used for building/running Go on
localhost or target devices. Go now has very well-fleshed-out stories
for both of these things, so these are almost certainly not needed.
BUG=b:337837895
TEST=None
Change-Id: I370bde001891a513d9462d5664a82eacb20e18cd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/5507040
Commit-Queue: George Burgess <gbiv@chromium.org>
Tested-by: George Burgess <gbiv@chromium.org>
Reviewed-by: Bob Haarman <inglorion@chromium.org>
-rwxr-xr-x | go/go_local | 8 | ||||
-rwxr-xr-x | go/go_target | 67 | ||||
-rwxr-xr-x | go/go_target_exec | 41 | ||||
-rwxr-xr-x | go/push_goroot | 29 | ||||
-rwxr-xr-x | go/test_go | 81 |
5 files changed, 0 insertions, 226 deletions
diff --git a/go/go_local b/go/go_local deleted file mode 100755 index cb2a4dc1..00000000 --- a/go/go_local +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# Invoke the Go compiler for localhost. - -GOOS="linux" GOARCH="amd64" CGO_ENABLED="1" \ - CC="clang" \ - CXX="clang++" \ - exec go "$@" diff --git a/go/go_target b/go/go_target deleted file mode 100755 index 8943d813..00000000 --- a/go/go_target +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/bash -set -e -o pipefail - -# This script wraps the go cross compilers. -# -# It ensures that Go binaries are linked with an external linker -# by default (cross clang). Appropriate flags are added to build a -# position independent executable (PIE) for ASLR. -# "export GOPIE=0" to temporarily disable this behavior. - -function pie_enabled() - { - [[ "${GOPIE}" != "0" ]] - } - -function has_ldflags() - { - # Check if any linker flags are present in argv. - for arg in "$@" - do - case "${arg}" in - -ldflags | -ldflags=*) return 0 ;; - -linkmode | -linkmode=*) return 0 ;; - -buildmode | -buildmode=*) return 0 ;; - -installsuffix | -installsuffix=*) return 0 ;; - -extld | -extld=*) return 0 ;; - -extldflags | -extldflags=*) return 0 ;; - esac - done - return 1 - } - -pie_flags=() -if pie_enabled && ! has_ldflags "$@" -then - case "$1" in - build | install | run | test) - # Add "-buildmode=pie" to "go build|install|run|test" commands. - pie_flags=( "$1" ) - shift - [[ "${GOOS}" == "android" ]] || pie_flags+=( "-buildmode=pie" ) - ;; - tool) - case "$2" in - asm) - # Handle direct assembler invocations ("go tool asm <args>"). - pie_flags=( "$1" "$2" "-shared" ) - shift 2 - ;; - compile) - # Handle direct compiler invocations ("go tool compile <args>"). - pie_flags=( "$1" "$2" "-shared" ) - shift 2 - [[ "${GOOS}" == "android" ]] || pie_flags+=( "-installsuffix=shared" ) - ;; - link) - # Handle direct linker invocations ("go tool link <args>"). - pie_flags=( "$1" "$2" "-extld" "${CC}" "-buildmode=pie" ) - shift 2 - [[ "${GOOS}" == "android" ]] || pie_flags+=( "-installsuffix=shared" ) - ;; - esac - ;; - esac -fi - -exec go "${pie_flags[@]}" "$@" diff --git a/go/go_target_exec b/go/go_target_exec deleted file mode 100755 index 0a44b4cf..00000000 --- a/go/go_target_exec +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash -set -e -o pipefail - -# This wrapper copies an executable to a target device and executes it there. -# -# Usage: go_target_exec <target> <binary> <args>... -# -# This script can work with both ChromeOS/Android devices. -# -# It uses "target_tmpdir" to get the path to the temporary directory on the device. -# It uses "target_cp" to copy the binary to the temporary directory on the device. -# It uses "target_sh" to execute the binary remotely and get the output/exitcode. - -target="$1" -shift - -binary="$1" -shift - -# Get path to temporary directory on device and copy the binary over. -tmpdir="$(target_tmpdir)" -target_cp ${binary} ${target}:${tmpdir}/a.out - -# If current directory is inside GOROOT, then execute the binary in the -# corresponding directory inside GOROOT on the device. -targetdir="${tmpdir}" -goroot="$(go_${target} env GOROOT)" -if [[ "${PWD}" == ${goroot}/src/* ]] -then - targetdir="${tmpdir}/goroot/src/${PWD#${goroot}/src/}" -fi - -# Set GOROOT, and forward some environment variables to the remote shell. -vars="GOROOT=${tmpdir}/goroot" -vars+="${GOOS:+ GOOS=${GOOS}}" -vars+="${GOARCH:+ GOARCH=${GOARCH}}" -vars+="${GOMAXPROCS:+ GOMAXPROCS=${GOMAXPROCS}}" -vars+="${GOTRACEBACK:+ GOTRACEBACK=${GOTRACEBACK}}" - -# Remotely execute the binary using ssh (for ChromeOS) or adb (for Android). -target_sh ${target} "cd ${targetdir} && ${vars} ${GOLOADER} ${tmpdir}/a.out $*" diff --git a/go/push_goroot b/go/push_goroot deleted file mode 100755 index 0d7706e1..00000000 --- a/go/push_goroot +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set -e -o pipefail - -# This script copies a locally built GOROOT to a remote device. -# -# Usage: push_goroot <target>... -# -# This script can work with both ChromeOS/Android devices. -# -# It uses "target_tmpdir" to figure out where to copy GOROOT on the device. -# It uses "target_sh" to remotely execute commands on the device. -# It uses "target_cp" to transfer files to the device. - -goroot="$(target_tmpdir)/goroot" -for target in "$@" -do - echo -n "pushing goroot to ${target} ... " - target_sh ${target} "rm -rf ${goroot}" - target_sh ${target} "mkdir -p ${goroot}/pkg" - - cd "$(go_${target} env GOROOT)" - pkgdir="pkg/$(go_${target} env GOOS)_$(go_${target} env GOARCH)" - target_cp "${pkgdir}" ${target}:${goroot}/pkg - - target_cp "src" ${target}:${goroot} - target_cp "lib" ${target}:${goroot} - [[ -d test ]] && target_cp "test" ${target}:${goroot} - echo "done" -done diff --git a/go/test_go b/go/test_go deleted file mode 100755 index 548712f5..00000000 --- a/go/test_go +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash - -# This script runs tests for the Go toolchain on target devices. -# It can be used for both ChromeOS and Android targets. -# -# Many of the test drivers that come from upstream do not support -# cross-compiling and running the tests remotely. The patches in -# the ./patch/ directory must be applied to the upstream sources -# to add this support. -# -# Usage: test_go [-v] [-vv] [-full] <target>... -# -v: enable verbose test output from compiler tests. -# -v: enable verbose test output from standard library tests. -# -full: run all standard library tests (without the -short flag). - -verbose_run_test="" -verbose_go_test="" -testflags="-short" -while [[ "$1" == -* ]] -do - case "$1" in - -v) verbose_run_test="-v" ;; - -vv) verbose_go_test="-v" ;; - -full) testflags="-timeout=2h" ;; - *) echo "unrecognized flag: $1" ;; - esac - shift -done - -go_local build -o runtest test/run.go -runtest="${PWD}/runtest" - -function run_test() - { - GOOS="$(go_${target} env GOOS)" GOARCH="$(go_${target} env GOARCH)" ${runtest} -n=1 ${verbose_run_test} -show_skips -summary -target="${target}" "$@" - } - -function go_test() - { - go_${target} test -p=1 ${verbose_go_test} -exec="go_${target}_exec" ${testflags} "$@" - } - -function go_test_target() - { - go_local test -p=1 ${verbose_go_test} ${testflags} "$@" -target="${target}" - } - -for target in "$@" -do - echo - echo "## ${target}" - push_goroot ${target} - - echo - echo "# test" - (cd test && run_test) - - echo - echo "# std" - go_test std - - echo - echo "# GOMAXPROCS=2 -cpu=1,2,4 runtime" - GOMAXPROCS=2 go_test -cpu=1,2,4 runtime - - echo - echo "# -cpu=10 sync" - go_test -cpu=10 sync - - echo - echo "# runtime crypto/x509 -target=${target}" - go_test_target runtime crypto/x509 - - echo - echo "# misc/cgo/{stdio,life}" - run_test misc/cgo/{stdio,life} - - echo - echo "# misc/cgo/{test,testtls,nocgo}" - GOTRACEBACK=2 go_test ./misc/cgo/{test,testtls,nocgo} -done |