Tests are automatically run on Travis CI (using this configuration) whenever new commits are made to the repository or when new pull requests are opened. If something breaks, you'll be informed by Travis.
The unit test cases are written using Catch2 as C++ test framework. We use the Test::Nginx Perl test scaffolding for the integration tests. Consult the previous links for information on how to extend the tests.
The test suite is run with Travis CI but can also be run manually, the following dependencies are required to run the unit tests:
- libvips version >= 8.8
Other dependencies (such as Catch2 and
MPark.Variant) are installed using the
FetchContent module within CMake.
For the integration tests you need the following dependencies:
-
Nginx version >= 1.9.11
-
Perl modules:
-
Nginx modules:
- ngx_echo
- ngx_weserv (i.e., this module)
Note that Nginx is automatically configured and installed with the necessary
modules enabled using the ExternalProject module within CMake. If you prefer
to build Nginx by your own, use the -DINSTALL_NGX_MODULE=OFF on the CMake
command line.
If you have LCOV installed, you can view and collect coverage information,
by specifying -DENABLE_COVERAGE=ON on the CMake command line. To collect
coverage information and generate a browsable html report:
make coverage-htmlYou will be able to browse the LCOV report by opening lcov/index.html.
For only collecting collect coverage information, you can use:
make coverageTo run the unit tests without installing the Nginx module:
git clone https://github.com/weserv/images.git
cd images
mkdir build && cd build
cmake3 .. \
-DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=ON \
-DINSTALL_NGX_MODULE=OFF
make
make testTo run the integration tests in the default testing mode:
git clone https://github.com/weserv/images.git
cd images
mkdir build && cd build
cmake3 .. \
-DCMAKE_BUILD_TYPE=Debug
make
cd ../
export PATH=/usr/local/nginx/sbin:$PATH
prove -I/path/to/test-nginx/lib -r test/nginxTo run specific test files:
cd images
export PATH=/usr/local/nginx/sbin:$PATH
prove -I/path/to/test-nginx/lib test/nginx/file.t test/nginx/proxy.tTo run a specific test block in a particular test file, add the line
--- ONLY to the test block you want to run, and then use the prove
utility to run that .t file.