X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils.sh;h=8fcb0da38c2a8f4a3f9ca8af0484edf8b8aa4ee3;hp=42b18e383d6104b52c70beba6608d5d58c48e8fa;hb=fec81a7e6e7d21bef1a16643404ac5016009feb3;hpb=2d7e012dc1d47b55bf37e05d9c2a76bad7620e31 diff --git a/tests/utils.sh b/tests/utils.sh index 42b18e383..8fcb0da38 100644 --- a/tests/utils.sh +++ b/tests/utils.sh @@ -25,6 +25,38 @@ KERNEL_MAJOR_VERSION=2 KERNEL_MINOR_VERSION=6 KERNEL_PATCHLEVEL_VERSION=27 +function print_ok () +{ + # Check if we are a terminal + if [ -t 1 ]; then + echo -e "\e[1;32mOK\e[0m" + else + echo -e "OK" + fi +} + +function print_fail () +{ + # Check if we are a terminal + if [ -t 1 ]; then + echo -e "\e[1;31mFAIL\e[0m" + else + echo -e "FAIL" + fi +} + +function print_test_banner () +{ + desc="$1" + + count=$((${#desc}+2)) + str=$(printf "%${count}s"); + echo -e "\n" + echo -e ${str// /-} + echo -e " $desc " + echo -e ${str// /-} +} + function validate_kernel_version () { kern_version=($(uname -r | awk -F. '{ printf("%d.%d.%d\n",$1,$2,$3); }' | tr '.' '\n'))