Skip to content

Commit

Permalink
Enable unit test file parsing via a GitHub action
Browse files Browse the repository at this point in the history
  • Loading branch information
neilcook committed Oct 19, 2023
1 parent d18497f commit 77d2fd2
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ jobs:
MAXMIND_LICENSE_KEY: ${{ secrets.MAXMIND_LICENSE_KEY }}
- run: make dist
- run: make distcheck
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
docker/tmp/*.xml
4 changes: 2 additions & 2 deletions docker/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ clean_docker:
clean: clean_docker

regression-gcc: build_image start
$(DCMP) exec -T $(REGRESSION_SERVICE) docker/regression/regression.sh gcc g++ --enable-sodium
$(DCMP) exec -T $(REGRESSION_SERVICE) docker/regression/regression.sh gcc g++ --enable-sodium /var/tmp/testlog/gcctest.xml

regression-clang: build_image start
$(DCMP) exec -T $(REGRESSION_SERVICE) docker/regression/regression.sh clang clang++ --disable-sodium
$(DCMP) exec -T $(REGRESSION_SERVICE) docker/regression/regression.sh clang clang++ --disable-sodium /var/tmp/testlog/clangtest.xml

regression-none:
echo "Regression tests skipped due to compiler 'none'"
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ services:
- MAXMIND_LICENSE_KEY=${MAXMIND_LICENSE_KEY}
volumes:
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
- ./tmp:/var/tmp/testlog
links:
- elasticsearch
- logstash
Expand Down
7 changes: 5 additions & 2 deletions docker/regression/regression.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,30 @@

set -e

if [ $# -ne 3 ]
if [ $# -ne 4 ]
then
export MYCC=clang
export MYCXX=clang++
export SODIUM=
export TESTFILE=pytest.xml
else
export MYCC=$1
export MYCXX=$2
export SODIUM=$3
export TESTFILE=$4
fi

echo "CC=$MYCC"
echo "CXX=$MYCXX"
echo "TESTFILE=$TESTFILE"

autoreconf -v -i -f
./configure --enable-trackalert --enable-systemd --disable-docker --enable-unit-tests --enable-asan --enable-ubsan $SODIUM --disable-silent-rules CC=$MYCC CXX=$MYCXX
make clean
make
make check || (cat common/test-suite.log && false)
cd regression-tests
./runtests
./runtests $TESTFILE
cd ..
make dist
export WF_VERSION=`grep PACKAGE_VERSION Makefile | awk '{ print $3}'`
Expand Down
5 changes: 4 additions & 1 deletion regression-tests/runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ def sighandler(signum, frame):

try:
print("")
p = subprocess.check_call(["pytest", "--junitxml", "pytest.xml"], env=test_env)
if len(sys.argv) > 1:
p = subprocess.check_call(["pytest", "--junitxml", sys.argv[1]], env=test_env)
else:
p = subprocess.check_call(["pytest", "--junitxml", "pytest.xml"], env=test_env)
except subprocess.CalledProcessError as ex:
rc = ex.returncode
finally:
Expand Down

0 comments on commit 77d2fd2

Please sign in to comment.