Lines Matching refs:atf
26 #include "atf-c++/utils.hpp"
43 #include <atf-c++.hpp>
70 atf::utils::create_file("file.txt", "");
71 atf::utils::redirect(STDOUT_FILENO, "captured.txt");
72 atf::utils::cat_file("file.txt", "PREFIX");
82 atf::utils::create_file("file.txt", "This is a single line\n");
83 atf::utils::redirect(STDOUT_FILENO, "captured.txt");
84 atf::utils::cat_file("file.txt", "PREFIX");
94 atf::utils::create_file("file.txt", "First\nSecond line\nAnd third\n");
95 atf::utils::redirect(STDOUT_FILENO, "captured.txt");
96 atf::utils::cat_file("file.txt", ">");
107 atf::utils::create_file("file.txt", "Foo\n bar baz");
108 atf::utils::redirect(STDOUT_FILENO, "captured.txt");
109 atf::utils::cat_file("file.txt", "PREFIX");
119 atf::utils::create_file("test.txt", "");
120 ATF_REQUIRE(atf::utils::compare_file("test.txt", ""));
126 atf::utils::create_file("test.txt", "");
127 ATF_REQUIRE(!atf::utils::compare_file("test.txt", "\n"));
128 ATF_REQUIRE(!atf::utils::compare_file("test.txt", "foo"));
129 ATF_REQUIRE(!atf::utils::compare_file("test.txt", " "));
135 atf::utils::create_file("test.txt", "this is a short file");
136 ATF_REQUIRE(atf::utils::compare_file("test.txt", "this is a short file"));
142 atf::utils::create_file("test.txt", "this is a short file");
143 ATF_REQUIRE(!atf::utils::compare_file("test.txt", ""));
144 ATF_REQUIRE(!atf::utils::compare_file("test.txt", "\n"));
145 ATF_REQUIRE(!atf::utils::compare_file("test.txt", "this is a Short file"));
146 ATF_REQUIRE(!atf::utils::compare_file("test.txt", "this is a short fil"));
147 ATF_REQUIRE(!atf::utils::compare_file("test.txt", "this is a short file "));
158 atf::utils::create_file("test.txt", long_contents);
160 ATF_REQUIRE(atf::utils::compare_file("test.txt", long_contents));
171 atf::utils::create_file("test.txt", long_contents);
173 ATF_REQUIRE(!atf::utils::compare_file("test.txt", ""));
174 ATF_REQUIRE(!atf::utils::compare_file("test.txt", "\n"));
175 ATF_REQUIRE(!atf::utils::compare_file("test.txt", "0123456789"));
177 ATF_REQUIRE(!atf::utils::compare_file("test.txt", long_contents));
183 atf::utils::create_file("src.txt", "");
186 atf::utils::copy_file("src.txt", "dest.txt");
187 ATF_REQUIRE(atf::utils::compare_file("dest.txt", ""));
196 atf::utils::create_file("src.txt", "This is a\ntest file\n");
197 atf::utils::copy_file("src.txt", "dest.txt");
198 ATF_REQUIRE(atf::utils::compare_file("dest.txt", "This is a\ntest file\n"));
204 atf::utils::create_file("test.txt", "This is a %d test");
212 atf::utils::create_file("test.txt", "foo");
214 ATF_REQUIRE( atf::utils::file_exists("test.txt"));
215 ATF_REQUIRE( atf::utils::file_exists("./test.txt"));
216 ATF_REQUIRE(!atf::utils::file_exists("./test.tx"));
217 ATF_REQUIRE(!atf::utils::file_exists("test.txt2"));
225 pid_t pid = atf::utils::fork();
253 ATF_REQUIRE( atf::utils::grep_collection("irs", strings));
254 ATF_REQUIRE( atf::utils::grep_collection("cond", strings));
255 ATF_REQUIRE(!atf::utils::grep_collection("Third", strings));
265 ATF_REQUIRE( atf::utils::grep_collection("irs", strings));
266 ATF_REQUIRE( atf::utils::grep_collection("cond", strings));
267 ATF_REQUIRE(!atf::utils::grep_collection("Third", strings));
273 atf::utils::create_file("test.txt", "line1\nthe second line\naaaabbbb\n");
275 ATF_REQUIRE(atf::utils::grep_file("line1", "test.txt"));
276 ATF_REQUIRE(atf::utils::grep_file("second line", "test.txt"));
277 ATF_REQUIRE(atf::utils::grep_file("aa.*bb", "test.txt"));
278 ATF_REQUIRE(!atf::utils::grep_file("foo", "test.txt"));
279 ATF_REQUIRE(!atf::utils::grep_file("bar", "test.txt"));
280 ATF_REQUIRE(!atf::utils::grep_file("aaaaa", "test.txt"));
287 ATF_REQUIRE(atf::utils::grep_string("a string", str));
288 ATF_REQUIRE(atf::utils::grep_string("^a string", str));
289 ATF_REQUIRE(atf::utils::grep_string("aaaabbbb$", str));
290 ATF_REQUIRE(atf::utils::grep_string("aa.*bb", str));
291 ATF_REQUIRE(!atf::utils::grep_string("foo", str));
292 ATF_REQUIRE(!atf::utils::grep_string("bar", str));
293 ATF_REQUIRE(!atf::utils::grep_string("aaaaa", str));
300 atf::utils::redirect(STDOUT_FILENO, "captured.txt");
311 atf::utils::redirect(STDERR_FILENO, "captured.txt");
322 atf::utils::redirect(15, "captured.txt");
332 const pid_t pid = atf::utils::fork();
338 atf::utils::wait(pid, exitstatus, expout, experr);
360 const pid_t parent = atf::utils::fork();
363 const pid_t child = atf::utils::fork();
374 atf::utils::wait(child, 50, "Child output\n", "Child error\n");
378 atf::utils::wait(parent, 40,
444 ATF_REQUIRE(atf::utils::compare_file("my-output.txt", "Some output\n"));
461 ATF_REQUIRE(atf::utils::compare_file("my-output.txt", "Some error\n"));