freebsd-src/share/examples/tests
Dimitry Andric 69c8025a49 Silence snprintf truncation warnings in printf_test examples
Building share/examples/tests with clang 18 results in a few warnings
like:

  share/examples/tests/tests/plain/printf_test.c:67:6: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 17 [-Werror,-Wformat-truncation]
     67 |         if (snprintf(buffer, sizeof(buffer), "0123456789abcdef") != 16)
        |             ^

Since these tests are meant as an example of testing snprintf overflow,
suppress the warnings.

MFC after:	3 days
2023-12-21 23:45:52 +01:00
..
tests Silence snprintf truncation warnings in printf_test examples 2023-12-21 23:45:52 +01:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
README Remove $FreeBSD$: one-line bare tag 2023-08-16 11:55:20 -06:00

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