This is a test system for INN. It’s not very complete yet. It requires Python 3.
- Edit
configto meet your local settings. - Create
tnewsuser and group. (You can select a different name in config.) - Run
test-allto build, install and test INN.
See below for how to run it under Docker, if you prefer.
If anything goes wrong and you can’t see why, consult *.log files.
A more fine-grained approach is to run build to build INN and then
run individual test scripts to install and test with particular
configurations.
The test configurations are:
test-innfeed- default test configurationtest-nntpsend- test with nntpsend and buffindexed overview
You can start and stop the server in its current configuration, and run tests by hand:
./start
./test-nntpbits manual
# ... edit, repeat ...
./shutdown
Either set VALGRIND=true in config, or pass it in as environment variable:
VALGRIND=true ./test-innfeed
You can enable code coverage recording, with a suitable compiler. Example:
CC="gcc --coverage" CFLAGS="-g -O0" ./test-all
Note that since ./build does make check the results will include
coverage information from that too. If you want to exclude this data
by manually running ./build with options above and then remove the
*.gcda files:
find ../inn-build -name '*.gcda' -delete
gcov likes to write its *.gcda files into the build directory, so
make sure that it, and all its subdirectories, are writable by the
user the news server runs as.
I use Viewgcov to inspect the results. Start it in the build directory and select File→Refresh.
You can enable sanitizers, if you have a suitable compiler. Examples:
CC="gcc -fsanitize=address,undefined" \
CFLAGS="-g -O1 -fno-optimize-sibling-calls -fno-omit-frame-pointer -fno-sanitize-recover" \
./test-all
Note that the build process runs make check, so that had better be
‘clean’ under your chosen sanitizer options. It’s likely to be easier
to debug any issues directly rather than via inntest.
Look in $PREFIX/log/errlog for error log output from innd.
The tests are actually run by tests.py, which in turn uses
nntpbits/Tests.py to do the work. This is part of a general NNTP
support framework; see the other files inside nntpbits for details,
or experiment with the utilities post.py, getgroup.py and
server.py which all use it.
Testing can be run in a Docker container.
First you must enable IPv6 in Docker. https://docs.docker.com/config/daemon/ipv6/ describes
how to achieve this. Add the following to /etc/docker/daemon.json and restart Docker.
{
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64"
}
Create a tar to test in an INN checkout:
git archive --prefix inn/ HEAD | gzip -9c > inn.tar.gz
Run the tests:
./test-docker ../inn/inn.tar.gz
(You need IPv6 because otherwise INN's innbind tests will fail.)
With the exception of the Python suppressions, this work is:
Copyright Richard Kettlewell
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.