Skip to content

Commit f3393f8

Browse files
committed
Fixes following review.
1 parent e32d3fc commit f3393f8

File tree

3 files changed

+49
-31
lines changed

3 files changed

+49
-31
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if( EXIV2_BUILD_SAMPLES )
110110
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
111111
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bash_tests
112112
)
113-
add_test(NAME bugfixes
113+
add_test(NAME bugfixTests
114114
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
115115
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bugfixes
116116
)
@@ -122,7 +122,7 @@ if( EXIV2_BUILD_SAMPLES )
122122
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
123123
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose tiff_test
124124
)
125-
add_test(NAME versionTest
125+
add_test(NAME versionTests
126126
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/tests
127127
COMMAND cmake -E env EXIV2_BINDIR=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${Python3_EXECUTABLE} runner.py --verbose bash_tests/version_test.py
128128
)

README.md

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ The file ReadMe.txt in a build bundle describes how to install the library on th
5656
4. [Test Suite](#4)
5757
1. [Running tests on a UNIX-like system](#4-1)
5858
2. [Running tests on Visual Studio builds](#4-2)
59-
3. [Unit tests](#4-3)
60-
4. [Bugfix tests](#4-4)
59+
3. [Unit Tests](#4-3)
60+
4. [Bugfix Tests](#4-4)
6161
5. [Fuzzing](#4-5)
6262
1. [OSS-Fuzz](#4-5-1)
6363
5. [Platform Notes](#5)
@@ -853,39 +853,57 @@ For new bug reports, feature requests and support: Please open an issue in Gith
853853
854854
## 4 Test Suite
855855
856-
The test suite is implemented using CTest. CMake adds the target 'test' to the build. You can run ctest with the command `$ cmake --build . --target test`, or simply with `$ ctest`. The build creates 6 tests: bashTests, bugfixes, lensTest, tiffTests, unit_tests and versionTest. You can run all tests or a subset.
856+
You execute the Test Suite using CTest with the command `$ ctest`.
857+
858+
The build creates 6 tests: bashTests, bugfixTests, lensTests, tiffTests, unitTests and versionTests. You can run all tests or a subset. To list all available tests, execute ctest with the `-N` or `--show-only` option, which disables execution:
859+
860+
```bash
861+
.../main/build $ ctest -N
862+
Test project ...main/build
863+
Test #1: bashTests
864+
Test #2: bugfixTests
865+
Test #3: lensTests
866+
Test #4: tiffTests
867+
Test #5: versionTests
868+
Test #6: unitTests
869+
870+
Total Tests: 6
871+
.../main/build $
872+
```
873+
874+
ctest provides many option and the following show common use-case scenarios:
857875
858876
```bash
859-
$ cmake --build . --target test
860877
$ ctest # run all tests and display summary
861878
$ ctest --output-on-failure # run all tests and output failures
862-
$ ctest -R bugfixes # run only bugfixes and display summary
863-
$ ctest -R bugfixes --verbose # run only bugfixes and display all output
879+
$ ctest -R bugfix # run only bugfixTests and display summary
880+
$ ctest -R bugfix --verbose # run only bugfixTests and display all output
864881
```
865882
866883
| Name | Language | Location | Command<br>_(in build directory)_ | CMake Option to Build |
867884
|:-- |:-- |:-- |:-- |:-- |
868885
| bashTests | python | tests/bash\_tests | $ ctest -R bash | -DEXIV2\_BUILD\_SAMPLES=On |
869-
| bugfixes | python | tests/bugfixes | $ ctest -R bugfixes | -DEXIV2\_BUILD\_SAMPLES=On |
870-
| LensTest | C++ | tests/lens_tests | $ ctest -R lens | -DEXIV2\_BUILD\_SAMPLES=On |
886+
| bugfixTests | python | tests/bugfixes | $ ctest -R bugfix | -DEXIV2\_BUILD\_SAMPLES=On |
887+
| lensTest | C++ | tests/lens_tests | $ ctest -R lens | -DEXIV2\_BUILD\_SAMPLES=On |
871888
| tiffTests | python | tests/tiff_test | $ ctest -R tiff | -DEXIV2\_BUILD\_SAMPLES=On |
872-
| unit_tests | C++ | unitTests | $ ctest -R unit | -DEXIV2\_BUILD\_UNIT\_TESTS=On |
873-
| versionTest | C++ | src/version.cpp | $ ctest -R version | Always in library |
889+
| unitTests | C++ | unitTests/ | $ ctest -R unit | -DEXIV2\_BUILD\_UNIT\_TESTS=On |
890+
| versionTests | C++ | src/version.cpp | $ ctest -R version | Always in library |
874891
875-
The term _**bash**_ is historical. These tests were originally bash scripts and they have been rewritten in python. Visual Studio Users will appreciate the python implementation as it avoids the installation of mingw/cygwin and special PATH settings.
892+
The term _**bashTests**_ is historical. These tests were originally bash scripts and have been rewritten in python.
893+
Visual Studio Users will appreciate the python implementation as it avoids the installation of mingw/cygwin and special PATH settings.
876894
877895
#### Environment Variables used by the test suite:
878896
879897
If you build the code in the directory \<exiv2dir\>build, tests will run using the default values of Environment Variables.
880898
881-
| Variable | Default | Platforms | Purpose |
882-
|:-- |:-- |:-- |:-- |
883-
| EXIV2_BINDIR | **\<exiv2dir\>/build/bin** | All Platforms | Path of built binaries (exiv2.exe) |
884-
| EXIV2_PORT | **12762**<br>**12671**<br>**12760** | Cygwin<br>MinGW/msys2<br>Other Platforms | Test TCP/IP Port |
899+
| Variable | Default | Platforms | Purpose |
900+
|:-- |:-- |:-- |:-- |
901+
| EXIV2_BINDIR | **\<exiv2dir\>/build/bin** | All Platforms | Path of built binaries (exiv2.exe) |
902+
| EXIV2_PORT | **12762**<br>**12671**<br>**12760** | Cygwin<br>MinGW/msys2<br>Other Platforms | Test TCP/IP Port |
885903
| EXIV2_HTTP | **http://localhost** | All Platforms | Test http server |
886-
| EXIV2_ECHO | _**not set**_ | All Platforms | For debugging bash scripts |
887-
| VALGRIND | _**not set**_ | All Platforms | For debugging bash scripts |
888-
| VERBOSE | _**not set**_ | Makefile platforms | Causes make to report its actions |
904+
| EXIV2_ECHO | _**not set**_ | All Platforms | For debugging bashTests |
905+
| VALGRIND | _**not set**_ | All Platforms | For debugging bashTests |
906+
| VERBOSE | _**not set**_ | Makefile platforms | Instructs make to report its actions |
889907
| PATH<br>DYLD\_LIBRARY\_PATH<br>LD\_LIBRARY\_PATH | $EXIV2\_BINDIR/../lib | Windows<br>macOS<br>Other platforms | Path of dynamic libraries |
890908
891909
The Variable EXIV2\_PORT or EXIV2\_HTTP can be set to None to skip http tests. The http server is started with the command `python3 -m http.server $port`. On Windows, you will need to run this manually _**once**_ to authorise the firewall to permit python to use the port.
@@ -916,7 +934,7 @@ addmoddel_test (testcases.TestCases) ... ok
916934
Ran 176 tests in 9.526s
917935
OK (skipped=6)
918936
919-
$ ctest -R bugfixes --verbose
937+
$ ctest -R bugfix --verbose
920938
... lots of output ...
921939
test_run (tiff_test.test_tiff_test_program.TestTiffTestProg) ... ok
922940
----------------------------------------------------------------------
@@ -936,12 +954,12 @@ $
936954
> set PATH=c:\Python37;%PATH%
937955
```
938956
939-
You can execute the test suite in a similar manner to that described for UNIX-like systems. You _**must**_ provide the -C config option to ctest for Visual Studio builds.
957+
You can execute the test suite in a similar manner to that described for UNIX-like systems. You _**must**_ provide the `-C` config option to ctest for Visual Studio builds.
940958
941959
```cmd
942960
> cd <exiv2dir>/build
943961
> ctest -C Release
944-
> ctest -C Release -R bugfixes --verbose
962+
> ctest -C Release -R bugfix --verbose
945963
```
946964
Visual Studio can build different configs as follows:
947965
@@ -977,7 +995,7 @@ set EXIV2_PORT=
977995
978996
[TOC](#TOC)
979997
<div id="4-3">
980-
### 4.3 Unit tests
998+
### 4.3 Unit Tests
981999
9821000
The code for the unit tests is in `<exiv2dir>/unitTests`. To include unit tests in the build, use the *cmake* option `-DEXIV2_BUILD_UNIT_TESTS=On`.
9831001
@@ -996,23 +1014,23 @@ $ popd
9961014
9971015
[TOC](#TOC)
9981016
<div id="4-4">
999-
### 4.4 Bugfix tests
1017+
### 4.4 Bugfix Tests
10001018
10011019
You can run the bugfix tests from the build directory:
10021020
10031021
```bash
10041022
$ cd <exiv2dir>/build
1005-
$ ctest -R bugfixes
1023+
$ ctest -R bugfix
10061024
```
10071025
10081026
If you wish to run in verbose mode:
10091027
10101028
```bash
10111029
$ cd <exiv2dir>/build
1012-
$ $ ctest -R bugfixes --verbose
1030+
$ $ ctest -R bugfix --verbose
10131031
```
10141032
1015-
The bugfix tests are stored in the directory tests and you can run them all with the command:
1033+
The bugfix tests are stored in directory tests/ and you can run them all with the command:
10161034
10171035
```bash
10181036
$ cd <exiv2dir>/tests
@@ -1031,7 +1049,7 @@ You may wish to get a brief summary of failures with commands such as:
10311049
10321050
```bash
10331051
$ cd <exiv2dir>/build
1034-
$ ctest -R bugfixes --verbose 2>&1 | grep FAIL
1052+
$ ctest -R bugfix --verbose 2>&1 | grep FAIL
10351053
```
10361054
10371055
[TOC](#TOC)
@@ -1310,5 +1328,5 @@ $ sudo pkg install developer/gcc-7
13101328
13111329
[TOC](#TOC)
13121330
1313-
Written by Robin Mills<br>[email protected]<br>Updated: 2021-12-19
1331+
Written by Robin Mills<br>[email protected]<br>Updated: 2021-12-20
13141332

unitTests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ if (MSVC)
5151
set_target_properties(unit_tests PROPERTIES LINK_FLAGS "/ignore:4099")
5252
endif()
5353

54-
add_test(NAME unit_tests COMMAND unit_tests)
54+
add_test(NAME unitTests COMMAND unit_tests)

0 commit comments

Comments
 (0)