Skip to content

Commit

Permalink
[DOCUMENTATION] Implemented some extra exitcodes (- WIP #20 -)
Browse files Browse the repository at this point in the history
### ChangeLog:

Changes in file tests/check_cc_lines:
 Unknown Changes

Changes in file tests/check_codecov:
 else
 for i in 1 256 512 ; do

Changes in file tests/check_codecov_regression:
 function cleanup() {
 if [[ (${EXIT_CODE} -eq 0) ]] ; then

Changes in file tests/check_integration_coverage:
 ulimit -t 60

Changes in file tests/check_spelling:
 Unknown Changes
  • Loading branch information
reactive-firewall committed Aug 28, 2024
1 parent 72a30e5 commit df0fc31
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 42 deletions.
18 changes: 10 additions & 8 deletions tests/check_cc_lines
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ PATH="/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
umask 137

LOCK_FILE="${TMPDIR:-/tmp}/cc_line_test_script_lock"
EXIT_CODE=0
EXIT_CODE=1

test -x $(command -v grep) || exit 126 ;
test -x $(command -v curl) || exit 126 ;
Expand All @@ -77,17 +77,19 @@ test -x "$(command -v shlock)" || exit 126 ;

function cleanup() {
rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ;
hash -d shlock 2>/dev/null > /dev/null || true ;
}

if [[ ( $(shlock -f ${LOCK_FILE} -p $$ ) -eq 0 ) ]] ; then
trap 'cleanup ; wait ; exit 1 ;' SIGHUP || EXIT_CODE=3
trap 'cleanup ; wait ; exit 1 ;' SIGTERM || EXIT_CODE=4
trap 'cleanup ; wait ; exit 1 ;' SIGQUIT || EXIT_CODE=5
EXIT_CODE=0
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 129 ;' SIGHUP || EXIT_CODE=129
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 143 ;' SIGTERM || EXIT_CODE=143
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 131 ;' SIGQUIT || EXIT_CODE=131
# SC2173 - https://github.com/koalaman/shellcheck/wiki/SC2173
# trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'cleanup ; wait ; exit 1 ;' SIGINT || EXIT_CODE=8
trap 'cleanup ; wait ; exit 1 ;' SIGABRT || EXIT_CODE=9
trap 'cleanup ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
#trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 130 ;' SIGINT || EXIT_CODE=130
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true || true ; wait ; exit 137 ;' SIGABRT || EXIT_CODE=137
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
else
echo "Check for Copyright lines already in progress by "`head ${LOCK_FILE}` ;
false ;
Expand Down
24 changes: 13 additions & 11 deletions tests/check_codecov
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,23 @@ fi
function cleanup() {
rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ;
rm -f ./codecov 2>/dev/null || true ; wait ;
hash -d shlock 2>/dev/null > /dev/null || true ;
}

if [[ ( $(shlock -f ${LOCK_FILE} -p $$ ) -eq 0 ) ]] ; then
trap 'cleanup ; wait ; exit 1 ;' SIGHUP || EXIT_CODE=3
trap 'cleanup ; wait ; exit 1 ;' SIGTERM || EXIT_CODE=4
trap 'cleanup ; wait ; exit 1 ;' SIGQUIT || EXIT_CODE=5
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 129 ;' SIGHUP || EXIT_CODE=129
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 143 ;' SIGTERM || EXIT_CODE=143
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 131 ;' SIGQUIT || EXIT_CODE=131
# SC2173 - https://github.com/koalaman/shellcheck/wiki/SC2173
# trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'cleanup ; wait ; exit 1 ;' SIGINT || EXIT_CODE=8
trap 'cleanup ; wait ; exit 1 ;' SIGABRT || EXIT_CODE=9
trap 'cleanup ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
#trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 130 ;' SIGINT || EXIT_CODE=130
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true || true ; wait ; exit 137 ;' SIGABRT || EXIT_CODE=137
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
trap 'cleanup ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
else
echo "CodeCov already in progress by "`head ${LOCK_FILE}` ;
false ;
exit 126 ;
echo "CodeCov already in progress by "`head ${LOCK_FILE}` ;
false ;
exit 126 ;
fi

# this is how test files are found:
Expand Down Expand Up @@ -141,7 +143,7 @@ for i in 1 256 512 ; do
if [[ ( -r codecov.SHA${i}SUM ) ]] || [[ ( ${i} -eq 256 ) ]] ; then
if [[ ( -r codecov.SHA${i}SUM.sig ) ]] ; then
# configure your CI evironment to trust the key at https://keybase.io/codecovsecurity/pgp_keys.asc
# FP: 2703 4E7F DB85 0E0B BC2C 62FF 806B B28A ED77 9869
# FP: 2703 4E7F DB85 0E0B BC2C 62FF 806B B28A ED77 9869
# OR...
# Set CI=true to continue on missing keys
gpgv codecov.SHA${i}SUM.sig codecov.SHA${i}SUM || ${CI} || EXIT_CODE=126
Expand Down
13 changes: 7 additions & 6 deletions tests/check_codecov_regression
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ function cleanup() {

if [[ ( $(shlock -f ${LOCK_FILE} -p $$ ) -eq 0 ) ]] ; then
EXIT_CODE=0
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGHUP || EXIT_CODE=3
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGTERM || EXIT_CODE=4
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGQUIT || EXIT_CODE=5
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 129 ;' SIGHUP || EXIT_CODE=129
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 143 ;' SIGTERM || EXIT_CODE=143
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 131 ;' SIGQUIT || EXIT_CODE=131
# SC2173 - https://github.com/koalaman/shellcheck/wiki/SC2173
#trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGINT || EXIT_CODE=8
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true || true ; wait ; exit 1 ;' SIGABRT || EXIT_CODE=9
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 130 ;' SIGINT || EXIT_CODE=130
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true || true ; wait ; exit 137 ;' SIGABRT || EXIT_CODE=137
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
else
# shellcheck disable=SC2046
Expand Down Expand Up @@ -136,7 +137,7 @@ if [[ (${EXIT_CODE} -eq 0) ]] ; then
fi
if [[ (${EXIT_CODE} -eq 0) ]] ; then
printf "\t\t%s\n" "START: make -C "${_TEST_ROOT_DIR}" -f "${_TEST_ROOT_DIR}/Makefile" test-pytest" 2>&1 ;
make -C "${_TEST_ROOT_DIR}" -f "${_TEST_ROOT_DIR}/Makefile" test-pytest || EXIT_CODE=3 ;
make -C "${_TEST_ROOT_DIR}" -j1 -f "Makefile" test-pytest || EXIT_CODE=3 ;
wait ;
printf "\t\t%s\n" "END: make ... test-pytest" 2>&1 ;
if [[ (${EXIT_CODE} -eq 0) ]] ; then
Expand Down
20 changes: 12 additions & 8 deletions tests/check_integration_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ umask 137
export LC_CTYPE="${LC_CTYPE:-'en_US.UTF-8'}"

LOCK_FILE="${TMPDIR:-/tmp}/cov_integration_test_script_lock"
EXIT_CODE=0
EXIT_CODE=1

test -x $(command -v grep) || exit 126 ;
test -x $(command -v python3) || exit 126 ;
test -x $(command -v git) || exit 126 ;
hash -p ./.github/tool_shlock_helper.sh shlock || exit 255 ;
test -x "$(command -v shlock)" || exit 126 ;
test -x $(command -v make) || exit 126 ;
test -x $(command -v tee) || exit 126 ;

Expand All @@ -84,17 +86,19 @@ function cleanup() {
rm -f ./${LOG_FILE} 2>/dev/null || true ; wait ;
rm -f ./${ERR_FILE} 2>/dev/null || true ; wait ;
rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ;
hash -d shlock 2>/dev/null > /dev/null || true ;
}

if [[ ( $(shlock -f ${LOCK_FILE} -p $$ ) -eq 0 ) ]] ; then
trap 'cleanup ; wait ; exit 1 ;' SIGHUP || EXIT_CODE=3
trap 'cleanup ; wait ; exit 1 ;' SIGTERM || EXIT_CODE=4
trap 'cleanup ; wait ; exit 1 ;' SIGQUIT || EXIT_CODE=5
EXIT_CODE=0
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 129 ;' SIGHUP || EXIT_CODE=129
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 143 ;' SIGTERM || EXIT_CODE=143
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 131 ;' SIGQUIT || EXIT_CODE=131
# SC2173 - https://github.com/koalaman/shellcheck/wiki/SC2173
# trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'cleanup ; wait ; exit 1 ;' SIGINT || EXIT_CODE=8
trap 'cleanup ; wait ; exit 1 ;' SIGABRT || EXIT_CODE=9
trap 'cleanup ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
#trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 130 ;' SIGINT || EXIT_CODE=130
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true || true ; wait ; exit 137 ;' SIGABRT || EXIT_CODE=137
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
else
echo "Check Integration Tests Coverage already in progress by "`head ${LOCK_FILE}` ;
exit 126 ;
Expand Down
19 changes: 10 additions & 9 deletions tests/check_spelling
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,21 @@ PATH="/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
umask 137

LOCK_FILE="${TMPDIR:-/tmp}/spelling_test_script_lock"
EXIT_CODE=0
EXIT_CODE=1

# exit fast if command is missing
test -x /usr/bin/spellintian || exit 126 ;

if [[ ( $(shlock -f ${LOCK_FILE} -p $$ ) -eq 0 ) ]] ; then
trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGHUP || EXIT_CODE=3
trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGTERM || EXIT_CODE=4
trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGQUIT || EXIT_CODE=5
# SC2173 - https://github.com/koalaman/shellcheck/wiki/SC2173
# trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGINT || EXIT_CODE=8
trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit 1 ;' SIGABRT || EXIT_CODE=9
trap 'rm -f ${LOCK_FILE} 2>/dev/null || true ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
EXIT_CODE=0
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 129 ;' SIGHUP || EXIT_CODE=129
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 143 ;' SIGTERM || EXIT_CODE=143
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 131 ;' SIGQUIT || EXIT_CODE=131
# SC2173 - https://github.com/koalaman/shellcheck/wiki/SC2173
#trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 1 ;' SIGSTOP || EXIT_CODE=7
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit 130 ;' SIGINT || EXIT_CODE=130
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true || true ; wait ; exit 137 ;' SIGABRT || EXIT_CODE=137
trap 'cleanup 2>/dev/null || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ; exit ${EXIT_CODE} ;' EXIT || EXIT_CODE=1
else
echo Test already in progress by `head ${LOCK_FILE}` ;
false ;
Expand Down

0 comments on commit df0fc31

Please sign in to comment.