From 636ed523bd7c6880366ee9498e4a61df1a724af6 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 20 Dec 2025 12:51:01 +0000 Subject: [PATCH] Enhanced test and syntax check scripts to add non-scrolling command line header --- .gitignore | 1 + test/run-syntax-checks.sh | 40 +++++++++++++++++++++++++++++ test/run-tests.sh | 54 ++++++++++++++++++++++++++++++++++----- 3 files changed, 89 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 068e7602..ced27dae 100644 --- a/.gitignore +++ b/.gitignore @@ -411,3 +411,4 @@ examples/UniquePtrWithPool/UniquePtrWithPool test/vs2022/Debug Clang C++20 - Optimised -O2 include/etl/header_file_list.txt temp +test/syntax_check/build-make diff --git a/test/run-syntax-checks.sh b/test/run-syntax-checks.sh index 18a65523..9991a54e 100644 --- a/test/run-syntax-checks.sh +++ b/test/run-syntax-checks.sh @@ -5,11 +5,32 @@ echo -e configuration_name="Configuration Name Not Set" +# Define colours FailColour='\033[38;2;255;128;128m' PassColour='\033[38;2;128;255;128m' TitleColour='\033[38;2;107;210;255m' HelpColour='\033[38;2;250;180;250m' NoColour='\033[0m' +CommandColour='\033[38;2;255;255;128m' + +# Save cursor position +tput sc + +# Clear screen +tput clear + +# Write fixed header on line 1 +tput cup 0 0 +echo $CommandColour "run-syntax-checks.sh" $1 $2 $3 $4 $5 $NoColour + +# Define scrolling region from line 2 to bottom +tput csr 2 $(($(tput lines) - 1)) + +# Restore cursor position +tput rc + +# Move cursor to start of scrollable area +tput cup 1 0 ParseGitBranch() { @@ -81,6 +102,25 @@ ChecksCompleted() echo "$NoColour" } +cleanup() +{ + # Reset scroll region to full screen + tput csr 0 $(($(tput lines) - 1)) + # Move cursor to a safe line (bottom of terminal) + tput cup $(($(tput lines) - 1)) 0 +} + +ctrl_c() +{ + # Reset scroll region to full screen + tput csr 0 $(($(tput lines) - 1)) + # Move cursor to a safe line (bottom of terminal) + tput cup $(($(tput lines) - 1)) 0 +} + +trap ctrl_c INT +trap cleanup EXIT + cd syntax_check || exit 1 echo "" > log.txt diff --git a/test/run-tests.sh b/test/run-tests.sh index e914114b..8f756794 100755 --- a/test/run-tests.sh +++ b/test/run-tests.sh @@ -4,16 +4,37 @@ shopt -s xpg_echo clear -export ASAN_OPTIONS=symbol_line=1 -export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-14/bin//llvm-symbolizer - -configuration_name="Configuration Name Not Set" - +# Define colours FailColour='\033[38;2;255;128;128m' PassColour='\033[38;2;128;255;128m' TitleColour='\033[38;2;107;210;255m' HelpColour='\033[38;2;250;180;250m' NoColour='\033[0m' +CommandColour='\033[38;2;255;255;128m' + +# Save cursor position +tput sc + +# Clear screen +tput clear + +# Write fixed header on line 1 +tput cup 0 0 +echo $CommandColour "run-tests.sh" $1 $2 $3 $4 $5 $NoColour + +# Define scrolling region from line 2 to bottom +tput csr 2 $(($(tput lines) - 1)) + +# Restore cursor position +tput rc + +# Move cursor to start of scrollable area +tput cup 1 0 + +export ASAN_OPTIONS=symbol_line=1 +export ASAN_SYMBOLIZER_PATH=/usr/lib/llvm-14/bin//llvm-symbolizer + +configuration_name="Configuration Name Not Set" ParseGitBranch() { @@ -179,10 +200,31 @@ fi etl_version_raw=$(cat ../version.txt) etl_version=$(echo $etl_version_raw | sed -e 's/\r//g') # Remove trailing \r +cleanup() +{ + # Reset scroll region to full screen + tput csr 0 $(($(tput lines) - 1)) + # Move cursor to a safe line (bottom of terminal) + tput cup $(($(tput lines) - 1)) 0 +} + +ctrl_c() +{ + # Reset scroll region to full screen + tput csr 0 $(($(tput lines) - 1)) + # Move cursor to a safe line (bottom of terminal) + tput cup $(($(tput lines) - 1)) 0 +} + +trap ctrl_c INT +trap cleanup EXIT + +cd syntax_check || exit 1 +echo "" > log.txt + #****************************************************************************** # Get the compiler versions #****************************************************************************** - while read i ; do CC=`echo $i | cut -d, -f1 | sed -e 's/ *$//'` MSG=`echo $i | cut -d, -f2 | sed -e 's/ *$//'`