Changes between Initial Version and Version 1 of CMakeTestRunFail


Ignore:
Timestamp:
Jun 12, 2007, 3:05:41 AM (15 years ago)
Author:
Douglas Gregor
Comment:

Initial documentation for boost_test_run_fail

Legend:

Unmodified
Added
Removed
Modified
  • CMakeTestRunFail

    v1 v1  
     1= CMake Macro Reference: `boost_test_run_fail` =
     2The `boost_test_run_fail` macro creates a Boost regression test that will be built and executed. If
     3the test can be built, executed, and exits with a return code that
     4is not zero, it will be considered to have passed.
     5
     6{{{
     7boost_test_run_fail(testname
     8                    [source1 source2 ...]
     9                    [ARGS arg1 arg2... ]
     10                    [COMPILE_FLAGS compileflags]
     11                    [LINK_FLAGS linkflags]
     12                    [LINK_LIBS linklibs]
     13                    [DEPENDS libdepend1 libdepend2 ...])
     14}}}
     15
     16`testname` is the name of the test. `source1`, `source2`, etc. are the
     17source files that will be built and linked into the test
     18executable. If no source files are provided, the file "testname.cpp"
     19will be used instead.
     20
     21There are several optional arguments to control how the regression
     22test is built and executed:
     23
     24  ARGS::
     25   Provides additional arguments that will be passed to the
     26    test executable when it is run.
     27
     28  COMPILE_FLAGS::
     29    Provides additional compilation flags that will be
     30    used when building this test. For example, one might want to add
     31    "-DBOOST_SIGNALS_ASSERT=1" to turn on assertions within the library.
     32
     33  LINK_FLAGS::
     34   Provides additional flags that will be passed to the
     35    linker when linking the test excecutable. This option should not
     36    be used to link in additional libraries; see `LINK_LIBS` and
     37    `DEPENDS`.
     38
     39  LINK_LIBS::
     40    Provides additional libraries against which the test
     41    executable will be linked. For example, one might provide "expat"
     42    as options to `LINK_LIBS`, to state that this executable should be
     43    linked against the external "expat" library. Use `LINK_LIBS` for
     44    libraries external to Boost; for Boost libraries, use `DEPENDS`.
     45
     46  DEPENDS::
     47    States that this test executable depends on and links
     48    against another Boost library. The argument to `DEPENDS` should be
     49    the name of a particular variant of a Boost library, e.g.,
     50    `boost_signals-static`.
     51
     52== Example ==
     53The following invocation of `boost_test_run_fail` creates an executable test `prg_exec_fail1`, linked against the static version of `boost_prg_exec_monitor`, which should return a non-zero exit code when run.
     54
     55{{{
     56boost_test_run_fail(prg_exec_fail1 DEPENDS boost_prg_exec_monitor-static)
     57}}}
     58
     59This example is from [http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0/libs/test/test/CMakeLists.txt libs/test/test/CMakeLists.txt].
     60
     61== Where Defined ==
     62This macro is defined in the Boost Testing module in [http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostTesting.cmake tools/build/CMake/BoostTesting.cmake]
     63
     64
     65== TODO ==
     66* Improve handling of `DEPENDS`, so that we can specify just the
     67    library's abstract target (e.g., "boost_signals"), and possibly
     68    some features required for building the test (e.g.,
     69    `MULTI_THREADED`, `STATIC`). The test macros should then pick the
     70    best library variant available to meet those features and the
     71    current build variant (Debug or Release).