debug-test.sh: comment style changes
This commit is contained in:
parent
edec5ba3d7
commit
2304113b1c
1 changed files with 21 additions and 1 deletions
|
@ -12,6 +12,10 @@ magenta=$(tput setaf 5)
|
||||||
cyan=$(tput setaf 6)
|
cyan=$(tput setaf 6)
|
||||||
normal=$(tput sgr0)
|
normal=$(tput sgr0)
|
||||||
|
|
||||||
|
|
||||||
|
# Print Help Message
|
||||||
|
####################
|
||||||
|
|
||||||
print_full_help() {
|
print_full_help() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: $PROG [OPTION]... <test_regex> (test_number)
|
Usage: $PROG [OPTION]... <test_regex> (test_number)
|
||||||
|
@ -41,6 +45,10 @@ EOF
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Dependency Sanity Check
|
||||||
|
#########################
|
||||||
|
|
||||||
check_dependency() {
|
check_dependency() {
|
||||||
command -v "$1" >/dev/null 2>&1 || {
|
command -v "$1" >/dev/null 2>&1 || {
|
||||||
abort "$1 is required but not found. Please install it and try again."
|
abort "$1 is required but not found. Please install it and try again."
|
||||||
|
@ -50,6 +58,10 @@ check_dependency() {
|
||||||
check_dependency ctest
|
check_dependency ctest
|
||||||
check_dependency cmake
|
check_dependency cmake
|
||||||
|
|
||||||
|
|
||||||
|
# Step 0: Check the args
|
||||||
|
########################
|
||||||
|
|
||||||
if [ x"$1" = x"-h" ] || [ x"$1" = x"--help" ]; then
|
if [ x"$1" = x"-h" ] || [ x"$1" = x"--help" ]; then
|
||||||
print_full_help >&2
|
print_full_help >&2
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -69,15 +81,17 @@ done
|
||||||
# Shift the option parameters
|
# Shift the option parameters
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
# Step 0: Check the args
|
# Positionial Argument Processing : <test_regex>
|
||||||
if [ -z "${1}" ]; then
|
if [ -z "${1}" ]; then
|
||||||
abort "Test regex is required"
|
abort "Test regex is required"
|
||||||
else
|
else
|
||||||
test_suite=${1:-}
|
test_suite=${1:-}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Positionial Argument Processing : (test_number)
|
||||||
test_number=${2:-}
|
test_number=${2:-}
|
||||||
|
|
||||||
|
|
||||||
# Step 1: Reset and Setup folder context
|
# Step 1: Reset and Setup folder context
|
||||||
########################################
|
########################################
|
||||||
|
|
||||||
|
@ -91,6 +105,7 @@ fi
|
||||||
pushd "$repo_root"
|
pushd "$repo_root"
|
||||||
rm -rf "$build_dir" && mkdir "$build_dir" || abort "Failed to make $build_dir"
|
rm -rf "$build_dir" && mkdir "$build_dir" || abort "Failed to make $build_dir"
|
||||||
|
|
||||||
|
|
||||||
# Step 2: Setup Build Environment and Compile Test Binaries
|
# Step 2: Setup Build Environment and Compile Test Binaries
|
||||||
###########################################################
|
###########################################################
|
||||||
|
|
||||||
|
@ -100,6 +115,7 @@ pushd "$build_dir"
|
||||||
make -j || abort "Failed to compile"
|
make -j || abort "Failed to compile"
|
||||||
popd > /dev/null || exit 1
|
popd > /dev/null || exit 1
|
||||||
|
|
||||||
|
|
||||||
# Step 3: Find all tests available that matches REGEX
|
# Step 3: Find all tests available that matches REGEX
|
||||||
####################################################
|
####################################################
|
||||||
|
|
||||||
|
@ -115,6 +131,7 @@ if [ ${#tests[@]} -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
popd > /dev/null || exit 1
|
popd > /dev/null || exit 1
|
||||||
|
|
||||||
|
|
||||||
# Step 4: Identify Test Command for Debugging
|
# Step 4: Identify Test Command for Debugging
|
||||||
#############################################
|
#############################################
|
||||||
|
|
||||||
|
@ -151,8 +168,10 @@ popd > /dev/null || exit 1
|
||||||
single_test_name="${tests[test_number]}"
|
single_test_name="${tests[test_number]}"
|
||||||
single_test_command="${test_args[test_number]}"
|
single_test_command="${test_args[test_number]}"
|
||||||
|
|
||||||
|
|
||||||
# Step 5: Execute or GDB Debug
|
# Step 5: Execute or GDB Debug
|
||||||
##############################
|
##############################
|
||||||
|
|
||||||
printf "${magenta}Running Test #${test_number}: ${single_test_name}${normal}\n"
|
printf "${magenta}Running Test #${test_number}: ${single_test_name}${normal}\n"
|
||||||
printf "${cyan}single_test_command: ${single_test_command}${normal}\n"
|
printf "${cyan}single_test_command: ${single_test_command}${normal}\n"
|
||||||
|
|
||||||
|
@ -191,4 +210,5 @@ else
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Return to the directory from which the user ran the command.
|
||||||
popd > /dev/null || exit 1
|
popd > /dev/null || exit 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue