Skip to content

Commit

Permalink
* Hotfix-143-B:
Browse files Browse the repository at this point in the history
  [COVERAGE] add additional coverage testing for legacy build system (- WIP #46 & #49 & #50 -)
  • Loading branch information
reactive-firewall committed Aug 29, 2024
2 parents 1d14c9a + cdd5775 commit 6b8269f
Show file tree
Hide file tree
Showing 5 changed files with 261 additions and 38 deletions.
83 changes: 78 additions & 5 deletions .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
directory: .
flags: ${{ matrix.os }},${{ matrix.python-version }}
flags: multicast,${{ matrix.os }},${{ matrix.python-version }}
name: multicast-github-${{ matrix.os }}-${{ matrix.python-version }}
verbose: true
fail_ci_if_error: false
Expand Down Expand Up @@ -441,7 +441,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./test-reports/coverage_supplement.xml
directory: .
flags: ${{ matrix.os }},${{ matrix.python-version }},unittests
flags: multicast,${{ matrix.os }},${{ matrix.python-version }}
name: multicast-github-${{ matrix.os }}-${{ matrix.python-version }}
verbose: true
fail_ci_if_error: false
Expand All @@ -462,7 +462,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./test-reports/junit.xml
directory: .
flags: ${{ matrix.os }},${{ matrix.python-version }},unittests
flags: multicast,${{ matrix.os }},${{ matrix.python-version }}
name: multicast-github-${{ matrix.os }}-${{ matrix.python-version }}-test-results
verbose: true
fail_ci_if_error: false
Expand All @@ -471,10 +471,83 @@ jobs:
run: make -j1 -f Makefile purge || true ;
if: ${{ !cancelled() }}
- name: Post-Clean
id: post-z-end
id: post-end
run: make -j1 -f Makefile clean || true ;
if: ${{ !cancelled() }}


EXTRAS:
if: ${{ success() }}
needs: [BOOTSTRAP]
runs-on: ${{ matrix.os }}
timeout-minutes: 10
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.10", "3.11", "3.12"]
env:
OS: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}
LANG: "en_US.utf-8"
LC_CTYPE: "en_US.utf-8"
COVERAGE_RCFILE: ./.coveragerc
COV_CORE_SOURCE: ./
COV_CORE_CONFIG: ./.coveragerc
COV_CORE_DATAFILE: .coverage
CODECLIMATE_REPO_TOKEN: ${{ secrets.CODECLIMATE_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies for python ${{ matrix.python-version }} on ${{ matrix.os }}
run: |
pip install --upgrade pip setuptools build wheel
pip install -r ./requirements.txt ;
pip install coverage ;
pip install pytest ;
pip install pytest-cov ;
- name: Pre-Clean
id: clean-prep
run: make -j1 -f Makefile clean ;
- name: Pre-build for Python ${{ matrix.python-version }} on ${{ matrix.os }}
run: make -j1 -f Makefile build ;
if: ${{ success() }}
- name: Pre-install for Python ${{ matrix.python-version }} on ${{ matrix.os }}
run: make -j1 -f Makefile user-install || true ;
if: ${{ success() }}
- name: Generate Extra Legacy Setup Coverage for py${{ matrix.python-version }} on ${{ matrix.os }}
run: |
hash -p ./.github/tool_shlock_helper.sh shlock ;
./tests/check_legacy_setup_coverage || echo "::warning file=tests/check_legacy_setup_coverage,line=1,endLine=1,title=SKIPPED::SKIP Legacy Setup.py Tests." ;
shell: bash
- name: Upload Python ${{ matrix.python-version }} Legacy Setup.py coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./test-reports/coverage_setup.xml
directory: .
flags: multicast,${{ matrix.os }},${{ matrix.python-version }}
name: multicast-github-${{ matrix.os }}-${{ matrix.python-version }}
verbose: true
fail_ci_if_error: false
- name: Upload Extra Python ${{ matrix.python-version }} Artifact
uses: actions/upload-artifact@v4
with:
name: Legacy_Setup-Test-Report-${{ matrix.os }}-${{ matrix.python-version }}
path: ./test-reports/
if-no-files-found: ignore
- name: Post-purge
id: post-uninstall
run: make -j1 -f Makefile purge || true ;
if: ${{ !cancelled() }}
- name: Post-Clean
id: post-end
run: make -j1 -f Makefile clean || true ;
if: ${{ !cancelled() }}


TOX:
if: ${{ success() }}
needs: [MATS, COVERAGE-MATS, STYLE, COVERAGE, INTEGRATION]
Expand Down Expand Up @@ -510,4 +583,4 @@ jobs:
- name: Post-Clean
id: post
run: make -j1 -f Makefile clean || true ;
if: ${{ always() }}
if: ${{ !cancelled() }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ uninstall:

purge: clean uninstall
$(QUIET)$(PYTHON) -W ignore ./setup.py uninstall 2>/dev/null || true
$(QUIET)$(PYTHON) -W ignore ./setup.py clean || true
$(QUIET)$(PYTHON) -W ignore ./setup.py clean 2>/dev/null || true
$(QUIET)$(RMDIR) ./build/ 2>/dev/null || true
$(QUIET)$(RMDIR) ./dist/ 2>/dev/null || true
$(QUIET)$(RMDIR) ./.eggs/ 2>/dev/null || true
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=40.8.0", "wheel"]
requires = ["setuptools>=40.8.0", "build>=1.1.1", "wheel"]
build-backend = "setuptools.build_meta"

[pytest.enabler.flake8]
Expand All @@ -9,4 +9,4 @@ addopts = "--flake8"
addopts = "--doctest-glob=**/*.py --doctest-modules"

[pytest.enabler.cov]
addopts = "--cov=. --cov-append --cov-report=xml --junitxml=test-reports/junit.xml"
addopts = "--cov= --cov-append --cov-report=xml --junitxml=test-reports/junit.xml"
60 changes: 30 additions & 30 deletions tests/check_integration_coverage
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ umask 137

export LC_CTYPE="${LC_CTYPE:-'en_US.UTF-8'}"

LOCK_FILE="${TMPDIR:-/tmp}/cov_integration_test_script_lock"
LOCK_FILE="${TMPDIR:-/tmp}/org.pak.multicast.cov-integration-shell"
EXIT_CODE=1

test -x $(command -v grep) || exit 126 ;
Expand Down Expand Up @@ -100,7 +100,7 @@ if [[ ( $(shlock -f ${LOCK_FILE} -p $$ ) -eq 0 ) ]] ; then
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}` ;
printf "%s\n" "Check Integration Tests Coverage already in progress by "`head ${LOCK_FILE}` ;
exit 126 ;
fi

Expand All @@ -113,61 +113,61 @@ if [[ -d ./multicast ]] ; then
elif [[ -d ./tests ]] ; then
_TEST_ROOT_DIR="./" ;
else
echo "FAIL: missing valid folder or file"
printf "%s\n" "FAIL: missing valid folder or file"
EXIT_CODE=1
fi

TEST_PORT=59595;
TEST_MCAST_PORT=59595;
TEST_MCAST_GROUP='224.0.0.1' ;
export COVERAGE_CMD="$(command -v python3) -m coverage run --source=multicast -p -m"

make -j1 -f Makefile test-reports || EXIT_CODE=3 ;
echo "Start of Log:" > ./${LOG_FILE} ; wait ;
echo "" >> ./${LOG_FILE} ; wait ;
echo "Start of Integration Test one-shot:" >> ./${LOG_FILE} ; wait ;
echo "" >> ./${LOG_FILE} ; wait ;
( sleep 1 ; ${COVERAGE_CMD} multicast RECV --use-std --port ${TEST_PORT} --groups ${TEST_MCAST_GROUP} --group ${TEST_MCAST_GROUP} 2>./${ERR_FILE} & sleep 6 ; kill -9 $! 2>/dev/null ) >> ./${LOG_FILE} & true ;
printf "%s\n" "Start of Log:" > ./${LOG_FILE} ; wait ;
printf "%s\n" "" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "Start of Integration Test one-shot:" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "" >> ./${LOG_FILE} ; wait ;
( sleep 1 ; ${COVERAGE_CMD} multicast RECV --use-std --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 ;

for PCOUNT in $(seq 1 5) ; do
${COVERAGE_CMD} multicast SAY --port ${TEST_PORT} --mcast-group ${TEST_MCAST_GROUP} --message "TEST from $PCOUNT" 2>/dev/null & sleep 1 ;
${COVERAGE_CMD} multicast SAY --port ${TEST_MCAST_PORT} --mcast-group ${TEST_MCAST_GROUP} --message "TEST from $PCOUNT" 2>/dev/null & sleep 1 ;
done ;

${COVERAGE_CMD} multicast SAY --port ${TEST_PORT} --group ${TEST_MCAST_GROUP} --message "STOP from $TEST_MCAST_GROUP" 2>/dev/null & sleep 1 ;
${COVERAGE_CMD} multicast SAY --port ${TEST_PORT} --group ${TEST_MCAST_GROUP} --message "STOP" 2>/dev/null ;
echo "End of Integration Test one-shot" >> ./${LOG_FILE} ; wait ;
echo "" >> ./${LOG_FILE} ; wait ;
${COVERAGE_CMD} multicast SAY --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GROUP} --message "STOP from $TEST_MCAST_GROUP" 2>/dev/null & sleep 1 ;
${COVERAGE_CMD} multicast SAY --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GROUP} --message "STOP" 2>/dev/null ;
printf "%s\n" "End of Integration Test one-shot" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "" >> ./${LOG_FILE} ; wait ;

echo "Start of Integration Test deamon:" >> ./${LOG_FILE} ; wait ;
echo "" >> ./${LOG_FILE} ; wait ;
( sleep 1 ; ${COVERAGE_CMD} multicast --deamon HEAR --port ${TEST_PORT} --group ${TEST_MCAST_GROUP} 2>./${ERR_FILE} & sleep 6 ; kill -9 $! 2>/dev/null ) >> ./${LOG_FILE} & true ;
printf "%s\n" "Start of Integration Test deamon:" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "" >> ./${LOG_FILE} ; wait ;
( sleep 1 ; ${COVERAGE_CMD} multicast --deamon HEAR --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GROUP} 2>./${ERR_FILE} & sleep 6 ; kill -9 $! 2>/dev/null ) >> ./${LOG_FILE} & true ;

for PCOUNT in $(seq 1 5) ; do
${COVERAGE_CMD} multicast SAY --port ${TEST_PORT} --group ${TEST_MCAST_GROUP} --message "TEST from $PCOUNT" 2>/dev/null & true ;
${COVERAGE_CMD} multicast SAY --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GROUP} --message "TEST from $PCOUNT" 2>/dev/null & : ;
done ;

${COVERAGE_CMD} multicast SAY --port ${TEST_PORT} --group ${TEST_MCAST_GROUP} --message "STOP from $TEST_MCAST_GROUP" 2>/dev/null & sleep 1 ;
${COVERAGE_CMD} multicast SAY --port ${TEST_PORT} --group ${TEST_MCAST_GROUP} --message "STOP" 2>/dev/null ;
${COVERAGE_CMD} multicast SAY --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GROUP} --message "STOP from $TEST_MCAST_GROUP" 2>/dev/null & sleep 1 ;
${COVERAGE_CMD} multicast SAY --port ${TEST_MCAST_PORT} --group ${TEST_MCAST_GROUP} --message "STOP" 2>/dev/null ;
wait ;
echo "End of Integration Test deamon" >> ./${LOG_FILE} ; wait ;
echo "" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "End of Integration Test deamon" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "" >> ./${LOG_FILE} ; wait ;

$(command -v python3) -m coverage combine 2>/dev/null || EXIT_CODE=2 ;
$(command -v python3) -m coverage xml -o ./test-reports/coverage_supplement.xml || EXIT_CODE=2 ;
$(command -v python3) -m coverage xml --include=multicast/* -o ./test-reports/coverage_supplement.xml || EXIT_CODE=2 ;

wait ;
cp -f ./${LOG_FILE} ./test-reports/integration_data_log.log 2>/dev/null ; wait ;
echo "" | tee -a ./test-reports/integration_data_log.log ; wait ;
printf "%s\n" "" | tee -a ./test-reports/integration_data_log.log ; wait ;

if [[ ( -r ./${ERR_FILE} ) ]] ; then
echo "Errors: " | tee -a ./test-reports/integration_data_log.log ; wait ;
printf "%s\n" "Errors: " | tee -a ./test-reports/integration_data_log.log ; wait ;
cat <./${ERR_FILE} | tee -a ./test-reports/integration_data_log.log ; wait ;
fi

unset COVERAGE_CMD 2>/dev/null || true ;
unset TEST_MCAST_GROUP 2>/dev/null || true ;
unset TEST_PORT 2>/dev/null || true ;
unset COVERAGE_CMD 2>/dev/null || : ;
unset TEST_MCAST_GROUP 2>/dev/null || : ;
unset TEST_MCAST_PORT 2>/dev/null || : ;

cleanup || true ; wait ;
rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ;
cleanup || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ;

# goodbye
exit ${EXIT_CODE:-255} ;
150 changes: 150 additions & 0 deletions tests/check_legacy_setup_coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#! /bin/bash
# Disclaimer of Warranties.
# A. YOU EXPRESSLY ACKNOWLEDGE AND AGREE THAT, TO THE EXTENT PERMITTED BY
# APPLICABLE LAW, USE OF THIS SHELL SCRIPT AND ANY SERVICES PERFORMED
# BY OR ACCESSED THROUGH THIS SHELL SCRIPT IS AT YOUR SOLE RISK AND
# THAT THE ENTIRE RISK AS TO SATISFACTORY QUALITY, PERFORMANCE, ACCURACY AND
# EFFORT IS WITH YOU.
#
# B. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SHELL SCRIPT
# AND SERVICES ARE PROVIDED "AS IS" AND “AS AVAILABLE”, WITH ALL FAULTS AND
# WITHOUT WARRANTY OF ANY KIND, AND THE AUTHOR OF THIS SHELL SCRIPT'S LICENSORS
# (COLLECTIVELY REFERRED TO AS "THE AUTHOR" FOR THE PURPOSES OF THIS DISCLAIMER)
# HEREBY DISCLAIM ALL WARRANTIES AND CONDITIONS WITH RESPECT TO THIS SHELL SCRIPT
# SOFTWARE AND SERVICES, EITHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
# NOT LIMITED TO, THE IMPLIED WARRANTIES AND/OR CONDITIONS OF
# MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE,
# ACCURACY, QUIET ENJOYMENT, AND NON-INFRINGEMENT OF THIRD PARTY RIGHTS.
#
# C. THE AUTHOR DOES NOT WARRANT AGAINST INTERFERENCE WITH YOUR ENJOYMENT OF THE
# THE AUTHOR's SOFTWARE AND SERVICES, THAT THE FUNCTIONS CONTAINED IN, OR
# SERVICES PERFORMED OR PROVIDED BY, THIS SHELL SCRIPT WILL MEET YOUR
# REQUIREMENTS, THAT THE OPERATION OF THIS SHELL SCRIPT OR SERVICES WILL
# BE UNINTERRUPTED OR ERROR-FREE, THAT ANY SERVICES WILL CONTINUE TO BE MADE
# AVAILABLE, THAT THIS SHELL SCRIPT OR SERVICES WILL BE COMPATIBLE OR
# WORK WITH ANY THIRD PARTY SOFTWARE, APPLICATIONS OR THIRD PARTY SERVICES,
# OR THAT DEFECTS IN THIS SHELL SCRIPT OR SERVICES WILL BE CORRECTED.
# INSTALLATION OF THIS THE AUTHOR SOFTWARE MAY AFFECT THE USABILITY OF THIRD
# PARTY SOFTWARE, APPLICATIONS OR THIRD PARTY SERVICES.
#
# D. YOU FURTHER ACKNOWLEDGE THAT THIS SHELL SCRIPT AND SERVICES ARE NOT
# INTENDED OR SUITABLE FOR USE IN SITUATIONS OR ENVIRONMENTS WHERE THE FAILURE
# OR TIME DELAYS OF, OR ERRORS OR INACCURACIES IN, THE CONTENT, DATA OR
# INFORMATION PROVIDED BY THIS SHELL SCRIPT OR SERVICES COULD LEAD TO
# DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE,
# INCLUDING WITHOUT LIMITATION THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT
# NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, LIFE SUPPORT OR
# WEAPONS SYSTEMS.
#
# E. NO ORAL OR WRITTEN INFORMATION OR ADVICE GIVEN BY THE AUTHOR
# SHALL CREATE A WARRANTY. SHOULD THIS SHELL SCRIPT OR SERVICES PROVE DEFECTIVE,
# YOU ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
#
# Limitation of Liability.
# F. TO THE EXTENT NOT PROHIBITED BY APPLICABLE LAW, IN NO EVENT SHALL THE AUTHOR
# BE LIABLE FOR PERSONAL INJURY, OR ANY INCIDENTAL, SPECIAL, INDIRECT OR
# CONSEQUENTIAL DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, DAMAGES
# FOR LOSS OF PROFITS, CORRUPTION OR LOSS OF DATA, FAILURE TO TRANSMIT OR
# RECEIVE ANY DATA OR INFORMATION, BUSINESS INTERRUPTION OR ANY OTHER
# COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR
# INABILITY TO USE THIS SHELL SCRIPT OR SERVICES OR ANY THIRD PARTY
# SOFTWARE OR APPLICATIONS IN CONJUNCTION WITH THIS SHELL SCRIPT OR
# SERVICES, HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT,
# TORT OR OTHERWISE) AND EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGES. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION
# OR LIMITATION OF LIABILITY FOR PERSONAL INJURY, OR OF INCIDENTAL OR
# CONSEQUENTIAL DAMAGES, SO THIS LIMITATION MAY NOT APPLY TO YOU. In no event
# shall THE AUTHOR's total liability to you for all damages (other than as may
# be required by applicable law in cases involving personal injury) exceed
# the amount of five dollars ($5.00). The foregoing limitations will apply
# even if the above stated remedy fails of its essential purpose.
################################################################################

ulimit -t 60
# setting the path may break brain-dead CI that uses crazy paths
# PATH="/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"
umask 137

export LC_CTYPE="${LC_CTYPE:-'en_US.UTF-8'}"

LOCK_FILE="${TMPDIR:-/tmp}/org.pak.multicast.cov-legacy-setup-shell"
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 ;

LOG_FILE="test_log_${PPID}.log"
ERR_FILE="test_log_errors_${PPID}.log"

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

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 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
printf "%s\n" "Check Setup Scripts Tests Coverage already in progress by "`head ${LOCK_FILE}` ;
exit 126 ;
fi

# this is how test files are found:

# THIS IS THE ACTUAL TEST
_TEST_ROOT_DIR="./" ;
if [[ -d ./multicast ]] ; then
_TEST_ROOT_DIR="./" ;
elif [[ -d ./tests ]] ; then
_TEST_ROOT_DIR="./" ;
else
printf "%s\n" "FAIL: missing valid folder or file"
EXIT_CODE=1
fi

export COVERAGE_CMD="$(command -v python3) -m coverage run --include=setup.py -p"

make -j1 -f Makefile test-reports || EXIT_CODE=3 ;
printf "%s\n" "Start of Log:" > ./${LOG_FILE} ; wait ;
printf "%s\n" "" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "Start of Setup.py Test one-shot:" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "" >> ./${LOG_FILE} ; wait ;

{ ${COVERAGE_CMD} ./setup.py --version 2>./${ERR_FILE} | grep --count -oE "^([0-9].){2}[0-9]$" 2>./${ERR_FILE} || echo "FAIL: Setup.py version check failed" 1>&2 ;} 2>./${ERR_FILE} >> ./${LOG_FILE} & true ;

wait ;
printf "%s\n" "End of Setup.py Test one-shot" >> ./${LOG_FILE} ; wait ;
printf "%s\n" "" >> ./${LOG_FILE} ; wait ;

$(command -v python3) -m coverage combine 2>/dev/null || EXIT_CODE=2 ;
$(command -v python3) -m coverage xml --include=setup.py,multicast -o ./test-reports/coverage_setup.xml || EXIT_CODE=2 ;

wait ;
cp -f ./${LOG_FILE} ./test-reports/legacy_setup_version_log.log 2>/dev/null ; wait ;
printf "%s\n" "" | tee -a ./test-reports/legacy_setup_version_log.log ; wait ;

if [[ ( -r ./${ERR_FILE} ) ]] ; then
printf "%s\n" "Errors: " | tee -a ./test-reports/legacy_setup_version_log.log ; wait ;
cat <./${ERR_FILE} | tee -a ./test-reports/legacy_setup_version_log.log ; wait ;
fi

unset COVERAGE_CMD 2>/dev/null || : ;

cleanup || rm -f ${LOCK_FILE} 2>/dev/null > /dev/null || true ; wait ;

# goodbye
exit ${EXIT_CODE:-255} ;

0 comments on commit 6b8269f

Please sign in to comment.