Skip to content

Commit 39dda25

Browse files
[PATCH] fixes for integration testing script (- WIP #55 -)
Changes in file tests/check_integration_coverage: - fixed usage of multicast cli - new random port diognostics - some clarification comments added
1 parent d1ce7f7 commit 39dda25

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

tests/check_integration_coverage

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,24 @@ ulimit -t 60
6565
# PATH="/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
6666
umask 137
6767

68-
68+
# exported Env vars
6969
export LC_CTYPE="${LC_CTYPE:-'en_US.UTF-8'}"
7070

71-
LOCK_FILE="${TMPDIR:-/tmp}/org.pak.multicast.cov-integration-shell"
72-
EXIT_CODE=1
73-
71+
# dependencies
7472
test -x $(command -v grep) || exit 126 ;
7573
test -x $(command -v python3) || exit 126 ;
7674
test -x $(command -v git) || exit 126 ;
77-
hash -p ./.github/tool_shlock_helper.sh shlock || exit 255 ;
78-
test -x "$(command -v shlock)" || exit 126 ;
7975
test -x $(command -v make) || exit 126 ;
8076
test -x $(command -v tee) || exit 126 ;
77+
# CEP-5 locking
78+
hash -p ./.github/tool_shlock_helper.sh shlock || exit 255 ;
79+
test -x "$(command -v shlock)" || exit 126 ;
8180

81+
# rest of the script vars
8282
LOG_FILE="test_log_${PPID}.log"
8383
ERR_FILE="test_log_errors_${PPID}.log"
84+
LOCK_FILE="${TMPDIR:-/tmp}/org.pak.multicast.cov-integration-shell"
85+
EXIT_CODE=1
8486

8587
function cleanup() {
8688
rm -f ./${LOG_FILE} 2>/dev/null || true ; wait ;
@@ -104,9 +106,9 @@ else
104106
exit 126 ;
105107
fi
106108

107-
# this is how test files are found:
109+
# setup test fixtures
108110

109-
# THIS IS THE ACTUAL TEST
111+
# this is how test files are found:
110112
if _TEST_ROOT_DIR=$(git rev-parse --show-superproject-working-tree 2>/dev/null); then
111113
if [ -z "${_TEST_ROOT_DIR}" ]; then
112114
_TEST_ROOT_DIR=$(git rev-parse --show-toplevel 2>/dev/null)
@@ -120,11 +122,13 @@ TEST_MCAST_PORT=$(((RANDOM % 16384) + 49152));
120122
TEST_MCAST_GROUP='224.0.0.1' ;
121123
export COVERAGE_CMD="$(command -v python3) -m coverage run --source=multicast -p -m"
122124

125+
# start test-suite
126+
123127
make -j1 -f Makefile test-reports || EXIT_CODE=3 ;
124128
printf "%s\n\n" "Start of Log:" > ./${LOG_FILE} ; wait ;
125129
printf "%s\n\n" "Will use host-port: [${TEST_MCAST_GROUP} : ${TEST_MCAST_PORT}]" >> ./${LOG_FILE} ; wait ;
126130
printf "%s\n\n" "Start of Integration Test one-shot:" >> ./${LOG_FILE} ; wait ;
127-
( sleep 1 ; ${COVERAGE_CMD} multicast RECV --use-std --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GROUP} --groups ${TEST_MCAST_GROUP} 2>./${ERR_FILE} & sleep 6 ; kill -9 $! 2>/dev/null ) >> ./${LOG_FILE} & true ;
131+
( sleep 1 ; ${COVERAGE_CMD} multicast --use-std RECV --port ${TEST_MCAST_PORT} --groups ${TEST_MCAST_GROUP} --group ${TEST_MCAST_GROUP} 2>./${ERR_FILE} & sleep 6 ; kill -9 $! 2>/dev/null ) >> ./${LOG_FILE} & true ;
128132

129133
for PCOUNT in $(seq 1 5) ; do
130134
${COVERAGE_CMD} multicast SAY --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GROUP} --message "TEST from $PCOUNT" 2>/dev/null & sleep 1 ;
@@ -146,6 +150,8 @@ ${COVERAGE_CMD} multicast SAY --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GRO
146150
wait ;
147151
printf "%s\n\n" "End of Integration Test daemon" >> ./${LOG_FILE} ; wait ;
148152

153+
# cleanup from test-suite
154+
149155
$(command -v python3) -m coverage combine 2>/dev/null || EXIT_CODE=2 ;
150156
$(command -v python3) -m coverage xml --include=multicast/* -o ./test-reports/coverage_supplement.xml || EXIT_CODE=2 ;
151157

0 commit comments

Comments
 (0)