Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add testing & code coverage reporting #291

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: NRPE Tests

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: nrpe

- name: configure
run: |
mkdir build
cd build
../nrpe/configure
- name: build
run: |
cd build
make all

- name: configure [no ssl]
run: |
mkdir build_nossl
cd build_nossl
../nrpe/configure --disable-ssl
- name: build [no ssl]
run: |
cd build_nossl
make all

- name: install test prerequisites
run: |
sudo apt-get -y install libio-socket-ssl-perl libdigest-crc-perl
- name: test
run: |
cd build
make test
- name: test [no ssl]
run: |
cd build_nossl
make test
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,14 @@ startup/solaris-init.xml
startup/tmpfile.conf
startup/upstart-init

# Visual Studio Code IDE
.vscode

# gcov coverage files
*.gcno
*.gcda
nrpe.info-file
coverage-report/

tests/logs
tests/run
22 changes: 22 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,15 @@ install-groups-users:

clean:
cd $(SRC_BASE); $(MAKE) $@; cd ..
$(MAKE) -C tests $@
rm -f core
rm -f *~ */*~
rm -f nrpe.info-file
rm -rf coverage-report

distclean: clean
cd $(SRC_BASE); $(MAKE) $@; cd ..
$(MAKE) -C tests $@
rm -rf autom4te.cache
rm -f config.log config.status config.cache sample-config/nrpe.cfg $(SRC_INCLUDE)/config.h
rm -f startup/bsd-init startup/debian-init startup/default-init startup/default-inetd
Expand All @@ -199,3 +203,21 @@ distclean: clean

devclean: distclean

test:
$(MAKE) -C $(SRC_BASE) nrpe check_nrpe
$(MAKE) -C tests test

src/check_nrpe-check_nrpe.gcda:
$(MAKE) test

src/nrpe-nrpe.gcda:
$(MAKE) test

coverage: src/nrpe-nrpe.gcda src/check_nrpe-check_nrpe.gcda
@if ! which lcov >/dev/null 2>&1; then \
echo "ERROR: You must install lcov and genhtml first"; \
else \
lcov -c -d . -o nrpe.info-file; \
genhtml nrpe.info-file -o coverage-report; \
echo "Your coverage report is in coverage-report/index.html"; \
fi
Loading