aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/entry
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/bash/entry')
-rw-r--r--resources/libraries/bash/entry/bisect.sh188
-rwxr-xr-xresources/libraries/bash/entry/bootstrap_aws_eb_version_create_release.sh32
-rwxr-xr-xresources/libraries/bash/entry/bootstrap_aws_eb_version_deploy.sh (renamed from resources/libraries/bash/entry/bootstrap_docs.sh)10
-rwxr-xr-xresources/libraries/bash/entry/bootstrap_aws_eb_version_verify.sh (renamed from resources/libraries/bash/entry/bootstrap_trending.sh)10
-rwxr-xr-xresources/libraries/bash/entry/bootstrap_report.sh6
-rwxr-xr-xresources/libraries/bash/entry/bootstrap_verify_perf.sh11
-rwxr-xr-xresources/libraries/bash/entry/bootstrap_vpp_device.sh9
-rw-r--r--resources/libraries/bash/entry/check/doc_verify.sh53
-rwxr-xr-xresources/libraries/bash/entry/check_l3fwd.sh39
-rwxr-xr-xresources/libraries/bash/entry/check_testpmd.sh39
-rwxr-xr-xresources/libraries/bash/entry/patch_l3fwd_flip_routes2
-rw-r--r--resources/libraries/bash/entry/per_patch_device.sh17
-rw-r--r--resources/libraries/bash/entry/per_patch_perf.sh29
-rw-r--r--resources/libraries/bash/entry/tox/README.txt (renamed from resources/libraries/bash/entry/check/README.txt)26
-rw-r--r--resources/libraries/bash/entry/tox/autogen.sh (renamed from resources/libraries/bash/entry/check/autogen.sh)6
-rw-r--r--resources/libraries/bash/entry/tox/copyright_year.sh (renamed from resources/libraries/bash/entry/check/copyright_year.sh)9
-rw-r--r--resources/libraries/bash/entry/tox/fix_copyright_year.sh (renamed from resources/libraries/bash/entry/check/job_spec.sh)51
-rw-r--r--resources/libraries/bash/entry/tox/gpl_license.sh (renamed from resources/libraries/bash/entry/check/gpl_license.sh)2
-rw-r--r--resources/libraries/bash/entry/tox/line.sh (renamed from resources/libraries/bash/entry/check/line.sh)2
-rw-r--r--resources/libraries/bash/entry/tox/new_line.sh (renamed from resources/libraries/bash/entry/check/new_line.sh)2
-rw-r--r--resources/libraries/bash/entry/tox/pylint.sh (renamed from resources/libraries/bash/entry/check/pylint.sh)2
21 files changed, 395 insertions, 150 deletions
diff --git a/resources/libraries/bash/entry/bisect.sh b/resources/libraries/bash/entry/bisect.sh
new file mode 100644
index 0000000000..d5cb1d51ba
--- /dev/null
+++ b/resources/libraries/bash/entry/bisect.sh
@@ -0,0 +1,188 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2023 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -exuo pipefail
+
+# This entry script does not change which CSIT branch is used,
+# use "with_oper_for_vpp.sh" wrapper for that.
+#
+# This script is to be used for locating performance regressions
+# (or breakages, or progressions, or fixes).
+# It uses "git bisect" commands on the VPP repository,
+# between the triggered VPP patch and a commit specified in the first argument
+# of the gerrit comment text.
+# The other arguments are used as tag expressions for selecting tests as usual.
+# Many different result types are supported.
+#
+# Logs are present in the archive directory, but usually the main output
+# is the offending commit as identified by "git bisect", visible in console.
+#
+# While selecting just one testcase is the intended use,
+# this script should be able to deal with multiple testcases as well,
+# grouping all the values together. This usually inflates
+# the standard deviation, but it is not clear how that affects the bisection.
+#
+# For the bisection decision, jumpavg library is used,
+# deciding whether shorter description is achieved by forcefully grouping
+# the middle results with the old, or with the new ones.
+# If the shortest description is achieved with 3 separate groups,
+# bisect interval focuses on biggest relative change
+# (with respect to pairwise maximum).
+#
+# If a test fails, an artificial result is used to distinguish
+# from normal results. Currently, the value 1.0, with the multiplicity of 4.
+#
+# Note that if there was a VPP API change that affects tests in the interval,
+# there frequently is no good way for single CSIT commit to work there.
+# You can try manually reverting the CSIT changes to make tests pass,
+# possibly needing to search over multiple subintervals.
+# Using and older CSIT commit (possibly cherry-picking the bisect Change
+# if it was not present in CSIT compatible with old enough VPP builds)
+# is the fastest solution; but beware of CSIT-induced performance effects
+# (e.g. TRex settings).
+#
+# If a regression happens during a subinterval where the test fails
+# due to a bug in VPP, you may try to create a new commit chain
+# with the fix cherry-picked to the start of the interval.
+# Do not do that as a chain in Gerrit, it would be long and Gerrit will refuse
+# edits of already merged Changes.
+# Instead, add a block of bash code to do the manipulation
+# on local git history between checkout and bisect.
+#
+# At the start, the script executes first bisect iteration in an attempt
+# to avoid work if the search interval has only one commit (or is invalid).
+# Only when the work is needed, earliest and latest commits are built
+# and tested. Branches "earliest", "middle" and "latest" are temporarily created
+# as a way to remember which commits to check out.
+#
+# Test results are parsed from json files,
+# symlinks are used to tell python script which results to compare.
+#
+# Assumptions:
+# + There is a directory holding VPP repo with patch under test checked out.
+# + It contains csit subdirectory with CSIT code to use (this script is there).
+# + Everything needed to build VPP is already installed locally.
+# Consequences:
+# + Working directory is switched to the VPP repo root.
+# + At the end, VPP repo has checked out and built some commit,
+# as chosen by "git bisect".
+# + Directories build_root, build and csit are reset during the run.
+# + The following directories (relative to VPP repo) are (re)created:
+# ++ csit_{earliest,middle,latest}, build_{earliest,latest},
+# ++ archive, csit/archive, csit/download_dir.
+# + Symlinks csit_{early,late,mid} are also created.
+# Arguments:
+# - ${1} - If present, override JOB_NAME to simplify manual usage.
+
+# "set -eu" handles failures from the following two lines.
+BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
+BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
+source "${BASH_FUNCTION_DIR}/common.sh" || {
+ echo "Source failed." >&2
+ exit 1
+}
+source "${BASH_FUNCTION_DIR}/per_patch.sh" || die "Source failed."
+# Cleanup needs ansible.
+source "${BASH_FUNCTION_DIR}/ansible.sh" || die "Source failed."
+common_dirs || die
+check_prerequisites || die
+set_perpatch_vpp_dir || die
+get_test_code "${1-}" || die
+get_test_tag_string || die
+# Unfortunately, git bisect only works at the top of the repo.
+cd "${VPP_DIR}" || die
+
+# Save the current commit.
+git checkout -b "latest"
+# Save the lower bound commit.
+git checkout -b "earliest"
+git reset --hard "${GIT_BISECT_FROM}"
+
+# This is the place for custom code manipulating local git history.
+
+#git checkout -b "alter"
+#...
+#git checkout "latest"
+#git rebase "alter" || git rebase --skip
+#git branch -D "alter"
+
+git bisect start || die
+# TODO: Can we add a trap for "git bisect reset" or even "deactivate",
+# without affecting the inner trap for unreserve and cleanup?
+git checkout "latest"
+git status || die
+git describe || die
+git bisect new || die
+# Performing first iteration early to avoid testing or even building.
+git checkout "earliest" || die "Failed to checkout earliest commit."
+git status || die
+git describe || die
+# The first iteration.
+git bisect old | tee "git.log" || die "Invalid bisect interval?"
+git checkout -b "middle" || die "Failed to create branch: middle"
+git status || die
+git describe || die
+if head -n 1 "git.log" | cut -b -11 | fgrep -q "Bisecting:"; then
+ echo "Building and testing initial bounds."
+else
+ echo "Single commit, no work needed."
+ exit 0
+fi
+# Building latest first, good for avoiding DPDK rebuilds.
+git checkout "latest" || die "Failed to checkout latest commit."
+build_vpp_ubuntu "LATEST" || die
+set_aside_build_artifacts "latest" || die
+git checkout "earliest" || die "Failed to checkout earliest commit."
+git status || die
+git describe || die
+build_vpp_ubuntu "EARLIEST" || die
+set_aside_build_artifacts "earliest" || die
+git checkout "middle" || die "Failed to checkout middle commit."
+git branch -D "earliest" "latest" || die "Failed to remove branches."
+# Done with repo manipulation for now, testing commences.
+initialize_csit_dirs "earliest" "middle" "latest" || die
+set_perpatch_dut || die
+select_topology || die
+select_arch_os || die
+activate_virtualenv "${VPP_DIR}" || die
+generate_tests || die
+archive_tests || die
+
+# TODO: Does it matter which build is tested first?
+
+select_build "build_earliest" || die
+check_download_dir || die
+reserve_and_cleanup_testbed || die
+run_robot || die
+move_test_results "csit_earliest" || die
+ln -s -T "csit_earliest" "csit_early" || die
+
+# Explicit cleanup, in case the previous test left the testbed in a bad shape.
+ansible_playbook "cleanup"
+
+select_build "build_latest" || die
+check_download_dir || die
+run_robot || die
+move_test_results "csit_latest" || die
+ln -s -T "csit_latest" "csit_late" || die
+untrap_and_unreserve_testbed || die
+
+# See function documentation for the logic in the loop.
+main_bisect_loop || die
+# In worst case, the middle branch is still checked out.
+# TODO: Is there a way to ensure "middle" branch is always deleted?
+git branch -D "middle" || true
+# Delete symlinks to prevent duplicate archiving.
+rm -vrf "csit_early" "csit_late" "csit_mid"
diff --git a/resources/libraries/bash/entry/bootstrap_aws_eb_version_create_release.sh b/resources/libraries/bash/entry/bootstrap_aws_eb_version_create_release.sh
new file mode 100755
index 0000000000..0bbf3b83ff
--- /dev/null
+++ b/resources/libraries/bash/entry/bootstrap_aws_eb_version_create_release.sh
@@ -0,0 +1,32 @@
+# Copyright (c) 2024 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -exuo pipefail
+
+# Assumptions:
+# + There is a directory holding CSIT code to use (this script is there).
+# Consequences (and specific assumptions) are multiple,
+# examine tree of functions for current description.
+
+# "set -eu" handles failures from the following two lines.
+BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
+BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
+source "${BASH_FUNCTION_DIR}/common.sh" || {
+ echo "Source failed." >&2
+ exit 1
+}
+source "${BASH_FUNCTION_DIR}/eb_version.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/hugo.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/terraform.sh" || die "Source failed."
+common_dirs || die
+eb_version_create_release || die
diff --git a/resources/libraries/bash/entry/bootstrap_docs.sh b/resources/libraries/bash/entry/bootstrap_aws_eb_version_deploy.sh
index 9d2519ebf3..15d6dae405 100755
--- a/resources/libraries/bash/entry/bootstrap_docs.sh
+++ b/resources/libraries/bash/entry/bootstrap_aws_eb_version_deploy.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -25,8 +25,8 @@ source "${BASH_FUNCTION_DIR}/common.sh" || {
echo "Source failed." >&2
exit 1
}
-source "${BASH_FUNCTION_DIR}/docs.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/eb_version.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/hugo.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/terraform.sh" || die "Source failed."
common_dirs || die
-activate_virtualenv || die
-generate_docs || die
-die_on_docs_error || die
+eb_version_deploy || die
diff --git a/resources/libraries/bash/entry/bootstrap_trending.sh b/resources/libraries/bash/entry/bootstrap_aws_eb_version_verify.sh
index b172a81be5..362a2f78af 100755
--- a/resources/libraries/bash/entry/bootstrap_trending.sh
+++ b/resources/libraries/bash/entry/bootstrap_aws_eb_version_verify.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -25,8 +25,8 @@ source "${BASH_FUNCTION_DIR}/common.sh" || {
echo "Source failed." >&2
exit 1
}
-source "${BASH_FUNCTION_DIR}/docs.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/eb_version.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/hugo.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/terraform.sh" || die "Source failed."
common_dirs || die
-activate_virtualenv || die
-generate_trending || die
-die_on_docs_error || die
+eb_version_build_verify || die
diff --git a/resources/libraries/bash/entry/bootstrap_report.sh b/resources/libraries/bash/entry/bootstrap_report.sh
index 191f910171..47a9d2e3d4 100755
--- a/resources/libraries/bash/entry/bootstrap_report.sh
+++ b/resources/libraries/bash/entry/bootstrap_report.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -25,8 +25,8 @@ source "${BASH_FUNCTION_DIR}/common.sh" || {
echo "Source failed." >&2
exit 1
}
-source "${BASH_FUNCTION_DIR}/docs.sh" || die "Source failed."
+source "${BASH_FUNCTION_DIR}/eb_version.sh" || die "Source failed."
common_dirs || die
activate_virtualenv || die
generate_report || die
-die_on_docs_error || die
+die_on_error || die
diff --git a/resources/libraries/bash/entry/bootstrap_verify_perf.sh b/resources/libraries/bash/entry/bootstrap_verify_perf.sh
index 99813573ea..18dfd08c39 100755
--- a/resources/libraries/bash/entry/bootstrap_verify_perf.sh
+++ b/resources/libraries/bash/entry/bootstrap_verify_perf.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -46,10 +46,7 @@ archive_tests || die
prepare_topology || die
select_topology || die
reserve_and_cleanup_testbed || die
-select_tags || die
-compose_pybot_arguments || die
-set_environment_variables || die
-run_pybot || die
-untrap_and_unreserve_testbed || die
+run_robot || die
move_archives || die
-die_on_pybot_error || die
+untrap_and_unreserve_testbed || die
+die_on_robot_error || die
diff --git a/resources/libraries/bash/entry/bootstrap_vpp_device.sh b/resources/libraries/bash/entry/bootstrap_vpp_device.sh
index ae4c26a1ba..fd6279f8c7 100755
--- a/resources/libraries/bash/entry/bootstrap_vpp_device.sh
+++ b/resources/libraries/bash/entry/bootstrap_vpp_device.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -44,9 +44,6 @@ archive_tests || die
prepare_topology || die
select_topology || die
activate_docker_topology || die
-select_tags || die
-compose_pybot_arguments || die
-set_environment_variables || die
-run_pybot || die
+run_robot || die
move_archives || die
-die_on_pybot_error || die
+die_on_robot_error || die
diff --git a/resources/libraries/bash/entry/check/doc_verify.sh b/resources/libraries/bash/entry/check/doc_verify.sh
deleted file mode 100644
index baa9d8aa74..0000000000
--- a/resources/libraries/bash/entry/check/doc_verify.sh
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright (c) 2021 Cisco and/or its affiliates.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at:
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -xeuo pipefail
-
-# This file should be executed from tox, as the assumend working directory
-# is different from where this file is located.
-# This file does not have executable flag nor shebang,
-# to dissuade non-tox callers.
-
-# "set -eu" handles failures from the following two lines.
-BASH_CHECKS_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
-BASH_FUNCTION_DIR="$(readlink -e "${BASH_CHECKS_DIR}/../../function")"
-source "${BASH_FUNCTION_DIR}/common.sh" || {
- echo "Source failed." >&2
- exit 1
-}
-source "${BASH_FUNCTION_DIR}/docs.sh" || die "Source failed."
-common_dirs || die
-activate_virtualenv || die
-
-# Documentation generation.
-# Here we do store only stderr to file while stdout (inlcuding Xtrace) is
-# printed to console. This way we can track increased errors in future.
-# We do not need to do trap as the env will be closed after tox finished the
-# task.
-exec 3>&1 || die
-export BASH_XTRACEFD="3" || die
-log_file="$(pwd)/doc_verify.log" || die
-
-generate_docs 2> ${log_file} || die
-
-if [[ "${DOCS_EXIT_STATUS}" != 0 ]]; then
- # Failed to generate report.
- warn
- warn "Doc verify checker: FAIL"
- exit 1
-fi
-
-warn
-warn "Doc verify checker: PASS"
diff --git a/resources/libraries/bash/entry/check_l3fwd.sh b/resources/libraries/bash/entry/check_l3fwd.sh
new file mode 100755
index 0000000000..3e53b636a3
--- /dev/null
+++ b/resources/libraries/bash/entry/check_l3fwd.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2022 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Helper functions for starting testpmd.
+
+set -exuo pipefail
+
+# Assumptions:
+# + There is a directory holding CSIT code to use (this script is there).
+# + At least one of the following is true:
+# ++ JOB_NAME environment variable is set,
+# ++ or this entry script has access to arguments.
+# Consequences (and specific assumptions) are multiple,
+# examine tree of functions for current description.
+
+# FIXME: Define API contract (as opposed to just help) for bootstrap.
+
+# "set -eu" handles failures from the following two lines.
+BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
+BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
+source "${BASH_FUNCTION_DIR}/common.sh" || {
+ echo "Source failed." >&2
+ exit 1
+}
+source "${BASH_FUNCTION_DIR}/dpdk.sh" || die "Source failed."
+common_dirs || die
+dpdk_l3fwd_check || die
diff --git a/resources/libraries/bash/entry/check_testpmd.sh b/resources/libraries/bash/entry/check_testpmd.sh
new file mode 100755
index 0000000000..1622b25b70
--- /dev/null
+++ b/resources/libraries/bash/entry/check_testpmd.sh
@@ -0,0 +1,39 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2022 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Helper functions for starting testpmd.
+
+set -exuo pipefail
+
+# Assumptions:
+# + There is a directory holding CSIT code to use (this script is there).
+# + At least one of the following is true:
+# ++ JOB_NAME environment variable is set,
+# ++ or this entry script has access to arguments.
+# Consequences (and specific assumptions) are multiple,
+# examine tree of functions for current description.
+
+# FIXME: Define API contract (as opposed to just help) for bootstrap.
+
+# "set -eu" handles failures from the following two lines.
+BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
+BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
+source "${BASH_FUNCTION_DIR}/common.sh" || {
+ echo "Source failed." >&2
+ exit 1
+}
+source "${BASH_FUNCTION_DIR}/dpdk.sh" || die "Source failed."
+common_dirs || die
+dpdk_testpmd_check || die
diff --git a/resources/libraries/bash/entry/patch_l3fwd_flip_routes b/resources/libraries/bash/entry/patch_l3fwd_flip_routes
index 23a6675145..c5eff5d3ca 100755
--- a/resources/libraries/bash/entry/patch_l3fwd_flip_routes
+++ b/resources/libraries/bash/entry/patch_l3fwd_flip_routes
@@ -1,7 +1,7 @@
#!/bin/sh
patch --ignore-whitespace --forward main.c <<"_EOF"
-185,186c185,186
+204,205c204,205
< {RTE_IPV4(198, 18, 0, 0), 24, 0},
< {RTE_IPV4(198, 18, 1, 0), 24, 1},
---
diff --git a/resources/libraries/bash/entry/per_patch_device.sh b/resources/libraries/bash/entry/per_patch_device.sh
index db977b6e96..88d7f13494 100644
--- a/resources/libraries/bash/entry/per_patch_device.sh
+++ b/resources/libraries/bash/entry/per_patch_device.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -39,14 +39,15 @@ source "${BASH_FUNCTION_DIR}/per_patch.sh" || die "Source failed."
common_dirs || die
check_prerequisites || die
set_perpatch_vpp_dir || die
-build_vpp_ubuntu_amd64 "CURRENT" || die
-set_aside_commit_build_artifacts || die
-initialize_csit_dirs || die
+git status || die
+git describe || die
+build_vpp_ubuntu "CURRENT" || die
+initialize_csit_dirs "current" || die
get_test_code "${1-}" || die
get_test_tag_string || die
set_perpatch_dut || die
select_arch_os || die
-select_build "build_current" || die
+select_build "build-root" || die
check_download_dir || die
activate_virtualenv "${VPP_DIR}" || die
generate_tests || die
@@ -54,8 +55,6 @@ archive_tests || die
prepare_topology || die
select_topology || die
activate_docker_topology || die
-select_tags || die
-compose_pybot_arguments || die
-run_pybot || die
+run_robot || die
move_archives || die
-die_on_pybot_error || die
+die_on_robot_error || die
diff --git a/resources/libraries/bash/entry/per_patch_perf.sh b/resources/libraries/bash/entry/per_patch_perf.sh
index 565a566eb0..9a825a007e 100644
--- a/resources/libraries/bash/entry/per_patch_perf.sh
+++ b/resources/libraries/bash/entry/per_patch_perf.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2023 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -44,11 +44,16 @@ source "${BASH_FUNCTION_DIR}/ansible.sh" || die "Source failed."
common_dirs || die
check_prerequisites || die
set_perpatch_vpp_dir || die
-build_vpp_ubuntu_amd64 "CURRENT" || die
-set_aside_commit_build_artifacts || die
-build_vpp_ubuntu_amd64 "PARENT" || die
-set_aside_parent_build_artifacts || die
-initialize_csit_dirs || die
+git status || die
+git describe || die
+build_vpp_ubuntu "CURRENT" || die
+set_aside_build_artifacts "current" || die
+git checkout "HEAD~" || die "Failed to checkout parent commit."
+git status || die
+git describe || die
+build_vpp_ubuntu "PARENT" || die
+set_aside_build_artifacts "parent" || die
+initialize_csit_dirs "parent" "current" || die
get_test_code "${1-}" || die
get_test_tag_string || die
set_perpatch_dut || die
@@ -58,8 +63,6 @@ activate_virtualenv "${VPP_DIR}" || die
generate_tests || die
archive_tests || die
reserve_and_cleanup_testbed || die
-select_tags || die
-compose_pybot_arguments || die
# Support for interleaved measurements is kept for future.
iterations=1 # 8
for ((iter=0; iter<iterations; iter++)); do
@@ -71,16 +74,14 @@ for ((iter=0; iter<iterations; iter++)); do
# Testing current first. Good for early failures or for API changes.
select_build "build_current" || die
check_download_dir || die
- run_pybot || die
- archive_parse_test_results "csit_current/${iter}" || die
- die_on_pybot_error || die
+ run_robot || die
+ move_test_results "csit_current/${iter}" || die
# TODO: Use less heavy way to avoid apt remove failures.
ansible_playbook "cleanup" || die
select_build "build_parent" || die
check_download_dir || die
- run_pybot || die
- archive_parse_test_results "csit_parent/${iter}" || die
- die_on_pybot_error || die
+ run_robot || die
+ move_test_results "csit_parent/${iter}" || die
done
untrap_and_unreserve_testbed || die
compare_test_results # The error code becomes this script's error code.
diff --git a/resources/libraries/bash/entry/check/README.txt b/resources/libraries/bash/entry/tox/README.txt
index 7f86d83b58..9ce21e93d0 100644
--- a/resources/libraries/bash/entry/check/README.txt
+++ b/resources/libraries/bash/entry/tox/README.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -11,10 +11,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-This directory contains checker scripts and other files they need.
-Each checker script is assumed to be run from tox,
+This directory contains tox scripts and other files they need.
+Generally, a tox script is either a checker (suitable for automated verify)
+or a fixer (manually started, risky as uncommitted edits can be lost).
+
+In the tox verify job we want to avoid running fixers,
+as they can affect what other checkers see
+(e.g. autogen fixer could add more too long lines).
+That is why we keep fixers separate from checkers in principle,
+even for fairly safe tasks (e.g. bumping copyright years).
+
+Each tox script is assumed to be run from tox,
when working directory is set to ${CSIT_DIR}.
-Each script should:
+
+Each checker script should:
+ Return nonzero exit code when it fails.
++ The tox might ignore the code when the check is not blocking.
+ Write less verbose output to stderr.
@@ -23,5 +33,9 @@ Each script should:
+ Only the output suitable for automated processing by an external caller
should be written to stdout.
++ The level of "less verbose" depends on check and state of codebase.
-+ TODO: Should we carefully document which files are
- whitelisted/blacklisted for a particulat check?
+
+Each fixer script should:
++ Perform edits on current filesystem
++ Not assume git is clean (there may be uncommitted edits).
++ Use "git diff HEAD~" to get both comitted and uncomitted edits to analyze.
++ Output whatever it wants (possibly nothing).
diff --git a/resources/libraries/bash/entry/check/autogen.sh b/resources/libraries/bash/entry/tox/autogen.sh
index 4ff214c260..40cc2c2066 100644
--- a/resources/libraries/bash/entry/check/autogen.sh
+++ b/resources/libraries/bash/entry/tox/autogen.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -50,8 +50,8 @@ cp -rf "${CSIT_DIR}/tests"/* "${GENERATED_DIR}/tests_tmp"/
# I think archiving the diff is enough.
diff_cmd=("diff" "-dur" "${GENERATED_DIR}/tests_tmp" "${GENERATED_DIR}/tests")
-# Diff returns RC=1 if output is nonzero, so we do not die on the next line.
-lines="$("${diff_cmd[@]}" | tee "autogen.log" | wc -l)"
+# Diff returns RC=1 if output is nonzero.
+lines="$("${diff_cmd[@]}" | tee "autogen.log" | wc -l || true)"
if [ "${lines}" != "0" ]; then
# TODO: Decide which text goes to stdout and which to stderr.
warn "Autogen conflict, diff sees nonzero lines: ${lines}"
diff --git a/resources/libraries/bash/entry/check/copyright_year.sh b/resources/libraries/bash/entry/tox/copyright_year.sh
index dae1a8dc46..272763100e 100644
--- a/resources/libraries/bash/entry/check/copyright_year.sh
+++ b/resources/libraries/bash/entry/tox/copyright_year.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -24,10 +24,7 @@ set -exuo pipefail
# but not the current year (in the same line).
# The offending lines are stored to copyright_year.log (overwriting).
#
-# 3 lines were chosen, because first two lines could be shebang and empty line,
-# and more than 3 lines would start failing on files with multiple copyright
-# holders. There, only the last updating entity needs to bump its year,
-# and put other copyright lines below.
+# 3 lines were chosen, because first two lines could be shebang and empty line.
# "set -eu" handles failures from the following two lines.
BASH_CHECKS_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
@@ -42,7 +39,7 @@ IFS=$'\n'
files=($(git diff --name-only HEAD~ || true))
unset IFS
truncate -s 0 "copyright_year.log" || die
-# A change can have thousands of files, supress console output in the cycle.
+# A change can have thousands of files, supress console output for the cycle.
set +x
for fil in "${files[@]}"; do
# Greps do "fail" on 0 line output, we need to ignore that
diff --git a/resources/libraries/bash/entry/check/job_spec.sh b/resources/libraries/bash/entry/tox/fix_copyright_year.sh
index 21013fe984..d822f272af 100644
--- a/resources/libraries/bash/entry/check/job_spec.sh
+++ b/resources/libraries/bash/entry/tox/fix_copyright_year.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2024 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@ -18,10 +18,17 @@ set -exuo pipefail
# This file does not have executable flag nor shebang,
# to dissuade non-tox callers.
-# This script checks if the number of tests in a job specification is the same
-# as declared at the beginning of the file.
-# It counts the lines not starting with '#' so it can also detect redundant
-# empty lines, or lines which should not be in the job specification.
+# This is a fixer script, so be careful before starting it.
+# It is recommended to always commit your recent edits before running this,
+# and use "git diff" after running this to confirm the edits are correct.
+# Otherwise you can lose your edits and introduce bad edits.
+
+# This script runs a variant of "git diff" command
+# to get the list of edited files, and few sed commands to edit the year
+# if "20.." pattern matches in first 3 lines.
+# No detection of "copyright", so edits can apply at surprising places.
+
+# 3 lines were chosen, because first two lines could be shebang and empty line.
# "set -eu" handles failures from the following two lines.
BASH_CHECKS_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
@@ -31,30 +38,18 @@ source "${BASH_FUNCTION_DIR}/common.sh" || {
exit 1
}
-job_spec_dir="docs/job_specs/"
-rm -f "job_spec.log" || die
-violations=0
-
-# Disabling -x: Following lines are doing too much garbage output.
+year=$(date +'%Y')
+IFS=$'\n'
+files=($(git diff --name-only HEAD~ || true))
+unset IFS
+# A change can have thousands of files, supress console output for the cycle.
set +x
-
-for f in $(find ${job_spec_dir} -type f | grep -v perf_tests_job_specs); do
- declared=$(fgrep "### tests" $f | tr -dc '0-9')
- present=$(fgrep -v '#' $f | wc -l)
- if [ "${declared}" != "${present}" ]; then
- echo "Wrong number of tests detected in ${f}: \
-declared: ${declared} / present: ${present}" | tee -a job_spec.log
- violations=$((violations+1))
+for fil in "${files[@]}"; do
+ if [[ -f "${fil}" ]]; then
+ sed -i "1 s/20../${year}/g" "${fil}"
+ sed -i "2 s/20../${year}/g" "${fil}"
+ sed -i "3 s/20../${year}/g" "${fil}"
+ # Else the file was actually deleted and sed would fail.
fi
done
-
set -x
-
-if [ "${violations}" != "0" ]; then
- warn
- warn "Number of tests in job spec checker: FAIL"
- exit 1
-fi
-
-warn
-warn "Number of tests in job spec checker: PASS"
diff --git a/resources/libraries/bash/entry/check/gpl_license.sh b/resources/libraries/bash/entry/tox/gpl_license.sh
index 167d3f3ecd..7112075883 100644
--- a/resources/libraries/bash/entry/check/gpl_license.sh
+++ b/resources/libraries/bash/entry/tox/gpl_license.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
diff --git a/resources/libraries/bash/entry/check/line.sh b/resources/libraries/bash/entry/tox/line.sh
index 6f373121e0..a90fc22cae 100644
--- a/resources/libraries/bash/entry/check/line.sh
+++ b/resources/libraries/bash/entry/tox/line.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
diff --git a/resources/libraries/bash/entry/check/new_line.sh b/resources/libraries/bash/entry/tox/new_line.sh
index 4857f9f8bd..a8fb38f73e 100644
--- a/resources/libraries/bash/entry/check/new_line.sh
+++ b/resources/libraries/bash/entry/tox/new_line.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
diff --git a/resources/libraries/bash/entry/check/pylint.sh b/resources/libraries/bash/entry/tox/pylint.sh
index fbfea4773e..a3e0f8ee14 100644
--- a/resources/libraries/bash/entry/check/pylint.sh
+++ b/resources/libraries/bash/entry/tox/pylint.sh
@@ -1,4 +1,4 @@
-# Copyright (c) 2021 Cisco and/or its affiliates.
+# Copyright (c) 2022 Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at: