From 2932fb937a550cf72a1d1a5220eb0c81bb74b042 Mon Sep 17 00:00:00 2001 From: Matt Moore Date: Thu, 19 Mar 2020 13:55:07 -0700 Subject: [PATCH] [release-0.13] Auto-update dependencies (#146) Produced via: `./hack/update-deps.sh --upgrade && ./hack/update-codegen.sh` /assign houshengbo k4leung4 /cc houshengbo k4leung4 --- Gopkg.lock | 4 +- .../knative.dev/test-infra/scripts/README.md | 5 +- .../knative.dev/test-infra/scripts/library.sh | 7 +++ .../test-infra/scripts/presubmit-tests.sh | 61 ++++++++++--------- 4 files changed, 45 insertions(+), 32 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index b8ac7250..b799e083 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1293,14 +1293,14 @@ [[projects]] branch = "master" - digest = "1:e5bd21467544cbd14cb25553c5c78eb2e0e93baf9288a3c2ebaf1cf1fdb0c95f" + digest = "1:3f2366ce9a05503ac8da902b58e898c285cc9a972e0e89fda0b2a2fedcd4fb46" name = "knative.dev/test-infra" packages = [ "scripts", "tools/dep-collector", ] pruneopts = "UT" - revision = "2104794c86f5029ce8720d5afc79fc1a330ce2f5" + revision = "64929018c86389e47a88782619565b6d099c0a5a" [[projects]] digest = "1:5fdf0517a870044f13def5f9f2dc75eb8cfb88baf7862eaf9884a06152f9391b" diff --git a/vendor/knative.dev/test-infra/scripts/README.md b/vendor/knative.dev/test-infra/scripts/README.md index ca673fb1..32e17ac1 100644 --- a/vendor/knative.dev/test-infra/scripts/README.md +++ b/vendor/knative.dev/test-infra/scripts/README.md @@ -70,10 +70,11 @@ integration tests). Use the flags `--build-tests`, `--unit-tests` and `--integration-tests` to run a specific set of tests. -To run a specific program as a test, use the `--run-test` flag, and provide the +To run specific programs as a test, use the `--run-test` flag, and provide the program as the argument. If arguments are required for the program, pass everything as a single quotes argument. For example, -`./presubmit-tests.sh --run-test "test/my/test data"`. +`./presubmit-tests.sh --run-test "test/my/test data"`. This flag can be used +repeatedly, and each one will be ran in sequential order. The script will automatically skip all presubmit tests for PRs where all changed files are exempt of tests (e.g., a PR changing only the `OWNERS` file). diff --git a/vendor/knative.dev/test-infra/scripts/library.sh b/vendor/knative.dev/test-infra/scripts/library.sh index d2715650..3d227571 100755 --- a/vendor/knative.dev/test-infra/scripts/library.sh +++ b/vendor/knative.dev/test-infra/scripts/library.sh @@ -327,6 +327,13 @@ function capture_output() { return ${failed} } +# Print failed step, which could be highlighted by spyglass. +# Parameters: $1...n - description of step that failed +function step_failed() { + local spyglass_token="Step failed:" + echo "${spyglass_token} $@" +} + # Create a temporary file with the given extension in a way that works on both Linux and macOS. # Parameters: $1 - file name without extension (e.g. 'myfile_XXXX') # $2 - file extension (e.g. 'xml') diff --git a/vendor/knative.dev/test-infra/scripts/presubmit-tests.sh b/vendor/knative.dev/test-infra/scripts/presubmit-tests.sh index c14f2517..11b09a68 100755 --- a/vendor/knative.dev/test-infra/scripts/presubmit-tests.sh +++ b/vendor/knative.dev/test-infra/scripts/presubmit-tests.sh @@ -93,19 +93,19 @@ function run_build_tests() { local failed=0 # Run pre-build tests, if any if function_exists pre_build_tests; then - pre_build_tests || failed=1 + pre_build_tests || { failed=1; step_failed "pre_build_tests"; } fi # Don't run build tests if pre-build tests failed if (( ! failed )); then if function_exists build_tests; then - build_tests || failed=1 + build_tests || { failed=1; step_failed "build_tests"; } else - default_build_test_runner || failed=1 + default_build_test_runner || { failed=1; step_failed "default_build_test_runner"; } fi fi # Don't run post-build tests if pre/build tests failed if (( ! failed )) && function_exists post_build_tests; then - post_build_tests || failed=1 + post_build_tests || { failed=1; step_failed "post_build_tests"; } fi results_banner "Build" ${failed} return ${failed} @@ -147,14 +147,20 @@ function markdown_build_tests() { # Default build test runner that: # * check markdown files -# * `go build` on the entire repo # * run `/hack/verify-codegen.sh` (if it exists) +# * `go build` on the entire repo # * check licenses in all go packages function default_build_test_runner() { local failed=0 - # Perform markdown build checks first + # Perform markdown build checks markdown_build_tests || failed=1 - # For documentation PRs, just check the md files + # Run verify-codegen check + if [[ -f ./hack/verify-codegen.sh ]]; then + subheader "Checking autogenerated code is up-to-date" + report_build_test Verify_CodeGen ./hack/verify-codegen.sh || failed=1 + fi + # For documentation PRs, just check the md files and run + # verify-codegen (as md files can be auto-generated in some repos). (( IS_DOCUMENTATION_PR )) && return ${failed} # Don't merge these two lines, or return code will always be 0. local go_pkg_dirs @@ -186,13 +192,9 @@ function default_build_test_runner() { # Remove unused generated binary, if any. rm -f e2e.test done - + local errors_go="$(echo -e "${errors_go1}\n${errors_go2}" | uniq)" create_junit_xml _build_tests Build_Go "${errors_go}" - if [[ -f ./hack/verify-codegen.sh ]]; then - subheader "Checking autogenerated code is up-to-date" - report_build_test Verify_CodeGen ./hack/verify-codegen.sh || failed=1 - fi # Check that we don't have any forbidden licenses in our images. subheader "Checking for forbidden licenses" report_build_test Check_Licenses check_licenses ${go_pkg_dirs} || failed=1 @@ -211,19 +213,19 @@ function run_unit_tests() { local failed=0 # Run pre-unit tests, if any if function_exists pre_unit_tests; then - pre_unit_tests || failed=1 + pre_unit_tests || { failed=1; step_failed "pre_unit_tests"; } fi # Don't run unit tests if pre-unit tests failed if (( ! failed )); then if function_exists unit_tests; then - unit_tests || failed=1 + unit_tests || { failed=1; step_failed "unit_tests"; } else - default_unit_test_runner || failed=1 + default_unit_test_runner || { failed=1; step_failed "default_unit_test_runner"; } fi fi # Don't run post-unit tests if pre/unit tests failed if (( ! failed )) && function_exists post_unit_tests; then - post_unit_tests || failed=1 + post_unit_tests || { failed=1; step_failed "post_unit_tests"; } fi results_banner "Unit" ${failed} return ${failed} @@ -247,19 +249,19 @@ function run_integration_tests() { local failed=0 # Run pre-integration tests, if any if function_exists pre_integration_tests; then - pre_integration_tests || failed=1 + pre_integration_tests || { failed=1; step_failed "pre_integration_tests"; } fi # Don't run integration tests if pre-integration tests failed if (( ! failed )); then if function_exists integration_tests; then - integration_tests || failed=1 + integration_tests || { failed=1; step_failed "integration_tests"; } else - default_integration_test_runner || failed=1 + default_integration_test_runner || { failed=1; step_failed "default_integration_test_runner"; } fi fi # Don't run integration tests if pre/integration tests failed if (( ! failed )) && function_exists post_integration_tests; then - post_integration_tests || failed=1 + post_integration_tests || { failed=1; step_failed "post_integration_tests"; } fi results_banner "Integration" ${failed} return ${failed} @@ -273,6 +275,7 @@ function default_integration_test_runner() { echo "Running integration test ${e2e_test}" if ! ${e2e_test} ${options}; then failed=1 + step_failed "${e2e_test} ${options}" fi done return ${failed} @@ -325,7 +328,7 @@ function main() { [[ -z $1 ]] && set -- "--all-tests" - local TEST_TO_RUN="" + local TESTS_TO_RUN=() while [[ $# -ne 0 ]]; do local parameter=$1 @@ -341,7 +344,7 @@ function main() { --run-test) shift [[ $# -ge 1 ]] || abort "missing executable after --run-test" - TEST_TO_RUN="$1" + TESTS_TO_RUN+=("$1") ;; *) abort "error: unknown option ${parameter}" ;; esac @@ -351,7 +354,7 @@ function main() { readonly RUN_BUILD_TESTS readonly RUN_UNIT_TESTS readonly RUN_INTEGRATION_TESTS - readonly TEST_TO_RUN + readonly TESTS_TO_RUN cd ${REPO_ROOT_DIR} @@ -359,7 +362,7 @@ function main() { local failed=0 - if [[ -n "${TEST_TO_RUN}" ]]; then + if [[ ${#TESTS_TO_RUN[@]} > 0 ]]; then if (( RUN_BUILD_TESTS || RUN_UNIT_TESTS || RUN_INTEGRATION_TESTS )); then abort "--run-test must be used alone" fi @@ -368,17 +371,19 @@ function main() { header "Documentation only PR, skipping running custom test" exit 0 fi - ${TEST_TO_RUN} || failed=1 + for test_to_run in "${TESTS_TO_RUN[@]}"; do + ${test_to_run} || { failed=1; step_failed "${test_to_run}"; } + done fi - run_build_tests || failed=1 + run_build_tests || { failed=1; step_failed "run_build_tests"; } # If PRESUBMIT_TEST_FAIL_FAST is set to true, don't run unit tests if build tests failed if (( ! PRESUBMIT_TEST_FAIL_FAST )) || (( ! failed )); then - run_unit_tests || failed=1 + run_unit_tests || { failed=1; step_failed "run_unit_tests"; } fi # If PRESUBMIT_TEST_FAIL_FAST is set to true, don't run integration tests if build/unit tests failed if (( ! PRESUBMIT_TEST_FAIL_FAST )) || (( ! failed )); then - run_integration_tests || failed=1 + run_integration_tests || { failed=1; step_failed "run_integration_tests"; } fi exit ${failed}