mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-04-21 14:17:08 -04:00
When the pulled options change, OpenVPN will attempt to reopen the tun device. That might fail if the process has already dropper privileges, and is not needed unless the tun MTU is changed. This patch therefore ignores the cipher value for the digest if a fixed tun-mtu is used. Additionally, this patch changes the md_ctx_update() call to include the trailing zero byte of each option, to make sure that parsing "foo,bar" results in a different hash than "foobar". (Sorry for not catching that during the review...) The unit tests are a bit lame, but it secretly serves as a way to lower the bar for adding more buffer.c unit tests. Trac: #761 Signed-off-by: Steffan Karger <steffan@karger.me> Acked-by: David Sommerseth <davids@openvpn.net> Message-Id: <1481838366-32335-1-git-send-email-steffan@karger.me> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg13579.html Signed-off-by: David Sommerseth <davids@openvpn.net> |
||
|---|---|---|
| .. | ||
| example_test | ||
| openvpn | ||
| plugins | ||
| .gitignore | ||
| Makefile.am | ||
| README.md | ||
Unit Tests
This directory contains unit tests for openvpn. New features/bugfixes should be written in a test friendly way and come with corresponding tests.
Run tests
Tests are run by make check. A failed tests stops test execution. To run all
tests regardless of errors call make -k check.
Add new tests to existing test suite
Test suites are organized in directories. example_test/ is an example for a test suite with two test executables. Feel free to use it as a template for new tests.
Test suites
Test suites live inside a subdirectory of $ROOT/tests/unit_tests, e.g. $ROOT/tests/unit_tests/my_feature.
Test suites are configured by a Makefile.am. Tests are executed by testdrivers. One testsuite can contain more than one testdriver.
Hints
- Name suites & testdrivers in a way that the name of the driver says something about which component/feature is tested
- Name the testdriver executable
*_testdriver. This way it gets picked up by the default.gitignore- If this is not feasible: Add all output to a
.gitignore* Use descriptive test names:coffee_brewing__with_no_beans__failsvs.test34
- If this is not feasible: Add all output to a
- Testing a configurable feature? Wrap test execution with a conditional (see auth_pam for an example)
- Add multiple test-drivers when one testdriver looks crowded with tests
New Test Suites
- Organize tests in folders for features.
- Add the new test directory to
SUBDIRSinMakefile.am - Edit
configure.acand add the newMakefiletoAC_CONFIG_FILES - Run
./configure, and enable the feature you'd like to test - Make sure that
make checkruns your tests - Check: Would a stranger be able to easily find your tests by you looking at the test output?
- Run
./configure, and disable the feature you'd like to test - Make sure that
make checkdoes not run your tests