golang.org/x/tools/gopls@v0.15.3/integration/govim/run_tests_for_cloudbuild.sh (about)

     1  #!/bin/bash
     2  
     3  # Copyright 2020 The Go Authors. All rights reserved.
     4  # Use of this source code is governed by a BSD-style
     5  # license that can be found in the LICENSE file.
     6  
     7  # This script runs govim integration tests but always succeeds, instead writing
     8  # their result to a file so that any test failure can be deferred to a later
     9  # build step. We do this so that we can capture govim test artifacts regardless
    10  # of the test results.
    11  
    12  # Substitute the locally built gopls binary for use in govim integration tests.
    13  go test -short ./cmd/govim -gopls /workspace/gopls/gopls
    14  
    15  # Stash the error, for use in a later build step.
    16  echo "exit $?" > /workspace/govim_test_result.sh
    17  
    18  # Clean up unnecessary artifacts. This is based on govim/_scripts/tidyUp.bash.
    19  # Since we're fetching govim using the go command, we won't have this non-go
    20  # source directory available to us.
    21  if [[ -n "$GOVIM_TESTSCRIPT_WORKDIR_ROOT" ]]; then
    22    echo "Cleaning up build artifacts..."
    23    # Make artifacts writable so that rm -rf doesn't complain.
    24    chmod -R u+w "$GOVIM_TESTSCRIPT_WORKDIR_ROOT"
    25  
    26    # Remove directories we don't care about.
    27    find "$GOVIM_TESTSCRIPT_WORKDIR_ROOT" -type d \( -name .vim -o -name gopath \) -prune -exec rm -rf '{}' \;
    28  fi