Annotation of wikisrc/tutorials/atf.mdwn, revision 1.4

1.1       jmmv        1: # Creating atf-based tests for NetBSD src
                      2: 
1.4     ! jmmv        3: [[!toc ]]
        !             4: 
1.1       jmmv        5: This quick tutorial is an attempt to workaround the lack of proper documentation
                      6: in atf.  The tutorial provides a guideline on how to start creating new test
                      7: programs and/or test cases, how these tests are tied to the NetBSD source tree
                      8: and a short reference of the most commonly used functions.
                      9: 
                     10: You should start by reading the
                     11: [tests(7)](http://netbsd.gw.com/cgi-bin/man-cgi?tests++NetBSD-current) manual
                     12: page, which is probably the only sane document in the whole documentation.  Any
                     13: other attempts at reading the atf-* manual pages are probably doomed unless you
                     14: are already familiar with atf itself and its internals.  Still, you may be able
                     15: to get some useful information out of
                     16: [atf-run(1)](http://netbsd.gw.com/cgi-bin/man-cgi?atf-run++NetBSD-current),
                     17: [atf-report(1)](http://netbsd.gw.com/cgi-bin/man-cgi?atf-report++NetBSD-current),
                     18: [atf-test-program(1)](http://netbsd.gw.com/cgi-bin/man-cgi?atf-test-program++NetBSD-current),
                     19: [atf-c-api(3)](http://netbsd.gw.com/cgi-bin/man-cgi?atf-c-api++NetBSD-current)
                     20: and
                     21: [atf-sh-api(3)](http://netbsd.gw.com/cgi-bin/man-cgi?atf-sh-api++NetBSD-current).
                     22: 
                     23: **IMPORTANT: Do not take anything for granted, SPECIALLY if you have previously
                     24: worked with and/or have seen src/regress/.  Your assumptions are most likely
1.2       jmmv       25: incorrect.**
1.1       jmmv       26: 
                     27: ## Test programs vs. test cases
                     28: 
                     29: So, what is what and how do you organize your tests?
                     30: 
                     31: A **test case** is a piece of code that exercises a particular functionality of
                     32: another piece of code.  Commonly, test cases validate the outcome of a
                     33: particular source function or class method, the validity of the execution of a
                     34: command with a particular combination of flags/arguments, etc.  Test cases are
                     35: supposed to be very concise, in the sense that they should just be testing *one
                     36: behavior*.
                     37: 
                     38: A **test program** is a binary that collects and exposes a group of test cases.
                     39: Typically, these test programs expose conceptually-related tests or all the
                     40: tests for a particular source file.
                     41: 
                     42: In general, having many test programs with **just one test case** in them is
                     43: **wrong** and smells from the previous layout of src/regress/.  Think about some
                     44: other organization.  And don't blame atf for this separation: this is extremely
                     45: common in (almost?) all other test frameworks and, when used wisely, becomes an
                     46: invaluable classification.
                     47: 
                     48: For example, suppose you have the following fictitious source files for the ls
                     49: tool:
                     50: 
                     51: * bin/ls/fs.c: Provides the list_files() and stat_files() functions.
                     52: 
                     53: * bin/ls/ui.c: Provides the format_columns() function.
                     54: 
                     55: * bin/ls/main.c: The main method for ls.
                     56: 
                     57: Then, you could define the following test programs and test cases:
                     58: 
                     59: * bin/ls/fs_test.c: Provides test cases for list_files and stat_files.  These
                     60:   would be named list_files__empty_directory, list_files__one_file,
                     61:   list_files__multiple_files, stat_files__directory, stat_files__symlink, etc.
                     62: 
                     63: * bin/ls/ui_test.c: Provides test cases for the format_columns function.  These
                     64:   would be named format_columns__no_files, format_columns__multiple_files, etc.
                     65: 
                     66: * bin/ls/integration_test.sh: Provides "black box" test cases for the binary
                     67:   itself.  These would be named lflag, lflag_and_Fflag, no_flags, no_files, etc.
                     68: 
1.2       jmmv       69: Try to keep your test case names as descriptive as possible so that they do not
                     70: require comments to explain what they intend to test.
                     71: 
1.3       jmmv       72: ## Test case parts
                     73: 
                     74: A test case is composed by three parts: the *head*, the *body* and the
                     75: *cleanup*.  Only the body is required; the other two routines are optional.
                     76: 
                     77: ### The head
                     78: 
                     79: The *head* is used **for the sole purpose** to define meta-data properties for
                     80: the test case.  (Eventually, this would not be specified programmatically, but
                     81: is how we deal with the information right now.)
                     82: 
                     83: The following properties are commonly useful:
                     84: 
                     85: * descr: A textual description of the purpose of the test case.
                     86: 
                     87: * require.user: Set to 'root' to mark the test case as root-specific.  It is
                     88:   nice not to abuse this; see puffs and rump.
                     89: 
                     90: * use.fs: Set to 'true' if the test case creates temporary files in the "current
                     91:   directory".  Otherwise the atf runtime will isolate the test case in such a
                     92:   way to forbid this, which will misteriously make your test to fail.
                     93: 
                     94: ### The body
                     95: 
                     96: The *body* is the actual meat of the test case.  This is just a regular function
                     97: that executes any code you want and calls special atf functions to report
                     98: failures; see below.
                     99: 
                    100: In particular, be aware that the atf run-time **isolates** the execution of
                    101: every test case to prevent side-effects (such as temporary file leftovers,
                    102: in-memory data corruption, etc.).  In particular:
                    103: 
                    104: * A test case is **always executed as a subprocess** that is separate from the
                    105:   head and the cleanup.
                    106: 
                    107: * The current working directory of a test case is changed to a temporary
                    108:   location that gets cleaned up later on automatically.  (Set the use.fs
                    109:   property to true in the head if you need to write to this temporary
                    110:   directory.)
                    111: 
                    112: * The environment of the test case is "sanitized" to get rid of variables that
                    113:   can cause side-effects; e.g. LC_ALL, TZ, etc.
                    114: 
1.2       jmmv      115: ## Installation of test programs: the why and the where
                    116: 
                    117: Test programs get installed into the /usr/tests/ hierarchy.  The main reason for
                    118: doing that is to allow *any* user to test his system and to be able to convince
                    119: himself that everything is working correctly.
                    120: 
                    121: Imagine that you install NetBSD-current on a public-facing machine that has some
                    122: particular hardware only supported in the bleeding-edge source tree.  In this
                    123: scenario, you, as the administrator, could just go into /usr/tests/, run the
                    124: tests and know immediately if everything is working correctly in your
                    125: software+hardware combination or not.  No need to rely on promises from the
                    126: vendor, no need to deal with a source tree, no need to have a compiler
                    127: installed...
                    128: 
                    129: So, that's the theory.  Now, how does this map to our source tree?
                    130: 
                    131: At the moment, the source test programs are located somewhere under src/tests/.
                    132: Say, for example, that you have the src/tests/bin/ls/ui_test.c source file.
                    133: This Makefile in src/tests/bin/ls/ will take this source file and generate a
                    134: ui_test binary.  The Makefile will also generate an Atffile.  Both files (the
                    135: ui_test binary and the Atffile) will later be installed to /usr/tests/bin/ls/
1.1       jmmv      136: 
                    137: ## Adding a new test
                    138: 
                    139: To add a new *test case* to the source tree, look for any test program in
                    140: src/tests/ that can assimilate it.  If you find such a program, just add the
1.2       jmmv      141: test case to it: no other changes are required so your life is easy.  Otherwise,
                    142: you will have to create a new test program.
1.1       jmmv      143: 
                    144: To add a new *test program* to the source tree:
                    145: 
                    146: 1. Locate the appropriate subdirectory in which to put your test program.  It is
                    147: OK (and **expected**) to have multiple test programs into the same directory.
                    148: **Restrain yourself from creating one directory per test program.**
                    149: 
                    150: If the subdirectory exists:
                    151: 
                    152: 1. Choose a sane name for the test program; the name must not be so specific
                    153:    that it restricts the addition of future test cases into it.
                    154: 
                    155: 1. Create the test program source file using one of the templates below.
                    156:    E.g. src/tests/tutorial/sample_test.c.
                    157: 
                    158: 1. Add the new test program to the Makefile.
                    159: 
                    160: If the subdirectory does not exist:
                    161: 
                    162: 1. Do the same as above.
                    163: 
                    164: 1. Create the Makefile for the directory using the templates below.
                    165: 
                    166: 1. Edit the parent Makefile to recurse into the new subdirectory.
                    167: 
                    168: 1. Edit src/etc/mtree/NetBSD.base.dist to register the new subdirectory.  Your
                    169:    test will be installed under /usr/tests/.
                    170: 
                    171: 1. Edit src/distrib/sets/lists/tests/mi to register the new test program.  Do
                    172:    not forget to add .debug entries if your test program is a C/C++ binary.
                    173: 
                    174: ### Makefile template
                    175: 
1.4     ! jmmv      176:     # $NetBSD: atf.mdwn,v 1.3 2010/09/03 13:35:32 jmmv Exp $
1.1       jmmv      177: 
                    178:     .include <bsd.own.mk>
                    179: 
                    180:     # This must always be defined.
                    181:     TESTSDIR= ${TESTSBASE}/bin/ls
                    182: 
                    183:     # Define only the variables you actually need for the directory.
                    184:     TESTS_C+= c1_test c2_test  # Correspond to c1_test.c and c2_test.c.
                    185:     TESTS_SH+= sh1_test sh2_test  # Correspond to sh1_test.c and sh2_test.c
                    186: 
                    187:     # Define only if your tests need any data files.
                    188:     FILESDIR= ${TESTSDIR}
                    189:     FILES= testdata1.txt testdata2.bin  # Any necessary data files.
                    190: 
                    191:     .include <bsd.test.mk>
                    192: 
1.2       jmmv      193: ### Atffile template
                    194: 
                    195: What is an Atffile?  An Atffile is the atf-run counterpart of a "Makefile".
                    196: Given that atf tests *do not rely on a toolchain*, they cannot use make(1) to
                    197: script their execution as the old tests in src/regress/ did.
                    198: 
                    199: The Atffiles, in general, just provide a list of test programs in a particular
                    200: directory and the list of the subdirectories to descend into.
                    201: 
                    202: Atffiles are automatically generated by bsd.test.mk, so in general you will not
                    203: have to deal with them.  However, if you have to provide one explicitly, they
                    204: follow the following format:
                    205: 
                    206:     Content-Type: application/X-atf-atffile; version="1"
                    207: 
                    208:     prop: test-suite = NetBSD
                    209: 
                    210:     tp: first_test
                    211:     tp: second_test
                    212:     tp-glob: optional_*_test
                    213:     tp: subdir1
                    214:     tp: subdir2
                    215: 
1.1       jmmv      216: ## C test programs
                    217: 
                    218: ### Template
                    219: 
1.2       jmmv      220: The following code snippet provides a C test program with two test cases:
                    221: 
1.1       jmmv      222:     #include <atf-c.h>
                    223: 
                    224:     ATF_TC(tc, my_test_case);
                    225:     ATF_TC_HEAD(tc, my_test_case)
                    226:     {
                    227:         atf_tc_set_md_var(tc, "descr", "This test case ensures that...");
                    228:     }
                    229:     ATF_TC_BODY(tc, my_test_case)
                    230:     {
                    231:         ATF_CHECK(returns_a_boolean()); /* Non-fatal test. */
                    232:         ATF_REQUIRE(returns_a_boolean()); /* Non-fatal test. */
                    233: 
                    234:         ATF_CHECK_EQ(4, 2 + 2); /* Non-fatal test. */
                    235:         ATF_REQUIRE_EQ(4, 2 + 2); /* Fatal test. */
                    236: 
                    237:         if (!condition)
                    238:             atf_tc_fail("Condition not met!"); /* Explicit failure. */
                    239:     }
                    240: 
1.2       jmmv      241:     ATF_TC_WITHOUT_HEAD(tc, another_test_case);
                    242:     ATF_TC_BODY(tc, another_test_case)
                    243:     {
                    244:         /* Do more tests here... */
                    245:     }
                    246: 
1.1       jmmv      247:     ATF_TP_ADD_TCS(tp)
                    248:     {
                    249:         ATF_TP_ADD_TC(tp, my_test_case);
1.2       jmmv      250:         ATF_TP_ADD_TC(tp, another_test_case);
1.1       jmmv      251:     }
                    252: 
1.2       jmmv      253: This program needs to be linked against libatf-c as described below.  Once
                    254: linked, the program automatically gains a main() method that provides a
                    255: consistent user interface to all test programs.  You are simply not inteded to
                    256: provide your own main method, nor to deal with the command-line of the
                    257: invocation.
                    258: 
1.1       jmmv      259: ### How to build
                    260: 
                    261: To build a C test program, append the name of the test program (without the .c
                    262: extension) to the TESTS_C variable in the Makefile.
                    263: 
                    264: For example:
                    265: 
                    266:     .include <bsd.own.mk>
                    267: 
                    268:     TESTSDIR= ${TESTSBASE}/bin/ls
                    269: 
                    270:     TESTS_C+= fs_test ui_test
                    271: 
                    272:     .include <bsd.test.mk>
                    273: 
1.3       jmmv      274: ### Common functions
                    275: 
                    276: The following functions are commonly used from within a test case body:
                    277: 
                    278: * ATF_CHECK(boolean_expression): Checks if the given boolean expression is true
                    279:   and, if not, records a failure for the test case but *execution continues*.
                    280:   Using ATF_REQUIRE aborts execution immediately after a failure.
                    281: 
                    282: * ATF_CHECK_EQ(expected_expression, actual_expression): Checks if the two
                    283:   expressions match and, if not, records a failure.  Similarly, ATF_REQUIRE_EQ
                    284:   aborts immediately if the check fails.
                    285: 
                    286: * ATF_CHECK_STREQ(expected_string, actual_string): Same as ATF_CHECK_EQ but
                    287:   performs string comparisons with strcmp.
                    288: 
                    289: * atf_tc_skip(const char *format, ...): Marks the test case as skipped with the
                    290:   provided reason and exits.
                    291: 
                    292: * atf_tc_fail(const char *format, ...): Marks the test case as failed with the
                    293:   provided reason and exits.
                    294: 
                    295: * atf_tc_pass(void): Explicitly marks the test case as passed.  This is
                    296:   *implied* when the test case function ends, so you should not use this in
                    297:   general.
                    298: 
                    299: * atf_expect_fail(const char *format, ...): Tells the atf runtime that the code
                    300:   following this call is expected to raise one or more failures (be it with
                    301:   atf_tc_fail, ATF_CHECK_*, etc.).  Use this to mark a block of code that is
                    302:   known to be broken (e.g. a test that reproduces a known bug).  Use the string
                    303:   parameter to provide an explanation about why the code is broken; if possible,
                    304:   provide a PR number.  Lastly, to terminate the "expected failure" code block
                    305:   and reset the runtime to the default functionality, use the atf_expect_pass()
                    306:   function.
                    307: 
                    308: * atf_expect_death(const char *format, ...): Same as atf_expect_fail but expects
                    309:   an abrupt termination of the test case, be it due to a call to exit() or to
                    310:   the reception of a signal.
                    311: 
                    312: * atf_expect_exit(int exitcode, const char *fomat, ...): Same as atf_expect_fail
                    313:   but expects the test case to exit with a specific exitcode.  Provide -1 to
                    314:   indicate any exit code.
                    315: 
                    316: * atf_expect_signal(int signo, const char *fomat, ...): Same as atf_expect_fail
                    317:   but expects the test case to receive a specific signal.  Provide -1 to
                    318:   indicate any signal.
                    319: 
                    320: * atf_expect_timeout(const char *reason, ...): Same as atf_expect_fail but
                    321:   expects the test case to get stuck and time out.
                    322: 
1.1       jmmv      323: ## Shell test programs
                    324: 
                    325: ### Template
                    326: 
1.2       jmmv      327: The following code snippet provides a shell test program with two test cases:
                    328: 
1.1       jmmv      329:     atf_test_case my_test_case
                    330:     my_test_case_head() {
                    331:         atf_set "descr" "This test case ensures that..."
                    332:     }
                    333:     my_test_case_body() {
                    334:         touch file1 file2
                    335: 
                    336:         cat >expout <<EOF
                    337:     file1
                    338:     file2
                    339:     EOF
                    340:         atf_check -s eq:0 -o file:expout -e empty 'ls'
                    341: 
                    342:         atf_check_equal 4 $((2 + 2))
                    343: 
                    344:         if [ 'a' != 'b' ]; then
                    345:             atf_fail "Condition not met!"  # Explicit failure.
                    346:         fi
                    347:     }
                    348: 
1.2       jmmv      349:     atf_test_case another_test_case
                    350:     another_test_case_body() {
                    351:         # Do more tests...
                    352:     }
                    353: 
1.1       jmmv      354:     atf_init_test_cases() {
                    355:         atf_add_test_case my_test_case
1.2       jmmv      356:         atf_add_test_case another_test_case
1.1       jmmv      357:     }
                    358: 
1.2       jmmv      359: This program needs to be be executed with the atf-sh(1) interpreter as described
                    360: below.  The program automatically gains an entry point that provides a
                    361: consistent user interface to all test programs.  You are simply not inteded to
                    362: provide your own "main method", nor to deal with the command-line of the
                    363: invocation.
                    364: 
1.1       jmmv      365: ### How to build
                    366: 
                    367: To build a shell test program, append the name of the test program (without the
                    368: .sh extension) to the TESTS_SH variable in the Makefile.
                    369: 
                    370: For example:
                    371: 
                    372:     .include <bsd.own.mk>
                    373: 
                    374:     TESTSDIR= ${TESTSBASE}/bin/ls
                    375: 
                    376:     TESTS_SH+= integration_test something_else_test
                    377: 
                    378:     .include <bsd.test.mk>
                    379: 
                    380: If you want to run the test program yourself, you should know that shell-based
                    381: test programs are processed with the atf-sh interpreter.  atf-sh is just a thin
                    382: wrapper over /bin/sh that loads the shared atf code and then delegates execution
                    383: to your source file.
                    384: 
1.3       jmmv      385: ### Common functions
                    386: 
                    387: The following functions are commonly used from within a test case body:
                    388: 
                    389: * atf_check: This is probably the most useful function for shell-based tests.
                    390:   It may need some experience to get it right, but it allows, in one line, to
                    391:   check the execution of a command.  Where check means: validate exit code,
                    392:   stdout and stderr.  This is just a wrapper over atf-check, so please refer to
                    393:   [atf-check(1)](http://netbsd.gw.com/cgi-bin/man-cgi?atf-check++NetBSD-current)
                    394:   for more details.
                    395: 
                    396: * atf_check_equal value1 value2: Check that the two values are equal and, if
                    397:   not, abort execution.
                    398: 
                    399: * atf_expect_*: Same as their C counterparts; see above.
                    400: 
                    401: * atf_fail reason: Explicitly marks the test case as failed and aborts it.
                    402: 
                    403: * atf_skip reason: Explicitly marks the test case as skipped and exits.
                    404: 
                    405: * atf_pass: Explicitly markts the test case as passed and exits.
                    406: 
                    407: * atf_get_srcdir: Prints the path to the directory where the test case lives.
                    408:   Use as $(atf_get_srcdir)/my-static-data-file.
                    409: 
1.1       jmmv      410: ## FAQ
                    411: 
                    412: ### How do I atfify a plain test program?
                    413: 
                    414: Let's suppose you have a program to exercise a particular piece of code.
                    415: Conceptually this implements a test but it does not use atf at all.  For
                    416: example:
                    417: 
                    418:     #include <err.h>
                    419:     #include <stdio.h>
                    420:     #include <stdlib.h>
                    421:     #include <string.h>
                    422: 
                    423:     /* This test program exercises the snprintf function. */
                    424: 
                    425:     int main(void)
                    426:     {
                    427:         char buf[1024];
                    428: 
                    429:         printf("Testing integers");
                    430:         snprintf(buf, sizeof(buf), "%d", 3);
                    431:         if (strcmp(buf, "3") != 0)
                    432:             errx(EXIT_FAILURE, "%d failed");
                    433:         snprintf(buf, sizeof(buf), "a %d b", 5);
                    434:         if (strcmp(buf, "a 5 b") != 0)
                    435:             errx(EXIT_FAILURE, "%d failed");
                    436: 
                    437:         printf("Testing strings");
                    438:         snprintf(buf, sizeof(buf), "%s", "foo");
                    439:         if (strcmp(buf, "foo") != 0)
                    440:             errx(EXIT_FAILURE, "%s failed");
                    441:         snprintf(buf, sizeof(buf), "a %s b", "bar");
                    442:         if (strcmp(buf, "a bar b") != 0)
                    443:             errx(EXIT_FAILURE, "%s failed");
                    444: 
                    445:         return EXIT_SUCCESS;
                    446:     }
                    447: 
                    448: To convert this program into an atf test program, use the template above and
                    449: keep this in mind:
                    450: 
                    451: * Split the whole main function into separate test cases.  In this scenario, the
                    452:   calls to printf(3) delimit a good granularity for the test cases: one for the
                    453:   integer formatter, one for the string formatter, etc.
                    454: 
                    455: * Use the ATF_CHECK* and/or atf_tc_fail functions to do the comparisons and
                    456:   report errors.  errx should not be used.
                    457: 
                    458: The result would look like:
                    459: 
                    460:     #include <atf-c.h>
                    461:     #include <stdio.h>
                    462: 
                    463:     ATF_TC(tc, integer_formatter);
                    464:     ATF_TC_HEAD(tc, integer_formatter)
                    465:     {
                    466:         atf_tc_set_md_var(tc, "descr", "Validates the %d formatter");
                    467:     }
                    468:     ATF_TC_BODY(tc, integer_formatter)
                    469:     {
                    470:         char buf[1024];
                    471: 
                    472:         snprintf(buf, sizeof(1024), "%d", 3);
                    473:         ATF_CHECK_STREQ("3", buf);
                    474: 
                    475:         snprintf(buf, sizeof(1024), "a %d b", 5);
                    476:         ATF_CHECK_STREQ("a 5 b", buf);
                    477:     }
                    478: 
                    479:     ATF_TC(tc, string_formatter);
                    480:     ATF_TC_HEAD(tc, string_formatter)
                    481:     {
                    482:         atf_tc_set_md_var(tc, "descr", "Validates the %s formatter");
                    483:     }
                    484:     ATF_TC_BODY(tc, string_formatter)
                    485:     {
                    486:         char buf[1024];
                    487: 
                    488:         snprintf(buf, sizeof(1024), "%s", "foo");
                    489:         ATF_CHECK_STREQ("foo", buf);
                    490: 
                    491:         snprintf(buf, sizeof(1024), "a %s b", "bar");
                    492:         ATF_CHECK_STREQ("a bar b", buf);
                    493:     }
                    494: 
                    495:     ATF_TP_ADD_TCS(tp)
                    496:     {
                    497:         ATF_TP_ADD_TC(tp, integer_formatter);
                    498:         ATF_TP_ADD_TC(tp, string_formatter);
                    499:     }
                    500: 
                    501: Which can later be invoked as any of:
                    502: 
                    503:     $ ./snprintf_test integer_formatter
                    504:     $ ./snprintf_test string_formatter
                    505:     $ atf-run snprintf_test | atf-report
                    506: 
1.3       jmmv      507: ### How do I write a test case for an unfixed PR?
                    508: 
                    509: Use the "expectations" mechanism to define part of the test case as faulty,
                    510: crashy, etc.  For example, suppose we have PR 1 that reports a condition in
                    511: which snprintf() does the wrong formatting when using %s, and PR 2 that mentions
                    512: that another snprintf() call using %d with number 5 causes a segfault.  We could
                    513: do:
                    514: 
                    515:     #include <atf-c.h>
                    516:     #include <signal.h>
                    517:     #include <stdio.h>
                    518: 
                    519:     ATF_TC_WITHOUT_HEAD(tc, integer_formatter);
                    520:     ATF_TC_BODY(tc, integer_formatter)
                    521:     {
                    522:         char buf[1024];
                    523: 
                    524:         snprintf(buf, sizeof(buf), "Hello %d\n", 1);
                    525:         ATF_CHECK_STREQ("Hello 1", buf);
                    526: 
                    527:         atf_tc_expect_signal(SIGSEGV, "PR 2: %%d with 5 causes a crash");
                    528:         snprintf(buf, sizeof(buf), "Hello %d\n", 5);
                    529:         atf_tc_expect_pass();
                    530:         ATF_CHECK_STREQ("Hello 5", buf);
                    531:     }
                    532: 
                    533:     ATF_TC_WITHOUT_HEAD(tc, string_formatter);
                    534:     ATF_TC_BODY(tc, string_formatter)
                    535:     {
                    536:         char buf[1024];
                    537: 
                    538:         snprintf(buf, sizeof(buf), "Hello %s\n", "world!");
                    539:         atf_tc_expect_failure("PR 1: %%s does not work");
                    540:         ATF_CHECK_STREQ("Hello world!", buf);
                    541:         atf_tc_expect_pass();
                    542:     }
                    543: 
                    544:     ATF_TP_ADD_TCS(tp)
                    545:     {
                    546:         ATF_TP_ADD_TC(tp, integer_formatter);
                    547:         ATF_TP_ADD_TC(tp, string_formatter);
                    548:     }
                    549: 
1.1       jmmv      550: ### Do I need to remove temporary files?
                    551: 
                    552: No.  atf-run does this automatically for you, because it runs every test program
                    553: in its own temporary subdirectory.

CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb