mirror of
https://github.com/golang/go
synced 2024-11-18 08:44:43 -07:00
gopls/integration/govim: improvements/fixes for run_local.sh
With the update to go1.14, run_local.sh runs into the ubuntu mlock issue. Fix this by setting memlock=unlimited. Also make it possible to run docker with sudo, and run -short tests. Change-Id: I8c9e44cd16f0a2a0d77bf28133ad4f111058b5cf Reviewed-on: https://go-review.googlesource.com/c/tools/+/225520 Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
644a21fb14
commit
4c1ea0558e
@ -4,7 +4,7 @@
|
||||
|
||||
# govim requires a more recent version of vim than is available in most
|
||||
# distros, so we build from their base image.
|
||||
FROM govim/govim:go1.14_vim_v8.1.2056_v1
|
||||
FROM govim/govim:latest-vim
|
||||
|
||||
# We use a pinned version of govim so that this build is repeatable, and so
|
||||
# that we're not sensitive to test breakages in govim.
|
||||
|
@ -14,8 +14,7 @@ storage bucket owned by that project.
|
||||
```
|
||||
$ gcloud builds submit \
|
||||
--project="${PROJECT_ID}" \
|
||||
--config=gopls/integration/govim/cloudbuild.harness.yaml \
|
||||
--substitutions=_RESULT_BUCKET="${BUCKET}"
|
||||
--config=gopls/integration/govim/cloudbuild.harness.yaml
|
||||
```
|
||||
- Run the integration tests:
|
||||
```
|
||||
@ -39,7 +38,10 @@ evaluation id.
|
||||
## Running locally
|
||||
|
||||
Run `gopls/integration/govim/run_local.sh`. This may take a while the first
|
||||
time it is run, as it will require building the test harness. Currently this
|
||||
script assumes that docker may be executed without `sudo`.
|
||||
time it is run, as it will require building the test harness. This script
|
||||
accepts two flags to modify its behavior:
|
||||
|
||||
**--sudo**: run docker with `sudo`
|
||||
**--short**: run `go test -short`
|
||||
|
||||
[govim]: https://github.com/govim/govim
|
||||
|
@ -5,8 +5,37 @@
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
# Run govim integration tests against a local gopls.
|
||||
# TODO(findleyr): this script assumes that docker may be run without sudo.
|
||||
# Update it to escalate privileges if and only if necessary.
|
||||
|
||||
usage() {
|
||||
cat <<EOUSAGE
|
||||
Usage: $0 [--sudo] [--short]
|
||||
|
||||
Run govim tests against HEAD using local docker. If --sudo is set, run docker
|
||||
with sudo. If --short is set, run `go test` with `-short`.
|
||||
EOUSAGE
|
||||
}
|
||||
|
||||
SUDO_IF_NEEDED=
|
||||
TEST_SHORT=
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
"-h" | "--help" | "help")
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
"--sudo")
|
||||
SUDO_IF_NEEDED="sudo "
|
||||
shift
|
||||
;;
|
||||
"--short")
|
||||
TEST_SHORT="-short"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
# Find the tools root, so that this script can be run from any directory.
|
||||
script_dir=$(dirname "$(readlink -f "$0")")
|
||||
@ -21,15 +50,16 @@ go build -o "${temp_gopls}"
|
||||
# Build the test harness. Here we are careful to pass in a very limited build
|
||||
# context so as to optimize caching.
|
||||
cd "${tools_dir}"
|
||||
docker build -t gopls-govim-harness -f gopls/integration/govim/Dockerfile \
|
||||
${SUDO_IF_NEEDED}docker build -t gopls-govim-harness -f gopls/integration/govim/Dockerfile \
|
||||
gopls/integration/govim
|
||||
|
||||
# Run govim integration tests.
|
||||
echo "running govim integration tests using ${temp_gopls}"
|
||||
temp_gopls_name=$(basename "${temp_gopls}")
|
||||
docker run --rm -t \
|
||||
${SUDO_IF_NEEDED}docker run --rm -t \
|
||||
-v "${tools_dir}:/src/tools" \
|
||||
-w "/src/govim" \
|
||||
--ulimit memlock=-1:-1 \
|
||||
gopls-govim-harness \
|
||||
go test ./cmd/govim \
|
||||
go test ${TEST_SHORT} ./cmd/govim \
|
||||
-gopls "/src/tools/gopls/${temp_gopls_name}"
|
||||
|
Loading…
Reference in New Issue
Block a user