1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-05 06:57:26 +00:00

tests: static checker: Add announce message

Added an announcement message to the `static-checks.sh` script. It runs
platform / architecture specific code so it would be useful to display
details of the platform the checker is running on to help with
debugging.

Fixes: .

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
This commit is contained in:
James O. D. Hunt 2024-03-11 13:30:16 +00:00
parent 4af4a8ad2b
commit 577abd014b

View File

@ -1404,6 +1404,56 @@ setup()
trap remove_tmp_files EXIT
}
# Display a message showing some system details.
announce()
{
local arch
arch=$(uname -m)
local file='/proc/cpuinfo'
local detail
detail=$(grep -m 1 -E '\<vendor_id\>|\<cpu\> * *:' "$file" \
2>/dev/null |\
cut -d: -f2- |\
tr -d ' ' || true)
local arch="$arch"
[ -n "$detail" ] && arch+=" ('$detail')"
local kernel
kernel=$(uname -r)
local distro_name
local distro_version
distro_name="${NAME:-}"
distro_version="${VERSION:-}"
local -a lines
local IFS=$'\n'
lines=( $(cat <<-EOF
Running static checks:
script: $script_name
architecture: $arch
kernel: $kernel
distro:
name: $distro_name
version: $distro_version
EOF
))
local line
for line in "${lines[@]}"
do
info "$line"
done
}
main()
{
setup
@ -1482,6 +1532,8 @@ main()
repo_path=$GOPATH/src/$repo
announce
local all_check_funcs=$(typeset -F|awk '{print $3}'|grep "${check_func_regex}"|sort)
# Run user-specified check and quit