Commit 7cd64dd2 authored by Simon Spannagel's avatar Simon Spannagel
Browse files

Manual: update description of testing

parent c82bf132
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -150,6 +150,7 @@ Only ROOT is automatically included and linked to the module.
\item A line with \texttt{\textbf{ALLPIX\_MODULE\_SOURCES(\$\{MODULE\_NAME\} \textit{sources})}} defines the module source files. Here, \texttt{sources} should be replaced by a list of all source files relevant to this module.
\item Possible lines to include additional directories and to link libraries for dependencies loaded earlier.
\item A line with \texttt{\textbf{ALLPIX\_MODULE\_REQUIRE\_GEANT4\_INTERFACE(\$\{MODULE\_NAME\})}} adds the Geant4 interface library as explained in Section~\ref{sec:geant4_interface}.
\item A line to register the directory with module tests, for example \emph{tests} as in \texttt{\textbf{ALLPIX\_MODULE\_TESTS(\${MODULE\_NAME} "tests")}}.
\item A line containing \parameter{ALLPIX_MODULE_INSTALL(${MODULE_NAME})} to set up the required target for the module to be installed to.
\end{enumerate}

@@ -162,10 +163,7 @@ A simple CMakeLists.txt for a module named \parameter{Test} which requires Geant
ALLPIX_UNIQUE_MODULE(MODULE_NAME)

# Load Geant4
FIND_PACKAGE(Geant4)
IF(NOT Geant4_FOUND)
    MESSAGE(FATAL_ERROR "Could not find Geant4, make sure to source the Geant4 environment\n$ source YOUR_GEANT4_DIR/bin/geant4.sh")
ENDIF()
FIND_PACKAGE(Geant4 REQUIRED)

# Add the sources for this module
ALLPIX_MODULE_SOURCES(${MODULE_NAME}
@@ -181,6 +179,9 @@ ALLPIX_MODULE_REQUIRE_GEANT4_INTERFACE(${MODULE_NAME})
# Link the Geant4 libraries to the module library
TARGET_LINK_LIBRARIES(${MODULE_NAME} ${Geant4_LIBRARIES})

# Register module tests
ALLPIX_MODULE_TESTS(${MODULE_NAME} "tests")

# Provide standard install target
ALLPIX_MODULE_INSTALL(${MODULE_NAME})
\end{minted}
+13 −3
Original line number Diff line number Diff line
@@ -243,10 +243,20 @@ The different subcategories of tests described below can be executed or ignored
$ ctest -R test_performance
\end{verbatim}

The configuration of the tests can be found in the \dir{etc/unittests/test_*} directories of the repository and are automatically discovered by CMake.
CMake automatically searches for \apsq configuration files in the different directories and passes them to the \apsq executable~(cf.\ Section~\ref{sec:allpix_executable}).
\paragraph{Test Configurations}

Test configuration files consist of regular \apsq configuration files for a simulation, invoking the desired behavior to be tested.
In addition, test files can contain tags and pass conditions as described in the subsequent section.

Three different types of tests are distinguished:
\begin{description}
  \item[Core tests:] These tests validate the core framework components such as seed distribution, multithreading capabilities, configuration parsing and coordinate transformations. The configuration of the tests can be found in the \dir{etc/unittests/test_core} directory of the repository and are automatically discovered by CMake.
  \item[Module tests:] These tests are meant to ensure proper functioning of an individual module given a defined input. Module tests are located within the individual module source folders and are only enabled if the respective module will be built. For new modules, the directory in which the test files are located needs to be registered in the main CMake file of the module as described in Section~\ref{sec:module_files}. Module test files have to start with a two-digit number and end with the file extension \parameter{.conf}, e.g. \parameter{01-mytest.conf}, to be detected.
  \item[Performance tests:] These tests run a set of simulations on a dedicated machine to catch any unexpected prolongation of the simulation time, e.g. by an accidentally introduced heavy operation in a hot loop. The configuration of the tests can be found in the \dir{etc/unittests/test_performance} directory of the repository and are automatically discovered by CMake.
\end{description}

Adding a new test is as simple as adding a new configuration file to one of the different subdirectories and specifying the pass or fail conditions based on the tags described in the following paragraphs.
CMake automatically searches for \apsq configuration files in the different directories and passes them to the \apsq executable~(cf.\ Section~\ref{sec:allpix_executable}).
Adding a new test is as simple as adding a new configuration file to the respective subdirectories and specifying the pass or fail conditions based on the tags described in the following paragraphs.

\paragraph{Test Tags, Pass and Fail Conditions}