13b6cf63jmmv/* Copyright (c) 2007 The NetBSD Foundation, Inc.
245147a9marcel * All rights reserved.
345147a9marcel *
445147a9marcel * Redistribution and use in source and binary forms, with or without
545147a9marcel * modification, are permitted provided that the following conditions
645147a9marcel * are met:
745147a9marcel * 1. Redistributions of source code must retain the above copyright
845147a9marcel *    notice, this list of conditions and the following disclaimer.
945147a9marcel * 2. Redistributions in binary form must reproduce the above copyright
1045147a9marcel *    notice, this list of conditions and the following disclaimer in the
1145147a9marcel *    documentation and/or other materials provided with the distribution.
1245147a9marcel *
1345147a9marcel * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
1445147a9marcel * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
1545147a9marcel * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1645147a9marcel * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1745147a9marcel * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
1845147a9marcel * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1945147a9marcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
2045147a9marcel * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2145147a9marcel * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
2245147a9marcel * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
2345147a9marcel * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
243b6cf63jmmv * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  */
2545147a9marcel
2645147a9marcel#include <sys/types.h>
2745147a9marcel#include <sys/wait.h>
2845147a9marcel#include <fcntl.h>
2945147a9marcel#include <unistd.h>
3045147a9marcel
3145147a9marcel#include <signal.h>
3245147a9marcel#include <stdio.h>
3345147a9marcel#include <stdlib.h>
3445147a9marcel#include <string.h>
3545147a9marcel
3645147a9marcel#include <atf-c.h>
3745147a9marcel
3845147a9marcel#include "atf-c/detail/env.h"
3945147a9marcel#include "atf-c/detail/fs.h"
4045147a9marcel#include "atf-c/detail/test_helpers.h"
4145147a9marcel#include "atf-c/detail/text.h"
423b6cf63jmmv#include "atf-c/error.h"
4345147a9marcel
4445147a9marcel/* ---------------------------------------------------------------------
4545147a9marcel * Auxiliary functions.
4645147a9marcel * --------------------------------------------------------------------- */
4745147a9marcel
4845147a9marcelstatic
4945147a9marcelvoid
5045147a9marcelsafe_remove(const char* path)
5145147a9marcel{
5245147a9marcel    if (unlink(path) == -1)
5345147a9marcel        atf_tc_fail("unlink(2) of %s failed", path);
5445147a9marcel}
5545147a9marcel
5645147a9marcelstatic
5745147a9marcelvoid
5845147a9marceltouch(const char *path)
5945147a9marcel{
6045147a9marcel    int fd;
6145147a9marcel    fd = open(path, O_WRONLY | O_TRUNC | O_CREAT, 0644);
6245147a9marcel    if (fd == -1)
6345147a9marcel        atf_tc_fail("Could not create file %s", path);
6445147a9marcel    close(fd);
6545147a9marcel}
6645147a9marcel
6745147a9marcel/* ---------------------------------------------------------------------
6845147a9marcel * Helper tests for "t_cleanup".
6945147a9marcel * --------------------------------------------------------------------- */
7045147a9marcel
7145147a9marcelATF_TC_WITH_CLEANUP(cleanup_pass);
7245147a9marcelATF_TC_HEAD(cleanup_pass, tc)
7345147a9marcel{
7445147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_cleanup test "
7545147a9marcel               "program");
7645147a9marcel}
7745147a9marcelATF_TC_BODY(cleanup_pass, tc)
7845147a9marcel{
7945147a9marcel    touch(atf_tc_get_config_var(tc, "tmpfile"));
8045147a9marcel}
8145147a9marcelATF_TC_CLEANUP(cleanup_pass, tc)
8245147a9marcel{
8345147a9marcel    if (atf_tc_get_config_var_as_bool(tc, "cleanup"))
8445147a9marcel        safe_remove(atf_tc_get_config_var(tc, "tmpfile"));
8545147a9marcel}
8645147a9marcel
8745147a9marcelATF_TC_WITH_CLEANUP(cleanup_fail);
8845147a9marcelATF_TC_HEAD(cleanup_fail, tc)
8945147a9marcel{
9045147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_cleanup test "
9145147a9marcel                      "program");
9245147a9marcel}
9345147a9marcelATF_TC_BODY(cleanup_fail, tc)
9445147a9marcel{
9545147a9marcel    touch(atf_tc_get_config_var(tc, "tmpfile"));
9645147a9marcel    atf_tc_fail("On purpose");
9745147a9marcel}
9845147a9marcelATF_TC_CLEANUP(cleanup_fail, tc)
9945147a9marcel{
10045147a9marcel    if (atf_tc_get_config_var_as_bool(tc, "cleanup"))
10145147a9marcel        safe_remove(atf_tc_get_config_var(tc, "tmpfile"));
10245147a9marcel}
10345147a9marcel
10445147a9marcelATF_TC_WITH_CLEANUP(cleanup_skip);
10545147a9marcelATF_TC_HEAD(cleanup_skip, tc)
10645147a9marcel{
10745147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_cleanup test "
10845147a9marcel                      "program");
10945147a9marcel}
11045147a9marcelATF_TC_BODY(cleanup_skip, tc)
11145147a9marcel{
11245147a9marcel    touch(atf_tc_get_config_var(tc, "tmpfile"));
11345147a9marcel    atf_tc_skip("On purpose");
11445147a9marcel}
11545147a9marcelATF_TC_CLEANUP(cleanup_skip, tc)
11645147a9marcel{
11745147a9marcel    if (atf_tc_get_config_var_as_bool(tc, "cleanup"))
11845147a9marcel        safe_remove(atf_tc_get_config_var(tc, "tmpfile"));
11945147a9marcel}
12045147a9marcel
12145147a9marcelATF_TC_WITH_CLEANUP(cleanup_curdir);
12245147a9marcelATF_TC_HEAD(cleanup_curdir, tc)
12345147a9marcel{
12445147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_cleanup test "
12545147a9marcel                      "program");
12645147a9marcel}
12745147a9marcelATF_TC_BODY(cleanup_curdir, tc)
12845147a9marcel{
12945147a9marcel    FILE *f;
13045147a9marcel
13145147a9marcel    f = fopen("oldvalue", "w");
13245147a9marcel    if (f == NULL)
13345147a9marcel        atf_tc_fail("Failed to create oldvalue file");
13445147a9marcel    fprintf(f, "1234");
13545147a9marcel    fclose(f);
13645147a9marcel}
13745147a9marcelATF_TC_CLEANUP(cleanup_curdir, tc)
13845147a9marcel{
13945147a9marcel    FILE *f;
14045147a9marcel
14145147a9marcel    f = fopen("oldvalue", "r");
14245147a9marcel    if (f != NULL) {
14345147a9marcel        int i;
14445147a9marcel        if (fscanf(f, "%d", &i) != 1)
14545147a9marcel            fprintf(stderr, "Failed to read old value\n");
14645147a9marcel        else
14745147a9marcel            printf("Old value: %d", i);
14845147a9marcel        fclose(f);
14945147a9marcel    }
15045147a9marcel}
15145147a9marcel
15245147a9marcelATF_TC_WITH_CLEANUP(cleanup_sigterm);
15345147a9marcelATF_TC_HEAD(cleanup_sigterm, tc)
15445147a9marcel{
15545147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_cleanup test "
15645147a9marcel                      "program");
15745147a9marcel}
15845147a9marcelATF_TC_BODY(cleanup_sigterm, tc)
15945147a9marcel{
16045147a9marcel    char *nofile;
16145147a9marcel
16245147a9marcel    touch(atf_tc_get_config_var(tc, "tmpfile"));
16345147a9marcel    kill(getpid(), SIGTERM);
16445147a9marcel
16545147a9marcel    RE(atf_text_format(&nofile, "%s.no",
16645147a9marcel                       atf_tc_get_config_var(tc, "tmpfile")));
16745147a9marcel    touch(nofile);
16845147a9marcel    free(nofile);
16945147a9marcel}
17045147a9marcelATF_TC_CLEANUP(cleanup_sigterm, tc)
17145147a9marcel{
17245147a9marcel    safe_remove(atf_tc_get_config_var(tc, "tmpfile"));
17345147a9marcel}
17445147a9marcel
17545147a9marcel/* ---------------------------------------------------------------------
17645147a9marcel * Helper tests for "t_config".
17745147a9marcel * --------------------------------------------------------------------- */
17845147a9marcel
17945147a9marcelATF_TC(config_unset);
18045147a9marcelATF_TC_HEAD(config_unset, tc)
18145147a9marcel{
18245147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_config test "
18345147a9marcel                      "program");
18445147a9marcel}
18545147a9marcelATF_TC_BODY(config_unset, tc)
18645147a9marcel{
18745147a9marcel    ATF_REQUIRE(!atf_tc_has_config_var(tc, "test"));
18845147a9marcel}
18945147a9marcel
19045147a9marcelATF_TC(config_empty);
19145147a9marcelATF_TC_HEAD(config_empty, tc)
19245147a9marcel{
19345147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_config test "
19445147a9marcel                      "program");
19545147a9marcel}
19645147a9marcelATF_TC_BODY(config_empty, tc)
19745147a9marcel{
19845147a9marcel    ATF_REQUIRE(atf_tc_has_config_var(tc, "test"));
19945147a9marcel    ATF_REQUIRE(strlen(atf_tc_get_config_var(tc, "test")) == 0);
20045147a9marcel}
20145147a9marcel
20245147a9marcelATF_TC(config_value);
20345147a9marcelATF_TC_HEAD(config_value, tc)
20445147a9marcel{
20545147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_config test "
20645147a9marcel                      "program");
20745147a9marcel}
20845147a9marcelATF_TC_BODY(config_value, tc)
20945147a9marcel{
21045147a9marcel    ATF_REQUIRE(atf_tc_has_config_var(tc, "test"));
21145147a9marcel    ATF_REQUIRE(strcmp(atf_tc_get_config_var(tc, "test"), "foo") == 0);
21245147a9marcel}
21345147a9marcel
21445147a9marcelATF_TC(config_multi_value);
21545147a9marcelATF_TC_HEAD(config_multi_value, tc)
21645147a9marcel{
21745147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_config test "
21845147a9marcel                      "program");
21945147a9marcel}
22045147a9marcelATF_TC_BODY(config_multi_value, tc)
22145147a9marcel{
22245147a9marcel    ATF_REQUIRE(atf_tc_has_config_var(tc, "test"));
22345147a9marcel    ATF_REQUIRE(strcmp(atf_tc_get_config_var(tc, "test"), "foo bar") == 0);
22445147a9marcel}
22545147a9marcel
22645147a9marcel/* ---------------------------------------------------------------------
22745147a9marcel * Helper tests for "t_expect".
22845147a9marcel * --------------------------------------------------------------------- */
22945147a9marcel
23045147a9marcelATF_TC_WITHOUT_HEAD(expect_pass_and_pass);
23145147a9marcelATF_TC_BODY(expect_pass_and_pass, tc)
23245147a9marcel{
23345147a9marcel    atf_tc_expect_pass();
23445147a9marcel
23545147a9marcel}
23645147a9marcel
23745147a9marcelATF_TC_WITHOUT_HEAD(expect_pass_but_fail_requirement);
23845147a9marcelATF_TC_BODY(expect_pass_but_fail_requirement, tc)
23945147a9marcel{
24045147a9marcel    atf_tc_expect_pass();
24145147a9marcel    atf_tc_fail("Some reason");
24245147a9marcel}
24345147a9marcel
24445147a9marcelATF_TC_WITHOUT_HEAD(expect_pass_but_fail_check);
24545147a9marcelATF_TC_BODY(expect_pass_but_fail_check, tc)
24645147a9marcel{
24745147a9marcel    atf_tc_expect_pass();
24845147a9marcel    atf_tc_fail_nonfatal("Some reason");
24945147a9marcel}
25045147a9marcel
25145147a9marcelATF_TC_WITHOUT_HEAD(expect_fail_and_fail_requirement);
25245147a9marcelATF_TC_BODY(expect_fail_and_fail_requirement, tc)
25345147a9marcel{
25445147a9marcel    atf_tc_expect_fail("Fail %s", "reason");
25545147a9marcel    atf_tc_fail("The failure");
25645147a9marcel    atf_tc_expect_pass();
25745147a9marcel}
25845147a9marcel
25945147a9marcelATF_TC_WITHOUT_HEAD(expect_fail_and_fail_check);
26045147a9marcelATF_TC_BODY(expect_fail_and_fail_check, tc)
26145147a9marcel{
26245147a9marcel    atf_tc_expect_fail("Fail first");
26345147a9marcel    atf_tc_fail_nonfatal("abc");
26445147a9marcel    atf_tc_expect_pass();
26545147a9marcel
26645147a9marcel    atf_tc_expect_fail("And fail again");
26745147a9marcel    atf_tc_fail_nonfatal("def");
26845147a9marcel    atf_tc_expect_pass();
26945147a9marcel}
27045147a9marcel
27145147a9marcelATF_TC_WITHOUT_HEAD(expect_fail_but_pass);
27245147a9marcelATF_TC_BODY(expect_fail_but_pass, tc)
27345147a9marcel{
27445147a9marcel    atf_tc_expect_fail("Fail first");
27545147a9marcel    atf_tc_fail_nonfatal("abc");
27645147a9marcel    atf_tc_expect_pass();
27745147a9marcel
27845147a9marcel    atf_tc_expect_fail("Will not fail");
27945147a9marcel    atf_tc_expect_pass();
28045147a9marcel
28145147a9marcel    atf_tc_expect_fail("And fail again");
28245147a9marcel    atf_tc_fail_nonfatal("def");
28345147a9marcel    atf_tc_expect_pass();
28445147a9marcel}
28545147a9marcel
28645147a9marcelATF_TC_WITHOUT_HEAD(expect_exit_any_and_exit);
28745147a9marcelATF_TC_BODY(expect_exit_any_and_exit, tc)
28845147a9marcel{
28945147a9marcel    atf_tc_expect_exit(-1, "Call will exit");
29045147a9marcel    exit(EXIT_SUCCESS);
29145147a9marcel}
29245147a9marcel
29345147a9marcelATF_TC_WITHOUT_HEAD(expect_exit_code_and_exit);
29445147a9marcelATF_TC_BODY(expect_exit_code_and_exit, tc)
29545147a9marcel{
29645147a9marcel    atf_tc_expect_exit(123, "Call will exit");
29745147a9marcel    exit(123);
29845147a9marcel}
29945147a9marcel
30045147a9marcelATF_TC_WITHOUT_HEAD(expect_exit_but_pass);
30145147a9marcelATF_TC_BODY(expect_exit_but_pass, tc)
30245147a9marcel{
30345147a9marcel    atf_tc_expect_exit(-1, "Call won't exit");
30445147a9marcel}
30545147a9marcel
30645147a9marcelATF_TC_WITHOUT_HEAD(expect_signal_any_and_signal);
30745147a9marcelATF_TC_BODY(expect_signal_any_and_signal, tc)
30845147a9marcel{
30945147a9marcel    atf_tc_expect_signal(-1, "Call will signal");
31045147a9marcel    kill(getpid(), SIGKILL);
31145147a9marcel}
31245147a9marcel
31345147a9marcelATF_TC_WITHOUT_HEAD(expect_signal_no_and_signal);
31445147a9marcelATF_TC_BODY(expect_signal_no_and_signal, tc)
31545147a9marcel{
31645147a9marcel    atf_tc_expect_signal(SIGHUP, "Call will signal");
31745147a9marcel    kill(getpid(), SIGHUP);
31845147a9marcel}
31945147a9marcel
32045147a9marcelATF_TC_WITHOUT_HEAD(expect_signal_but_pass);
32145147a9marcelATF_TC_BODY(expect_signal_but_pass, tc)
32245147a9marcel{
32345147a9marcel    atf_tc_expect_signal(-1, "Call won't signal");
32445147a9marcel}
32545147a9marcel
32645147a9marcelATF_TC_WITHOUT_HEAD(expect_death_and_exit);
32745147a9marcelATF_TC_BODY(expect_death_and_exit, tc)
32845147a9marcel{
32945147a9marcel    atf_tc_expect_death("Exit case");
33045147a9marcel    exit(123);
33145147a9marcel}
33245147a9marcel
33345147a9marcelATF_TC_WITHOUT_HEAD(expect_death_and_signal);
33445147a9marcelATF_TC_BODY(expect_death_and_signal, tc)
33545147a9marcel{
33645147a9marcel    atf_tc_expect_death("Signal case");
33745147a9marcel    kill(getpid(), SIGKILL);
33845147a9marcel}
33945147a9marcel
34045147a9marcelATF_TC_WITHOUT_HEAD(expect_death_but_pass);
34145147a9marcelATF_TC_BODY(expect_death_but_pass, tc)
34245147a9marcel{
34345147a9marcel    atf_tc_expect_death("Call won't die");
34445147a9marcel}
34545147a9marcel
34645147a9marcelATF_TC(expect_timeout_and_hang);
34745147a9marcelATF_TC_HEAD(expect_timeout_and_hang, tc)
34845147a9marcel{
34945147a9marcel    atf_tc_set_md_var(tc, "timeout", "1");
35045147a9marcel}
35145147a9marcelATF_TC_BODY(expect_timeout_and_hang, tc)
35245147a9marcel{
35345147a9marcel    atf_tc_expect_timeout("Will overrun");
35445147a9marcel    sleep(5);
35545147a9marcel}
35645147a9marcel
35745147a9marcelATF_TC(expect_timeout_but_pass);
35845147a9marcelATF_TC_HEAD(expect_timeout_but_pass, tc)
35945147a9marcel{
36045147a9marcel    atf_tc_set_md_var(tc, "timeout", "1");
36145147a9marcel}
36245147a9marcelATF_TC_BODY(expect_timeout_but_pass, tc)
36345147a9marcel{
36445147a9marcel    atf_tc_expect_timeout("Will just exit");
36545147a9marcel}
36645147a9marcel
36745147a9marcel/* ---------------------------------------------------------------------
36845147a9marcel * Helper tests for "t_meta_data".
36945147a9marcel * --------------------------------------------------------------------- */
37045147a9marcel
37145147a9marcelATF_TC_WITHOUT_HEAD(metadata_no_descr);
37245147a9marcelATF_TC_BODY(metadata_no_descr, tc)
37345147a9marcel{
37445147a9marcel}
37545147a9marcel
37645147a9marcelATF_TC_WITHOUT_HEAD(metadata_no_head);
37745147a9marcelATF_TC_BODY(metadata_no_head, tc)
37845147a9marcel{
37945147a9marcel}
38045147a9marcel
38145147a9marcel/* ---------------------------------------------------------------------
38245147a9marcel * Helper tests for "t_srcdir".
38345147a9marcel * --------------------------------------------------------------------- */
38445147a9marcel
38545147a9marcelATF_TC(srcdir_exists);
38645147a9marcelATF_TC_HEAD(srcdir_exists, tc)
38745147a9marcel{
38845147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_srcdir test "
38945147a9marcel                      "program");
39045147a9marcel}
39145147a9marcelATF_TC_BODY(srcdir_exists, tc)
39245147a9marcel{
39345147a9marcel    atf_fs_path_t p;
39445147a9marcel    bool b;
39545147a9marcel
39645147a9marcel    RE(atf_fs_path_init_fmt(&p, "%s/datafile",
39745147a9marcel                            atf_tc_get_config_var(tc, "srcdir")));
39845147a9marcel    RE(atf_fs_exists(&p, &b));
39945147a9marcel    atf_fs_path_fini(&p);
40045147a9marcel    if (!b)
40145147a9marcel        atf_tc_fail("Cannot find datafile");
40245147a9marcel}
40345147a9marcel
40445147a9marcel/* ---------------------------------------------------------------------
40545147a9marcel * Helper tests for "t_result".
40645147a9marcel * --------------------------------------------------------------------- */
40745147a9marcel
40845147a9marcelATF_TC_WITHOUT_HEAD(result_pass);
40945147a9marcelATF_TC_BODY(result_pass, tc)
41045147a9marcel{
41145147a9marcel    printf("msg\n");
41245147a9marcel}
41345147a9marcel
41445147a9marcelATF_TC_WITHOUT_HEAD(result_fail);
41545147a9marcelATF_TC_BODY(result_fail, tc)
41645147a9marcel{
41745147a9marcel    printf("msg\n");
41845147a9marcel    atf_tc_fail("Failure reason");
41945147a9marcel}
42045147a9marcel
42145147a9marcelATF_TC_WITHOUT_HEAD(result_skip);
42245147a9marcelATF_TC_BODY(result_skip, tc)
42345147a9marcel{
42445147a9marcel    printf("msg\n");
42545147a9marcel    atf_tc_skip("Skipped reason");
42645147a9marcel}
42745147a9marcel
42845147a9marcelATF_TC(result_newlines_fail);
42945147a9marcelATF_TC_HEAD(result_newlines_fail, tc)
43045147a9marcel{
43145147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_result test "
43245147a9marcel                      "program");
43345147a9marcel}
43445147a9marcelATF_TC_BODY(result_newlines_fail, tc)
43545147a9marcel{
43645147a9marcel    atf_tc_fail("First line\nSecond line");
43745147a9marcel}
43845147a9marcel
43945147a9marcelATF_TC(result_newlines_skip);
44045147a9marcelATF_TC_HEAD(result_newlines_skip, tc)
44145147a9marcel{
44245147a9marcel    atf_tc_set_md_var(tc, "descr", "Helper test case for the t_result test "
44345147a9marcel                      "program");
44445147a9marcel}
44545147a9marcelATF_TC_BODY(result_newlines_skip, tc)
44645147a9marcel{
44745147a9marcel    atf_tc_skip("First line\nSecond line");
44845147a9marcel}
44945147a9marcel
45045147a9marcel/* ---------------------------------------------------------------------
45145147a9marcel * Main.
45245147a9marcel * --------------------------------------------------------------------- */
45345147a9marcel
45445147a9marcelATF_TP_ADD_TCS(tp)
45545147a9marcel{
45645147a9marcel    /* Add helper tests for t_cleanup. */
45745147a9marcel    ATF_TP_ADD_TC(tp, cleanup_pass);
45845147a9marcel    ATF_TP_ADD_TC(tp, cleanup_fail);
45945147a9marcel    ATF_TP_ADD_TC(tp, cleanup_skip);
46045147a9marcel    ATF_TP_ADD_TC(tp, cleanup_curdir);
46145147a9marcel    ATF_TP_ADD_TC(tp, cleanup_sigterm);
46245147a9marcel
46345147a9marcel    /* Add helper tests for t_config. */
46445147a9marcel    ATF_TP_ADD_TC(tp, config_unset);
46545147a9marcel    ATF_TP_ADD_TC(tp, config_empty);
46645147a9marcel    ATF_TP_ADD_TC(tp, config_value);
46745147a9marcel    ATF_TP_ADD_TC(tp, config_multi_value);
46845147a9marcel
46945147a9marcel    /* Add helper tests for t_expect. */
47045147a9marcel    ATF_TP_ADD_TC(tp, expect_pass_and_pass);
47145147a9marcel    ATF_TP_ADD_TC(tp, expect_pass_but_fail_requirement);
47245147a9marcel    ATF_TP_ADD_TC(tp, expect_pass_but_fail_check);
47345147a9marcel    ATF_TP_ADD_TC(tp, expect_fail_and_fail_requirement);
47445147a9marcel    ATF_TP_ADD_TC(tp, expect_fail_and_fail_check);
47545147a9marcel    ATF_TP_ADD_TC(tp, expect_fail_but_pass);
47645147a9marcel    ATF_TP_ADD_TC(tp, expect_exit_any_and_exit);
47745147a9marcel    ATF_TP_ADD_TC(tp, expect_exit_code_and_exit);
47845147a9marcel    ATF_TP_ADD_TC(tp, expect_exit_but_pass);
47945147a9marcel    ATF_TP_ADD_TC(tp, expect_signal_any_and_signal);
48045147a9marcel    ATF_TP_ADD_TC(tp, expect_signal_no_and_signal);
48145147a9marcel    ATF_TP_ADD_TC(tp, expect_signal_but_pass);
48245147a9marcel    ATF_TP_ADD_TC(tp, expect_death_and_exit);
48345147a9marcel    ATF_TP_ADD_TC(tp, expect_death_and_signal);
48445147a9marcel    ATF_TP_ADD_TC(tp, expect_death_but_pass);
48545147a9marcel    ATF_TP_ADD_TC(tp, expect_timeout_and_hang);
48645147a9marcel    ATF_TP_ADD_TC(tp, expect_timeout_but_pass);
48745147a9marcel
48845147a9marcel    /* Add helper tests for t_meta_data. */
48945147a9marcel    ATF_TP_ADD_TC(tp, metadata_no_descr);
49045147a9marcel    ATF_TP_ADD_TC(tp, metadata_no_head);
49145147a9marcel
49245147a9marcel    /* Add helper tests for t_srcdir. */
49345147a9marcel    ATF_TP_ADD_TC(tp, srcdir_exists);
49445147a9marcel
49545147a9marcel    /* Add helper tests for t_result. */
49645147a9marcel    ATF_TP_ADD_TC(tp, result_pass);
49745147a9marcel    ATF_TP_ADD_TC(tp, result_fail);
49845147a9marcel    ATF_TP_ADD_TC(tp, result_skip);
49945147a9marcel    ATF_TP_ADD_TC(tp, result_newlines_fail);
50045147a9marcel    ATF_TP_ADD_TC(tp, result_newlines_skip);
50145147a9marcel
50245147a9marcel    return atf_no_error();
50345147a9marcel}
504