3 # Copyright (c) 2023 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 # This entry script does not change CSIT branch,
19 # use "with_oper_for_vpp.sh" wrapper for that.
22 # + There is a directory holding VPP repo with patch under test checked out.
23 # + It contains csit subdirectory with CSIT code to use (this script is there).
24 # + Everything needed to build VPP is already installed locally.
26 # + At the end, VPP repo has parent commit checked out and built.
27 # + Directories build_root, build and csit are reset during the run.
28 # + The following directories (relative to VPP repo) are (re)created:
29 # ++ csit_new, csit_parent, build_new, build_parent,
30 # ++ archives, csit/archives, csit_download_dir.
32 # TODO: Implement some kind of VPP build caching.
34 # "set -eu" handles failures from the following two lines.
35 BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
36 BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
37 source "${BASH_FUNCTION_DIR}/common.sh" || {
38 echo "Source failed." >&2
41 source "${BASH_FUNCTION_DIR}/per_patch.sh" || die "Source failed."
42 # Cleanup needs ansible.
43 source "${BASH_FUNCTION_DIR}/ansible.sh" || die "Source failed."
45 check_prerequisites || die
46 set_perpatch_vpp_dir || die
47 build_vpp_ubuntu_amd64 "CURRENT" || die
48 set_aside_commit_build_artifacts || die
49 build_vpp_ubuntu_amd64 "PARENT" || die
50 set_aside_parent_build_artifacts || die
51 initialize_csit_dirs || die
52 get_test_code "${1-}" || die
53 get_test_tag_string || die
54 set_perpatch_dut || die
55 select_topology || die
57 activate_virtualenv "${VPP_DIR}" || die
60 reserve_and_cleanup_testbed || die
62 compose_robot_arguments || die
63 set_environment_variables || die
64 # Support for interleaved measurements is kept for future.
66 for ((iter=0; iter<iterations; iter++)); do
68 # Function reserve_and_cleanup_testbed has already cleaned it once,
69 # but we need to clean it explicitly on subsequent iterations.
70 ansible_playbook "cleanup" || die
72 # Testing current first. Good for early failures or for API changes.
73 select_build "build_current" || die
74 check_download_dir || die
76 archive_test_results "csit_current/${iter}" || die
77 # TODO: Use less heavy way to avoid apt remove failures.
78 ansible_playbook "cleanup" || die
79 select_build "build_parent" || die
80 check_download_dir || die
82 archive_test_results "csit_parent/${iter}" || die
84 untrap_and_unreserve_testbed || die
85 compare_test_results # The error code becomes this script's error code.