freebsd-dev/share/examples/tests
Enji Cooper 5193fcde8d Initial googlemock/googletest integration into the build/FreeBSD test suite
This initial integration takes googlemock/googletest release 1.8.1, integrates
the library, tests, and sample unit tests into the build.

googlemock/googletest's inclusion is optionally available via `MK_GOOGLETEST`.
`MK_GOOGLETEST` is dependent on `MK_TESTS` and is enabled by default when
built with a C++11 capable toolchain.

Google tests can be specified via the `GTESTS` variable, which, in comparison
with the other test drivers, is more simplified/streamlined, as Googletest only
supports C++ tests; not raw C or shell tests (C tests can be written in C++
using the standard embedding methods).

No dependent libraries are assumed for the tests. One must specify `gmock`,
`gmock_main`, `gtest`, or `gtest_main`, via `LIBADD` for the program.

More information about googlemock and googletest can be found on the
Googletest [project page](https://github.com/google/googletest), and the
[GoogleMock](https://github.com/google/googletest/blob/v1.8.x/googlemock/docs/Documentation.md)
and
[GoogleTest](https://github.com/google/googletest/tree/v1.8.x/googletest/docs)
docs.

These tests are originally integrated into the build as plain driver tests, but
will be natively integrated into Kyua in a later version.

Known issues/Errata:
* [WhenDynamicCastToTest.AmbiguousCast fails on FreeBSD](https://github.com/google/googletest/issues/2172)

Reviewed by:	asomers
Approved by:	emaste (mentor)
MFC after:	2 months
Differential Revision: https://reviews.freebsd.org/D19551
2019-03-15 21:43:52 +00:00
..
tests Initial googlemock/googletest integration into the build/FreeBSD test suite 2019-03-15 21:43:52 +00:00
Makefile Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
Makefile.depend DIRDEPS_BUILD: Connect MK_TESTS. 2016-03-09 22:46:01 +00:00
README

$FreeBSD$

This directory contains sample test programs along the Makefile and
Kyuafile logic to get them build and installed.

The goal of these test programs is to illustrate, via simple and
heaviliy-commented code, how to construct test programs using all the
supported interfaces in the system.

If you use any files in here as templates for your own code, please
remove all comments while doing so and then write your own if necessary.

The subdirectories here contain:

* tests/: Regular directory containing the tests code.  Note that the
  apparently-redundant tests/tests/ path component here is expected for
  consistency reasons and required to get the right layout under
  /usr/tests/.

* tests/atf/: Tests that use the ATF libraries, including atf-c, atf-c++
  and atf-sh.  See kyua-atf-interface(1) for details.

* tests/plain/: Tests that do not use any testing framework.  See
  kyua-plain-interface(1) for details.

To inspect the available sample test cases from an installed system:

    $ kyua list -k /usr/tests/share/examples/tests/Kyuafile

To run the full suite of sample test cases:

    $ kyua test -k /usr/tests/share/examples/tests/Kyuafile

And to debug a specific failing test case, if any:

    $ kyua debug -k /usr/tests/share/examples/tests/Kyuafile \
      atf/cp_test:simple