feat(tests): IPv6 fixes
[csit.git] / resources / libraries / bash / entry / tox.sh
1 #!/usr/bin/env bash
2
3 # Copyright (c) 2021 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 is a launcher script, to be called from Jenkins.
19 # It runs tox at $CSIT_DIR (after activating virtualenv with its requirements).
20 # Exit code of tox is propagated.
21
22 # "set -eu" handles failures from the following two lines.
23 BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
24 BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
25 source "${BASH_FUNCTION_DIR}/common.sh" || {
26     echo "Source failed." >&2
27     exit 1
28 }
29 common_dirs || die
30 cd "${CSIT_DIR}" || die
31 activate_virtualenv "${CSIT_DIR}" "${CSIT_DIR}/tox-requirements.txt" || die
32 set +e
33 # Verbosity is increased so console output shows any unwanted downloads.
34 tox -vv
35 TOX_EXIT_STATUS="$?"
36 set -e
37 mkdir -p "${CSIT_DIR}/archives" || die
38 mv *.log "${CSIT_DIR}/archives" || die
39
40 exit "${TOX_EXIT_STATUS}"