FIX: Static variables all over the place for per patch
[csit.git] / resources / libraries / bash / entry / per_patch_device.sh
1 #!/usr/bin/env bash
2
3 # Copyright (c) 2019 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:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
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.
15
16 set -exuo pipefail
17
18 # This entry script does not change CSIT branch,
19 # use "with_oper_for_vpp.sh" wrapper for that.
20 #
21 # Assumptions:
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.
25 # Consequences:
26 # + The following directories (relative to VPP repo) are (re)created:
27 # ++ csit_current, build_current, archive, csit/archive, csit_download_dir.
28
29 # TODO: Implement some kind of VPP build caching.
30
31 # "set -eu" handles failures from the following two lines.
32 BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
33 BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
34 source "${BASH_FUNCTION_DIR}/common.sh" || {
35     echo "Source failed." >&2
36     exit 1
37 }
38 source "${BASH_FUNCTION_DIR}/per_patch.sh" || die "Source failed."
39 common_dirs || die
40 set_perpatch_vpp_dir || die
41 build_vpp_ubuntu_amd64 "CURRENT" || die
42 set_aside_commit_build_artifacts || die
43 initialize_csit_dirs || die
44 get_test_code "${1-}" || die
45 get_test_tag_string || die
46 set_perpatch_dut || die
47 select_topology || die
48 select_build "build_current" || die
49 check_download_dir || die
50 activate_virtualenv "${VPP_DIR}" || die
51 activate_docker_topology || die
52 select_vpp_device_tags || die
53 compose_pybot_arguments || die
54 run_pybot || die
55 copy_archives || die
56 archive_test_results "csit_current" || die
57 die_on_pybot_error || die