diff options
author | jmmv <jmmv@FreeBSD.org> | 2013-11-17 23:51:19 +0000 |
---|---|---|
committer | jmmv <jmmv@FreeBSD.org> | 2013-11-17 23:51:19 +0000 |
commit | 8c7e11817a76331c10afb89d609a304c49dd588b (patch) | |
tree | e69b0ffecc81ada4e0d39442aa0f39a4abc93806 /contrib/atf/atf-c/detail | |
parent | a21ab9564f9972a893699a0178df90fd60e11b47 (diff) | |
parent | b849e3606cf0dc725ff02712cd92907131c0188c (diff) | |
download | FreeBSD-src-8c7e11817a76331c10afb89d609a304c49dd588b.zip FreeBSD-src-8c7e11817a76331c10afb89d609a304c49dd588b.tar.gz |
MFV: Import atf-0.18.
Approved by: rpaulo (mentor)
Diffstat (limited to 'contrib/atf/atf-c/detail')
-rw-r--r-- | contrib/atf/atf-c/detail/Atffile | 1 | ||||
-rw-r--r-- | contrib/atf/atf-c/detail/Kyuafile | 1 | ||||
-rw-r--r-- | contrib/atf/atf-c/detail/Makefile.am.inc | 104 | ||||
-rw-r--r-- | contrib/atf/atf-c/detail/process_test.c | 40 | ||||
-rw-r--r-- | contrib/atf/atf-c/detail/sanity_test.c | 40 | ||||
-rw-r--r-- | contrib/atf/atf-c/detail/test_helpers.c | 67 | ||||
-rw-r--r-- | contrib/atf/atf-c/detail/test_helpers.h | 2 | ||||
-rw-r--r-- | contrib/atf/atf-c/detail/test_helpers_test.c | 185 |
8 files changed, 27 insertions, 413 deletions
diff --git a/contrib/atf/atf-c/detail/Atffile b/contrib/atf/atf-c/detail/Atffile index f715c98..5fd8593 100644 --- a/contrib/atf/atf-c/detail/Atffile +++ b/contrib/atf/atf-c/detail/Atffile @@ -9,6 +9,5 @@ tp: list_test tp: map_test tp: process_test tp: sanity_test -tp: test_helpers_test tp: text_test tp: user_test diff --git a/contrib/atf/atf-c/detail/Kyuafile b/contrib/atf/atf-c/detail/Kyuafile index 3f4901d..bb741da 100644 --- a/contrib/atf/atf-c/detail/Kyuafile +++ b/contrib/atf/atf-c/detail/Kyuafile @@ -9,6 +9,5 @@ atf_test_program{name="list_test"} atf_test_program{name="map_test"} atf_test_program{name="process_test"} atf_test_program{name="sanity_test"} -atf_test_program{name="test_helpers_test"} atf_test_program{name="text_test"} atf_test_program{name="user_test"} diff --git a/contrib/atf/atf-c/detail/Makefile.am.inc b/contrib/atf/atf-c/detail/Makefile.am.inc deleted file mode 100644 index d3c325b..0000000 --- a/contrib/atf/atf-c/detail/Makefile.am.inc +++ /dev/null @@ -1,104 +0,0 @@ -# -# Automated Testing Framework (atf) -# -# Copyright (c) 2007 The NetBSD Foundation, Inc. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND -# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER -# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# - -libatf_c_la_SOURCES += atf-c/detail/dynstr.c \ - atf-c/detail/dynstr.h \ - atf-c/detail/env.c \ - atf-c/detail/env.h \ - atf-c/detail/fs.c \ - atf-c/detail/fs.h \ - atf-c/detail/list.c \ - atf-c/detail/list.h \ - atf-c/detail/map.c \ - atf-c/detail/map.h \ - atf-c/detail/process.c \ - atf-c/detail/process.h \ - atf-c/detail/sanity.c \ - atf-c/detail/sanity.h \ - atf-c/detail/text.c \ - atf-c/detail/text.h \ - atf-c/detail/tp_main.c \ - atf-c/detail/user.c \ - atf-c/detail/user.h - -tests_atf_c_detail_DATA = atf-c/detail/Atffile \ - atf-c/detail/Kyuafile -tests_atf_c_detaildir = $(pkgtestsdir)/atf-c/detail -EXTRA_DIST += $(tests_atf_c_detail_DATA) - -noinst_LTLIBRARIES += atf-c/detail/libtest_helpers.la -atf_c_detail_libtest_helpers_la_SOURCES = atf-c/detail/test_helpers.c \ - atf-c/detail/test_helpers.h -atf_c_detail_libtest_helpers_la_CPPFLAGS = -I$(srcdir)/atf-c - -tests_atf_c_detail_PROGRAMS = atf-c/detail/dynstr_test -atf_c_detail_dynstr_test_SOURCES = atf-c/detail/dynstr_test.c -atf_c_detail_dynstr_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/env_test -atf_c_detail_env_test_SOURCES = atf-c/detail/env_test.c -atf_c_detail_env_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/fs_test -atf_c_detail_fs_test_SOURCES = atf-c/detail/fs_test.c -atf_c_detail_fs_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/test_helpers_test -atf_c_detail_test_helpers_test_SOURCES = atf-c/detail/test_helpers_test.c -atf_c_detail_test_helpers_test_LDADD = atf-c/detail/libtest_helpers.la \ - libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/list_test -atf_c_detail_list_test_SOURCES = atf-c/detail/list_test.c -atf_c_detail_list_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/map_test -atf_c_detail_map_test_SOURCES = atf-c/detail/map_test.c -atf_c_detail_map_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/process_helpers -atf_c_detail_process_helpers_SOURCES = atf-c/detail/process_helpers.c - -tests_atf_c_detail_PROGRAMS += atf-c/detail/process_test -atf_c_detail_process_test_SOURCES = atf-c/detail/process_test.c -atf_c_detail_process_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/sanity_test -atf_c_detail_sanity_test_SOURCES = atf-c/detail/sanity_test.c -atf_c_detail_sanity_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/text_test -atf_c_detail_text_test_SOURCES = atf-c/detail/text_test.c -atf_c_detail_text_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -tests_atf_c_detail_PROGRAMS += atf-c/detail/user_test -atf_c_detail_user_test_SOURCES = atf-c/detail/user_test.c -atf_c_detail_user_test_LDADD = atf-c/detail/libtest_helpers.la libatf-c.la - -# vim: syntax=make:noexpandtab:shiftwidth=8:softtabstop=8 diff --git a/contrib/atf/atf-c/detail/process_test.c b/contrib/atf/atf-c/detail/process_test.c index 229593b..9e55f70 100644 --- a/contrib/atf/atf-c/detail/process_test.c +++ b/contrib/atf/atf-c/detail/process_test.c @@ -95,12 +95,12 @@ check_file(const enum out_type type) { switch (type) { case stdout_type: - ATF_CHECK(grep_file("stdout", "stdout: msg")); - ATF_CHECK(!grep_file("stdout", "stderr: msg")); + ATF_CHECK(atf_utils_grep_file("stdout: msg", "stdout")); + ATF_CHECK(!atf_utils_grep_file("stderr: msg", "stdout")); break; case stderr_type: - ATF_CHECK(grep_file("stderr", "stderr: msg")); - ATF_CHECK(!grep_file("stderr", "stdout: msg")); + ATF_CHECK(atf_utils_grep_file("stderr: msg", "stderr")); + ATF_CHECK(!atf_utils_grep_file("stdout: msg", "stderr")); break; default: UNREACHABLE; @@ -110,7 +110,7 @@ check_file(const enum out_type type) struct capture_stream { struct base_stream m_base; - atf_dynstr_t m_msg; + char *m_msg; }; #define CAPTURE_STREAM(type) \ { .m_base = BASE_STREAM(capture_stream_init, \ @@ -126,7 +126,7 @@ capture_stream_init(void *v) s->m_base.m_sb_ptr = &s->m_base.m_sb; RE(atf_process_stream_init_capture(&s->m_base.m_sb)); - RE(atf_dynstr_init(&s->m_msg)); + s->m_msg = NULL; } static @@ -137,10 +137,10 @@ capture_stream_process(void *v, atf_process_child_t *c) switch (s->m_base.m_type) { case stdout_type: - (void)read_line(atf_process_child_stdout(c), &s->m_msg); + s->m_msg = atf_utils_readline(atf_process_child_stdout(c)); break; case stderr_type: - (void)read_line(atf_process_child_stderr(c), &s->m_msg); + s->m_msg = atf_utils_readline(atf_process_child_stderr(c)); break; default: UNREACHABLE; @@ -155,18 +155,18 @@ capture_stream_fini(void *v) switch (s->m_base.m_type) { case stdout_type: - ATF_CHECK(grep_string(&s->m_msg, "stdout: msg")); - ATF_CHECK(!grep_string(&s->m_msg, "stderr: msg")); + ATF_CHECK(atf_utils_grep_string("stdout: msg", s->m_msg)); + ATF_CHECK(!atf_utils_grep_string("stderr: msg", s->m_msg)); break; case stderr_type: - ATF_CHECK(!grep_string(&s->m_msg, "stdout: msg")); - ATF_CHECK(grep_string(&s->m_msg, "stderr: msg")); + ATF_CHECK(!atf_utils_grep_string("stdout: msg", s->m_msg)); + ATF_CHECK(atf_utils_grep_string("stderr: msg", s->m_msg)); break; default: UNREACHABLE; } - atf_dynstr_fini(&s->m_msg); + free(s->m_msg); atf_process_stream_fini(&s->m_base.m_sb); } @@ -881,16 +881,10 @@ static void check_line(int fd, const char *exp) { - atf_dynstr_t line; - bool eof; - - atf_dynstr_init(&line); - eof = read_line(fd, &line); - ATF_CHECK(!eof); - ATF_CHECK_MSG(atf_equal_dynstr_cstring(&line, exp), - "read: '%s', expected: '%s'", - atf_dynstr_cstring(&line), exp); - atf_dynstr_fini(&line); + char *line = atf_utils_readline(fd); + ATF_CHECK(line != NULL); + ATF_CHECK_STREQ_MSG(exp, line, "read: '%s', expected: '%s'", line, exp); + free(line); } ATF_TC(exec_failure); diff --git a/contrib/atf/atf-c/detail/sanity_test.c b/contrib/atf/atf-c/detail/sanity_test.c index af2bbc0..7c8285b 100644 --- a/contrib/atf/atf-c/detail/sanity_test.c +++ b/contrib/atf/atf-c/detail/sanity_test.c @@ -53,21 +53,6 @@ enum type { inv, pre, post, unreachable }; -static -bool -grep(const atf_dynstr_t *line, const char *text) -{ - const char *l = atf_dynstr_cstring(line); - bool found; - - found = false; - - if (strstr(l, text) != NULL) - found = true; - - return found; -} - struct test_data { enum type m_type; bool m_cond; @@ -109,9 +94,8 @@ do_test(enum type t, bool cond) { atf_process_child_t child; atf_process_status_t status; - bool eof; int nlines; - atf_dynstr_t lines[3]; + char *lines[3]; { atf_process_stream_t outsb, errsb; @@ -125,13 +109,9 @@ do_test(enum type t, bool cond) } nlines = 0; - eof = false; - do { - RE(atf_dynstr_init(&lines[nlines])); - if (!eof) - eof = read_line(atf_process_child_stderr(&child), &lines[nlines]); + while (nlines < 3 && (lines[nlines] = + atf_utils_readline(atf_process_child_stderr(&child))) != NULL) nlines++; - } while (nlines < 3); ATF_REQUIRE(nlines == 0 || nlines == 3); RE(atf_process_child_wait(&child, &status)); @@ -147,29 +127,29 @@ do_test(enum type t, bool cond) if (!cond) { switch (t) { case inv: - ATF_REQUIRE(grep(&lines[0], "Invariant")); + ATF_REQUIRE(atf_utils_grep_string("Invariant", lines[0])); break; case pre: - ATF_REQUIRE(grep(&lines[0], "Precondition")); + ATF_REQUIRE(atf_utils_grep_string("Precondition", lines[0])); break; case post: - ATF_REQUIRE(grep(&lines[0], "Postcondition")); + ATF_REQUIRE(atf_utils_grep_string("Postcondition", lines[0])); break; case unreachable: - ATF_REQUIRE(grep(&lines[0], "Invariant")); + ATF_REQUIRE(atf_utils_grep_string("Invariant", lines[0])); break; } - ATF_REQUIRE(grep(&lines[0], __FILE__)); - ATF_REQUIRE(grep(&lines[2], PACKAGE_BUGREPORT)); + ATF_REQUIRE(atf_utils_grep_string(__FILE__, lines[0])); + ATF_REQUIRE(atf_utils_grep_string(PACKAGE_BUGREPORT, lines[2])); } while (nlines > 0) { nlines--; - atf_dynstr_fini(&lines[nlines]); + free(lines[nlines]); } } diff --git a/contrib/atf/atf-c/detail/test_helpers.c b/contrib/atf/atf-c/detail/test_helpers.c index b20a849..aa64c12 100644 --- a/contrib/atf/atf-c/detail/test_helpers.c +++ b/contrib/atf/atf-c/detail/test_helpers.c @@ -30,7 +30,6 @@ #include <fcntl.h> #include <stdio.h> #include <stdlib.h> -#include <regex.h> #include <unistd.h> #include "atf-c/build.h" @@ -106,72 +105,6 @@ get_process_helpers_path(const atf_tc_t *tc, const bool is_detail, is_detail ? "" : "detail/")); } -bool -grep_string(const atf_dynstr_t *str, const char *regex) -{ - int res; - regex_t preg; - - printf("Looking for '%s' in '%s'\n", regex, atf_dynstr_cstring(str)); - ATF_REQUIRE(regcomp(&preg, regex, REG_EXTENDED) == 0); - - res = regexec(&preg, atf_dynstr_cstring(str), 0, NULL, 0); - ATF_REQUIRE(res == 0 || res == REG_NOMATCH); - - regfree(&preg); - - return res == 0; -} - -bool -grep_file(const char *file, const char *regex, ...) -{ - bool done, found; - int fd; - va_list ap; - atf_dynstr_t formatted; - - va_start(ap, regex); - RE(atf_dynstr_init_ap(&formatted, regex, ap)); - va_end(ap); - - done = false; - found = false; - ATF_REQUIRE((fd = open(file, O_RDONLY)) != -1); - do { - atf_dynstr_t line; - - RE(atf_dynstr_init(&line)); - - done = read_line(fd, &line); - if (!done) - found = grep_string(&line, atf_dynstr_cstring(&formatted)); - - atf_dynstr_fini(&line); - } while (!found && !done); - close(fd); - - atf_dynstr_fini(&formatted); - - return found; -} - -bool -read_line(int fd, atf_dynstr_t *dest) -{ - char ch; - ssize_t cnt; - - while ((cnt = read(fd, &ch, sizeof(ch))) == sizeof(ch) && - ch != '\n') { - const atf_error_t err = atf_dynstr_append_fmt(dest, "%c", ch); - ATF_REQUIRE(!atf_is_error(err)); - } - ATF_REQUIRE(cnt != -1); - - return cnt == 0; -} - struct run_h_tc_data { atf_tc_t *m_tc; const char *m_resname; diff --git a/contrib/atf/atf-c/detail/test_helpers.h b/contrib/atf/atf-c/detail/test_helpers.h index b0ce6cc..5df034f 100644 --- a/contrib/atf/atf-c/detail/test_helpers.h +++ b/contrib/atf/atf-c/detail/test_helpers.h @@ -81,7 +81,5 @@ void build_check_c_o(const atf_tc_t *, const char *, const char *, const bool); void header_check(const char *); void get_process_helpers_path(const atf_tc_t *, const bool, struct atf_fs_path *); -bool grep_string(const struct atf_dynstr *, const char *); -bool grep_file(const char *, const char *, ...); bool read_line(int, struct atf_dynstr *); void run_h_tc(atf_tc_t *, const char *, const char *, const char *); diff --git a/contrib/atf/atf-c/detail/test_helpers_test.c b/contrib/atf/atf-c/detail/test_helpers_test.c deleted file mode 100644 index 52d8608..0000000 --- a/contrib/atf/atf-c/detail/test_helpers_test.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Automated Testing Framework (atf) - * - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER - * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include <fcntl.h> -#include <stdio.h> -#include <unistd.h> - -#include <atf-c.h> - -#include "dynstr.h" -#include "test_helpers.h" - -/* --------------------------------------------------------------------- - * Test cases for the free functions. - * --------------------------------------------------------------------- */ - -/* TODO: Add checks for build_check_c_o and the macros defined in the - * header file. */ - -ATF_TC(grep_string); -ATF_TC_HEAD(grep_string, tc) -{ - atf_tc_set_md_var(tc, "descr", "Tests the grep_string helper " - "function"); -} -ATF_TC_BODY(grep_string, tc) -{ - atf_dynstr_t str; - - atf_dynstr_init_fmt(&str, "a string - aaaabbbb"); - ATF_CHECK(grep_string(&str, "a string")); - ATF_CHECK(grep_string(&str, "^a string")); - ATF_CHECK(grep_string(&str, "aaaabbbb$")); - ATF_CHECK(grep_string(&str, "aa.*bb")); - ATF_CHECK(!grep_string(&str, "foo")); - ATF_CHECK(!grep_string(&str, "bar")); - ATF_CHECK(!grep_string(&str, "aaaaa")); - - atf_dynstr_fini(&str); -} - - -ATF_TC(grep_file); -ATF_TC_HEAD(grep_file, tc) -{ - atf_tc_set_md_var(tc, "descr", "Tests the grep_file helper function"); -} -ATF_TC_BODY(grep_file, tc) -{ - FILE *f; - - f = fopen("test.txt", "w"); - ATF_CHECK(f != NULL); - fprintf(f, "line1\n"); - fprintf(f, "the second line\n"); - fprintf(f, "aaaabbbb\n"); - fclose(f); - - ATF_CHECK(grep_file("test.txt", "line1")); - ATF_CHECK(grep_file("test.txt", "line%d", 1)); - ATF_CHECK(grep_file("test.txt", "second line")); - ATF_CHECK(grep_file("test.txt", "aa.*bb")); - ATF_CHECK(!grep_file("test.txt", "foo")); - ATF_CHECK(!grep_file("test.txt", "bar")); - ATF_CHECK(!grep_file("test.txt", "aaaaa")); -} - -ATF_TC(read_line); -ATF_TC_HEAD(read_line, tc) -{ - atf_tc_set_md_var(tc, "descr", "Tests the read_line function"); -} -ATF_TC_BODY(read_line, tc) -{ - const char *l1 = "First line with % formatting % characters %"; - const char *l2 = "Second line; much longer than the first one"; - const char *l3 = "Last line, without terminator"; - - { - FILE *f; - - f = fopen("test", "w"); - ATF_REQUIRE(f != NULL); - fclose(f); - } - - { - int fd; - atf_dynstr_t dest; - bool eof; - - fd = open("test", O_RDONLY); - ATF_REQUIRE(fd != -1); - - RE(atf_dynstr_init(&dest)); - eof = read_line(fd, &dest); - ATF_REQUIRE(eof); - atf_dynstr_fini(&dest); - } - - { - FILE *f; - - f = fopen("test", "w"); - ATF_REQUIRE(f != NULL); - - fprintf(f, "%s\n", l1); - fprintf(f, "%s\n", l2); - fprintf(f, "%s", l3); - - fclose(f); - } - - { - int fd; - atf_dynstr_t dest; - bool eof; - - fd = open("test", O_RDONLY); - ATF_REQUIRE(fd != -1); - - RE(atf_dynstr_init(&dest)); - eof = read_line(fd, &dest); - ATF_REQUIRE(!eof); - printf("1st line: >%s<\n", atf_dynstr_cstring(&dest)); - ATF_REQUIRE(atf_equal_dynstr_cstring(&dest, l1)); - atf_dynstr_fini(&dest); - - RE(atf_dynstr_init(&dest)); - eof = read_line(fd, &dest); - ATF_REQUIRE(!eof); - printf("2nd line: >%s<\n", atf_dynstr_cstring(&dest)); - ATF_REQUIRE(atf_equal_dynstr_cstring(&dest, l2)); - atf_dynstr_fini(&dest); - - RE(atf_dynstr_init(&dest)); - eof = read_line(fd, &dest); - ATF_REQUIRE(eof); - printf("3rd line: >%s<\n", atf_dynstr_cstring(&dest)); - ATF_REQUIRE(atf_equal_dynstr_cstring(&dest, l3)); - atf_dynstr_fini(&dest); - - close(fd); - } -} - -/* --------------------------------------------------------------------- - * Main. - * --------------------------------------------------------------------- */ - -ATF_TP_ADD_TCS(tp) -{ - /* Add the tests for the free functions. */ - ATF_TP_ADD_TC(tp, grep_string); - ATF_TP_ADD_TC(tp, grep_file); - ATF_TP_ADD_TC(tp, read_line); - - return atf_no_error(); -} |