aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/entry/check
diff options
context:
space:
mode:
Diffstat (limited to 'resources/libraries/bash/entry/check')
-rw-r--r--resources/libraries/bash/entry/check/README.txt27
-rw-r--r--resources/libraries/bash/entry/check/autogen.sh66
-rw-r--r--resources/libraries/bash/entry/check/copyright_year.sh70
-rw-r--r--resources/libraries/bash/entry/check/doc_verify.sh59
-rw-r--r--resources/libraries/bash/entry/check/gpl_license.sh73
-rw-r--r--resources/libraries/bash/entry/check/line.sh50
-rw-r--r--resources/libraries/bash/entry/check/new_line.sh51
-rw-r--r--resources/libraries/bash/entry/check/pylint.sh44
-rw-r--r--resources/libraries/bash/entry/check/tc_coverage.sh100
-rw-r--r--resources/libraries/bash/entry/check/tc_naming.sh140
10 files changed, 0 insertions, 680 deletions
diff --git a/resources/libraries/bash/entry/check/README.txt b/resources/libraries/bash/entry/check/README.txt
deleted file mode 100644
index a72274464c..0000000000
--- a/resources/libraries/bash/entry/check/README.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Copyright (c) 2019 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.
-
-This directory contains checker scripts and other files they need.
-Each checker script is assumed to be run from tox,
-when working directory is set to ${CSIT_DIR}.
-Each 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.
-+ Write (to stderr) PASSED or FAILED to help with debugging.
-+ Direct more verbose output to appropriately named .log file.
-+ 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?
diff --git a/resources/libraries/bash/entry/check/autogen.sh b/resources/libraries/bash/entry/check/autogen.sh
deleted file mode 100644
index 822c50c0ea..0000000000
--- a/resources/libraries/bash/entry/check/autogen.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (c) 2019 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 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.
-
-# This script starts with copying ${CSIT_DIR}/tests to ${GENERATED_DIR}/.
-# Then the script runs every executable *.py script anywhere in the copied dir,
-# the working directory temporarily changed to where the *.py file is.
-# Proper virtualenv is assumed to be active.
-# Then another directory in ${GENERATED_DIR} is created, where
-# the just generated content is copied and then overwitten by the non-generated.
-# If "diff -dur" sees any changes by the overwrite, this script fails.
-# The diff output is stored to autogen.log (overwriting).
-# The executed *.py files are assumed to be robot suite generators,
-# any change means the contribution is not consistent with the regenerated code.
-
-# "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
-}
-common_dirs
-work_dir="$(pwd)" || die
-trap "cd '${work_dir}'" EXIT || die
-
-generate_tests
-
-rm -rf "${GENERATED_DIR}/tests_tmp"
-cp -r "${GENERATED_DIR}/tests" "${GENERATED_DIR}/tests_tmp"
-# Default cp behavior is to put inside a targed dir, not to override.
-cp -rf "${CSIT_DIR}/tests"/* "${GENERATED_DIR}/tests_tmp"/
-# TODO: Do we want to archive ${GENERATED_DIR}?
-# 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)"
-if [ "${lines}" != "0" ]; then
- # TODO: Decide which text goes to stdout and which to stderr.
- warn "Autogen conflict, diff sees nonzero lines: ${lines}"
- # TODO: Disable if output size does more harm than good.
- cat "autogen.log" >&2
- warn
- warn "Autogen checker: FAIL"
- exit 1
-fi
-
-warn
-warn "Autogen checker: PASS"
diff --git a/resources/libraries/bash/entry/check/copyright_year.sh b/resources/libraries/bash/entry/check/copyright_year.sh
deleted file mode 100644
index 2f9bc1fbeb..0000000000
--- a/resources/libraries/bash/entry/check/copyright_year.sh
+++ /dev/null
@@ -1,70 +0,0 @@
-# Copyright (c) 2020 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 file should be executed from tox, as the assumed working directory
-# is different from where this file is located.
-# This file does not have executable flag nor shebang,
-# to dissuade non-tox callers.
-
-# This script runs a few grep-based commands and fails
-# if it detects any file edited or added since HEAD~
-# containing a copyright notice in first 3 lines,
-# 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.
-
-# "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
-}
-
-year=$(date +'%Y')
-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.
-set +x
-for fil in "${files[@]}"; do
- # Greps do "fail" on 0 line output, we need to ignore that
- # as 0 lines is good. We need both set +e to ensure everything executes,
- # and || true later to avoid dying on zero.
- piped_command="set +ex; head -n 3 '${fil}' | fgrep -i 'Copyright'"
- piped_command+=" | fgrep -v '${year}' | awk '{print \"${fil}: \" \$0}'"
- piped_command+=" >> 'copyright_year.log'"
- wrong_strings="$(bash -c "${piped_command}" || true)" || die
-done
-set -x
-lines="$(< "copyright_year.log" wc -l)"
-if [ "${lines}" != "0" ]; then
- # TODO: Decide which text goes to stdout and which to stderr.
- warn "Copyright lines with wrong year detected: ${lines}"
- # TODO: Disable when output size does more harm than good.
- pwd
- cat "copyright_year.log" >&2
- warn
- warn "Copyright year checker: FAIL"
- exit 1
-fi
-
-warn
-warn "Copyright year checker: PASS"
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 50b3d2db17..0000000000
--- a/resources/libraries/bash/entry/check/doc_verify.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright (c) 2019 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
-}
-
-common_dirs || die
-log_file="$(pwd)/doc_verify.log" || die
-
-# Pre-cleanup.
-rm -f "${log_file}" || die
-rm -f "${DOC_GEN_DIR}/csit.docs.tar.gz" || die
-rm -rf "${DOC_GEN_DIR}/_build" || 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
-
-pushd "${DOC_GEN_DIR}" || die
-source ./run_doc.sh ${GERRIT_BRANCH:-local} 2> ${log_file} || true
-popd || die
-
-if [[ ! -f "${log_file}" ]] || [[ -s "${log_file}" ]]; then
- # Output file not exists or is non empty.
- warn
- warn "Doc verify checker: FAIL"
- exit 1
-fi
-
-warn
-warn "Doc verify checker: PASS"
diff --git a/resources/libraries/bash/entry/check/gpl_license.sh b/resources/libraries/bash/entry/check/gpl_license.sh
deleted file mode 100644
index a1c46a0e90..0000000000
--- a/resources/libraries/bash/entry/check/gpl_license.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright (c) 2020 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 file should be executed from tox, as the assumed working directory
-# is different from where this file is located.
-# This file does not have executable flag nor shebang,
-# to dissuade non-tox callers.
-
-# This script runs a few grep-based commands and fails
-# if it detects any file edited or added since HEAD~
-# containing a copyright notice in first 3 lines,
-# but not GPL-based license.
-# The offending files are stored to gpl_license.log (overwriting).
-
-# "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
-}
-
-IFS=$'\n'
-gpl_files=($(git diff --name-only HEAD~ | grep '^GPL/' || true))
-unset IFS
-logfile="gpl_license.log"
-truncate -s 0 "${logfile}" || die
-# A change can have thousands of files, supress console output in the cycle.
-set +x
-for fil in "${gpl_files[@]}"; do
- if head -n 3 "${fil}" | fgrep -iq 'Copyright'; then
- # Copyrighted file, processed below.
- true
- else
- # Uncopyrighted files are allowed.
- # TODO: Should we have list of extesions that require Copyright?
- continue
- fi
- if fgrep -q 'GNU General Public License v2.0 or later' "${fil}"; then
- # This can be GPL only or the OR license, we accept both.
- # TODO: Should we require "Apache-2.0 OR GPL-2.0-or-later"?
- continue
- else
- echo "GPL license not detected: ${fil}" >> "${logfile}"
- fi
-done
-set -x
-lines="$(< "${logfile}" wc -l)"
-if [ "${lines}" != "0" ]; then
- # TODO: Decide which text goes to stdout and which to stderr.
- warn "Wrong licensed files in GPL directory detected: ${lines}"
- # TODO: Disable when output size does more harm than good.
- pwd
- cat "${logfile}" >&2
- warn
- warn "GPL license checker: FAIL"
- exit 1
-fi
-
-warn
-warn "GPL license checker: PASS"
diff --git a/resources/libraries/bash/entry/check/line.sh b/resources/libraries/bash/entry/check/line.sh
deleted file mode 100644
index 932f3cdbe9..0000000000
--- a/resources/libraries/bash/entry/check/line.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-# Copyright (c) 2019 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 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.
-
-# This script runs a grep-based command and fails if it detects any lines
-# longer than 80 characters.
-# The grep output stored to lines.log (overwriting).
-
-# "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
-}
-
-# Directory docs contains too many wide formatted tables.
-# .txt contains lines with wide URLs.
-piped_command='set -exuo pipefail && grep -rn ".\{81\}" "resources/" "tests/"'
-piped_command+=' | fgrep -v .svg | fgrep -v .txt | tee "lines.log" | wc -l'
-# TODO: The greps "fail" if no long line remains. Fix that if it ever happens.
-lines="$(bash -c "${piped_command}")" || die
-if [ "${lines}" != "0" ]; then
- # TODO: Decide which text goes to stdout and which to stderr.
- warn "Long lines detected: ${lines}"
- ## TODO: Enable when output size does more good than harm.
- # cat "lines.log" >&2
- warn
- warn "Line length checker: FAIL"
- exit 1
-fi
-
-warn
-warn "Line length checker: PASS"
diff --git a/resources/libraries/bash/entry/check/new_line.sh b/resources/libraries/bash/entry/check/new_line.sh
deleted file mode 100644
index 2e24c0256b..0000000000
--- a/resources/libraries/bash/entry/check/new_line.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright (c) 2020 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 file should be executed from tox, as the assumed working directory
-# is different from where this file is located.
-# This file does not have executable flag nor shebang,
-# to dissuade non-tox callers.
-
-# This script runs a grep-based command and fails if it detects any lines
-# edited or added since HEAD~ and longer than 80 characters.
-# The grep output stored to new_lines.log (overwriting).
-
-# See lines.log to locate where the lines are.
-
-# "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
-}
-
-# Greps do "fail" on zero line output, we need to ignore that in the final grep.
-piped_command="set -exuo pipefail && git diff -U0 HEAD~ | grep '^\+' | "
-piped_command+="cut -c2- | grep -v '^\+\+ ' | { grep '.\{81\}' || true; } | "
-piped_command+="tee 'new_lines.log' | wc -l"
-lines="$(bash -c "${piped_command}")" || die
-if [ "${lines}" != "0" ]; then
- # TODO: Decide which text goes to stdout and which to stderr.
- warn "Long lines detected: ${lines}"
- # TODO: Disable when output size does more harm than good.
- cat "new_lines.log" >&2
- warn
- warn "New line length checker: FAIL"
- exit 1
-fi
-
-warn
-warn "New line length checker: PASS"
diff --git a/resources/libraries/bash/entry/check/pylint.sh b/resources/libraries/bash/entry/check/pylint.sh
deleted file mode 100644
index 919e140f28..0000000000
--- a/resources/libraries/bash/entry/check/pylint.sh
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright (c) 2019 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 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.
-
-# This script runs pylint and propagates its exit code.
-# Config is taken from pylint.cfg, and proper virtualenv is assumed to be active.
-# The pylint output stored to pylint.log (overwriting).
-
-# "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
-}
-pylint_args=("--rcfile=pylint.cfg" "resources/")
-if pylint "${pylint_args[@]}" > "pylint.log"; then
- warn
- warn "Pylint checker: PASS"
-else
- # TODO: Decide which text goes to stdout and which to stderr.
- warn "Pylint exited with nonzero status."
- ## TODO: Enable when output size does more good than harm.
- # cat "pylint.log" >&2
- warn
- warn "Pylint checker: FAIL"
- exit 1
-fi
diff --git a/resources/libraries/bash/entry/check/tc_coverage.sh b/resources/libraries/bash/entry/check/tc_coverage.sh
deleted file mode 100644
index 2fda5f7d52..0000000000
--- a/resources/libraries/bash/entry/check/tc_coverage.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright (c) 2019 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
-}
-
-# Grep of interest: We want all tc01- prefixed (skip TC variations for now).
-# Currently script assumes all variations inside to be part of either
-# auto-generation or not checked at all (VIRL derivates).
-r_grep="tc01-"
-# Parse grep of interest (learn path, learn suite, learn testcase name).
-r_parse='(.*)\/(.*).robot.*(tc[[:digit:]]{2}-.*)'
-
-rm -f "tc_coverage.log" || die
-
-# Disabling -x: Following lines are doing too much garbage output.
-set +x
-
-# Grep interest.
-grep_match=$(grep -RE "${r_grep}" tests/*) || die
-# Extract data from the grep output.
-suites_dirs=($(printf "${grep_match}" | sed -re "s/${r_parse}/\1/")) || die
-suites_names=($(printf "${grep_match}" | sed -re "s/${r_parse}/\2/")) || die
-testcases_names=($(printf "${grep_match}" | sed -re "s/${r_parse}/\3/")) || die
-
-# Extract 2N suites from the global testcase list and normalize output.
-suites_2n=($(printf '%s\n' "${suites_names[@]}" | \
- grep -E "^(2n1l|2n)-" | \
- sed -re "s/(2n1l|2n)-//"))
-# Extract 3N suites from the global testcase list.
-suites_3n=($(printf '%s\n' "${suites_names[@]}" | \
- grep -vE "^(2n1l|2n|eth2p)-"))
-# Extract vpp_device suites from the global testcase list.
-# Code will try to map the naming to perf by normalizing output.
-suites_dev=($(printf '%s\n' "${suites_names[@]}" | \
- grep -E "^eth2p-" | \
- sed -re "s/eth2p-/10ge2p1x710-/" | \
- sed -re "s/-dev/-ndrpdr/" | \
- sed -re "s/-ethicmpv/-ethip/"))
-
-# Compute intersection of arrays.
-intersection_3n2n=($(comm -12 <(printf '%s\n' "${suites_3n[@]}" | sort) \
- <(printf '%s\n' "${suites_2n[@]}" | sort)))
-intersection_3ndev=($(comm -12 <(printf '%s\n' "${suites_2n[@]}" | sort) \
- <(printf '%s\n' "${suites_dev[@]}" | sort)))
-
-# Print the results in CSV format.
-echo "Suite name;Testcase name;2n version;VPP Device version" \
- > tc_coverage.log
-for i in "${!suites_names[@]}"; do
- if [[ ! "${suites_names[i]}" =~ ^(2n1l|2n|eth2p)-.* ]]; then
- echo -n "${suites_names[i]};${testcases_names[i]}" \
- >> tc_coverage.log
- if [[ "${intersection_3n2n[@]}" =~ "${suites_names[i]}" ]]; then
- echo -n ";yes" >> tc_coverage.log
- else
- echo -n ";no" >> tc_coverage.log
- fi
- if [[ "${intersection_3ndev[@]}" =~ "${suites_names[i]}" ]]; then
- echo ";yes" >> tc_coverage.log
- else
- echo ";no" >> tc_coverage.log
- fi
- fi
-done
-
-set -x
-
-echo "Count 2n: ${#suites_2n[@]}"
-echo "Count 3n: ${#suites_3n[@]}"
-echo "Count dev: ${#suites_dev[@]}"
-echo "Coverage 2n3n: ${#intersection_3n2n[@]}"
-echo "Coverage 3ndev: ${#intersection_3ndev[@]}"
-
-warn
-warn "Testcase coverage checker: PASS"
diff --git a/resources/libraries/bash/entry/check/tc_naming.sh b/resources/libraries/bash/entry/check/tc_naming.sh
deleted file mode 100644
index e9f86fc0dd..0000000000
--- a/resources/libraries/bash/entry/check/tc_naming.sh
+++ /dev/null
@@ -1,140 +0,0 @@
-#!/usr/bin/env bash
-
-# Copyright (c) 2020 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
-}
-
-# Grep of interest: We want all [0-9]{2,4}B- or IMIX- prefixed.
-# Currently script assumes all variations inside to be part of either
-# auto-generation or not checked at all (VIRL derivates).
-r_grep="([0-9]{2,4}B|IMIX)-"
-# Parse grep of interest (learn path, learn suite, learn testcase name).
-r_parse='(.*)\/(.*).robot.*(([0-9]{2,4}B|IMIX)-.*)'
-
-# CSIT Testcase naming convention rules.
-# https://wiki.fd.io/view/CSIT/csit-test-naming
-# Rules are defined as regular expressions in ordered array and checked in order
-# in a loop, where every iteration is catenated with previous rules. This way we
-# can detect where exactly the naming does not meet criteria and print error
-# from rule string array. This imply that rules are defined in a way of a single
-# string. First rule must start with ^ and last is terminated by $.
-# Rules are written from Left to Right.
-# Bash regular expression logic is used. Once the error is raised the checker is
-# breaked for current Testcase marking the expected fail.
-# One caveat of this solution is that we cannot proceed to check full names now
-# as majority of Testcases does not meet naming criteria.
-s_testc_rules=(
- 'packet size'
- 'core combination'
- 'NIC driver mode'
- 'packet encapsulation on L2 layer'
- 'test type'
- )
-r_testc_rules=(
- '^([[:digit:]]{2,4}B|IMIX)-'
- '([[:digit:]]+c-){0,1}'
- '(avf-|1lbvpplacp-|2lbvpplacp-){0,1}'
- '(eth|dot1q|dot1ad)'
- # TODO: Packet encapsulation (here majority of TC starts failing).
- #'(ip4|ip6|ip6ip6|icmpv4|icmpv6)'
- #'(ipsec[[:digit:]]+tnlhw|ipsec[[:digit:]]+tnlsw|'
- #'srhip6|tcp|udp|lispip6|lispip4|vxlan){0,1}'
- #'(http){0,1}-'
- '(.*)-(dev|ndrpdr|bps|cps|rps|reconf)$'
- )
-s_suite_rules=(
- 'number of SUT nodes'
- 'NIC card'
- 'NIC driver mode'
- 'packet encapsulation on L2 layer'
- 'test type'
- )
-r_suite_rules=(
- '^(2n1l|2n){0,1}-'
- '(eth2p|10ge2p1x710)-'
- '(avf-|1lbvpplacp-|2lbvpplacp-){0,1}'
- '(eth|dot1q|dot1ad)'
- # TODO: Packet encapsulation (here majority of TC starts failing).
- #'(ip4|ip6|ip6ip6|icmpv4|icmpv6)'
- #'(ipsec[[:digit:]]+tnlhw|ipsec[[:digit:]]+tnlsw|'
- #'srhip6|tcp|udp|lispip6|lispip4|vxlan){0,1}'
- #'(http){0,1}-'
- '(.*)-(dev|ndrpdr|bps|cps|rps|reconf)$'
- )
-
-rm -f "tc_naming.log" || die
-
-# Disabling -x: Following lines are doing too much garbage output.
-set +x
-
-# Grep interest.
-grep_match=$(grep -RE "${r_grep}" tests/*) || die
-# Extract data from the grep output.
-suites_dirs=($(printf "${grep_match}" | sed -re "s/${r_parse}/\1/")) || die
-suites_names=($(printf "${grep_match}" | sed -re "s/${r_parse}/\2/")) || die
-testcases_names=($(printf "${grep_match}" | sed -re "s/${r_parse}/\3/")) || die
-
-# Naming check.
-total_failed_tc=0
-total_failed_su=0
-for idx in "${!testcases_names[@]}"; do
- for pass in "${!r_suite_rules[@]}"; do
- r_rule=$(printf '%s' "${r_suite_rules[@]:1:pass}")
- if [[ ! "${suites_names[idx]}" =~ ${r_rule} ]]; then
- msg=""
- msg+="${suites_dirs[idx]}/${suites_names[idx]} / "
- msg+="${testcases_names[idx]} ${s_suite_rules[pass]} "
- msg+="is not matching suite naming rule!"
- echo "${msg}" | tee -a "tc_naming.log" || die
- total_failed_su=$((total_failed_su + 1))
- break
- fi
- done
- for pass in "${!r_testc_rules[@]}"; do
- r_rule=$(printf '%s' "${r_testc_rules[@]:1:pass}")
- if [[ ! "${testcases_names[idx]}" =~ ${r_rule} ]]; then
- msg=""
- msg+="${suites_dirs[idx]}/${suites_names[idx]} / "
- msg+="${testcases_names[idx]} ${s_testc_rules[pass]} "
- msg+="is not matching testcase naming rule!"
- echo "${msg}" | tee -a "tc_naming.log" || die
- total_failed_tc=$((total_failed_tc + 1))
- break
- fi
- done
-done
-
-set -x
-
-if [ $((total_failed_tc + total_failed_su)) != "0" ]; then
- warn
- warn "Testcase naming checker: FAIL"
- exit 1
-fi
-
-warn
-warn "Testcase naming checker: PASS"