Lines Matching refs:fs

62 namespace fs = utils::fs;
91 const fs::path lookup_path = fs::path(dir) / name; in lookup()
109 const fs::path source("f1.txt"); in ATF_TEST_CASE_BODY()
110 const fs::path target("f2.txt"); in ATF_TEST_CASE_BODY()
113 fs::copy(source, target); in ATF_TEST_CASE_BODY()
121 const fs::path source("f1.txt"); in ATF_TEST_CASE_BODY()
122 const fs::path target("f2.txt"); in ATF_TEST_CASE_BODY()
124 ATF_REQUIRE_THROW_RE(fs::error, "Cannot open copy source f1.txt", in ATF_TEST_CASE_BODY()
125 fs::copy(source, target)); in ATF_TEST_CASE_BODY()
136 const fs::path source("f1.txt"); in ATF_TEST_CASE_BODY()
137 const fs::path target("f2.txt"); in ATF_TEST_CASE_BODY()
143 ATF_REQUIRE_THROW_RE(fs::error, "Cannot create copy target f2.txt", in ATF_TEST_CASE_BODY()
144 fs::copy(source, target)); in ATF_TEST_CASE_BODY()
151 const fs::path previous = fs::current_path(); in ATF_TEST_CASE_BODY()
152 fs::mkdir(fs::path("root"), 0755); in ATF_TEST_CASE_BODY()
154 const fs::path cwd = fs::current_path(); in ATF_TEST_CASE_BODY()
163 const fs::path previous = fs::current_path(); in ATF_TEST_CASE_BODY()
164 fs::mkdir(fs::path("root"), 0755); in ATF_TEST_CASE_BODY()
168 (void)fs::current_path(); in ATF_TEST_CASE_BODY()
170 } catch (const fs::system_error& e) { in ATF_TEST_CASE_BODY()
179 const fs::path dir("dir"); in ATF_TEST_CASE_BODY()
180 ATF_REQUIRE(!fs::exists(dir)); in ATF_TEST_CASE_BODY()
181 fs::mkdir(dir, 0755); in ATF_TEST_CASE_BODY()
182 ATF_REQUIRE(fs::exists(dir)); in ATF_TEST_CASE_BODY()
190 ATF_REQUIRE(!fs::find_in_path("ls")); in ATF_TEST_CASE_BODY()
192 ATF_REQUIRE(!fs::find_in_path("ls")); in ATF_TEST_CASE_BODY()
200 ATF_REQUIRE(!fs::find_in_path("ls")); in ATF_TEST_CASE_BODY()
202 ATF_REQUIRE(!fs::find_in_path("ls")); in ATF_TEST_CASE_BODY()
209 const fs::path dir = fs::current_path() / "bin"; in ATF_TEST_CASE_BODY()
210 fs::mkdir(dir, 0755); in ATF_TEST_CASE_BODY()
213 ATF_REQUIRE(!fs::find_in_path("ls")); in ATF_TEST_CASE_BODY()
215 ATF_REQUIRE_EQ(dir / "ls", fs::find_in_path("ls").get()); in ATF_TEST_CASE_BODY()
222 const fs::path dir1 = fs::current_path() / "dir1"; in ATF_TEST_CASE_BODY()
223 const fs::path dir2 = fs::current_path() / "dir2"; in ATF_TEST_CASE_BODY()
224 fs::mkdir(dir1, 0755); in ATF_TEST_CASE_BODY()
225 fs::mkdir(dir2, 0755); in ATF_TEST_CASE_BODY()
228 ATF_REQUIRE(!fs::find_in_path("ls")); in ATF_TEST_CASE_BODY()
230 ATF_REQUIRE_EQ(dir2 / "ls", fs::find_in_path("ls").get()); in ATF_TEST_CASE_BODY()
232 ATF_REQUIRE_EQ(dir1 / "ls", fs::find_in_path("ls").get()); in ATF_TEST_CASE_BODY()
241 ATF_REQUIRE(!fs::find_in_path("foo-bar")); in ATF_TEST_CASE_BODY()
243 ATF_REQUIRE_EQ(fs::path("foo-bar").to_absolute(), in ATF_TEST_CASE_BODY()
244 fs::find_in_path("foo-bar").get()); in ATF_TEST_CASE_BODY()
251 fs::mkdir(fs::path("my-bin"), 0755); in ATF_TEST_CASE_BODY()
254 ATF_REQUIRE(!fs::find_in_path("abcd")); in ATF_TEST_CASE_BODY()
256 ATF_REQUIRE_EQ(fs::path("my-bin/abcd").to_absolute(), in ATF_TEST_CASE_BODY()
257 fs::find_in_path("abcd").get()); in ATF_TEST_CASE_BODY()
264 const units::bytes space = fs::free_disk_space(fs::path(".")); in ATF_TEST_CASE_BODY()
276 cleanup_mount_point(const fs::path& cookie, const fs::path& mount_point) in cleanup_mount_point()
279 if (fs::exists(cookie)) { in cleanup_mount_point()
280 fs::unmount(mount_point); in cleanup_mount_point()
297 const fs::path mount_point("mount_point"); in ATF_TEST_CASE_BODY()
298 fs::mkdir(mount_point, 0755); in ATF_TEST_CASE_BODY()
299 fs::mount_tmpfs(mount_point, units::bytes(32 * units::MB)); in ATF_TEST_CASE_BODY()
301 const units::bytes space = fs::free_disk_space(fs::path(mount_point)); in ATF_TEST_CASE_BODY()
302 fs::unmount(mount_point); in ATF_TEST_CASE_BODY()
303 fs::unlink(fs::path("mounted")); in ATF_TEST_CASE_BODY()
306 } catch (const fs::unsupported_operation_error& e) { in ATF_TEST_CASE_BODY()
312 cleanup_mount_point(fs::path("mounted"), fs::path("mount_point")); in ATF_TEST_CASE_CLEANUP()
319 ATF_REQUIRE_THROW_RE(fs::error, "Failed to stat file system for missing", in ATF_TEST_CASE_BODY()
320 fs::free_disk_space(fs::path("missing"))); in ATF_TEST_CASE_BODY()
327 const fs::path file("file"); in ATF_TEST_CASE_BODY()
329 ATF_REQUIRE(!fs::is_directory(file)); in ATF_TEST_CASE_BODY()
331 const fs::path dir("dir"); in ATF_TEST_CASE_BODY()
332 fs::mkdir(dir, 0755); in ATF_TEST_CASE_BODY()
333 ATF_REQUIRE(fs::is_directory(dir)); in ATF_TEST_CASE_BODY()
344 fs::mkdir(fs::path("dir"), 0000); in ATF_TEST_CASE_BODY()
345 ATF_REQUIRE_THROW(fs::error, fs::is_directory(fs::path("dir/foo"))); in ATF_TEST_CASE_BODY()
360 fs::mkdir(fs::path("dir"), 0755); in ATF_TEST_CASE_BODY()
369 fs::mkdir(fs::path("dir1/dir2"), 0755); in ATF_TEST_CASE_BODY()
371 } catch (const fs::system_error& e) { in ATF_TEST_CASE_BODY()
383 fs::mkdir_p(fs::path("new-dir"), 0755); in ATF_TEST_CASE_BODY()
392 fs::mkdir_p(fs::path("a/b/c"), 0755); in ATF_TEST_CASE_BODY()
402 fs::mkdir(fs::path("a"), 0755); in ATF_TEST_CASE_BODY()
403 fs::mkdir(fs::path("a/b"), 0755); in ATF_TEST_CASE_BODY()
404 fs::mkdir_p(fs::path("a/b"), 0755); in ATF_TEST_CASE_BODY()
415 fs::mkdir(fs::path("a"), 0755); in ATF_TEST_CASE_BODY()
416 fs::mkdir(fs::path("a/b"), 0755); in ATF_TEST_CASE_BODY()
419 fs::mkdir_p(fs::path("a/b/c/d"), 0755); in ATF_TEST_CASE_BODY()
421 } catch (const fs::system_error& e) { in ATF_TEST_CASE_BODY()
435 const fs::path tmpdir = fs::current_path() / "tmp"; in ATF_TEST_CASE_BODY()
437 fs::mkdir(tmpdir, 0755); in ATF_TEST_CASE_BODY()
440 const fs::path tempdir = fs::mkdtemp_public(dir_template); in ATF_TEST_CASE_BODY()
455 const fs::path dir = fs::mkdtemp_public(dir_template); in ATF_TEST_CASE_BODY()
456 const fs::path subdir = dir / "subdir"; in ATF_TEST_CASE_BODY()
457 fs::mkdir(subdir, 0755); in ATF_TEST_CASE_BODY()
477 fs::current_path(); in ATF_TEST_CASE_BODY()
479 } catch (const fs::error& e) { in ATF_TEST_CASE_BODY()
508 const fs::path dir = fs::mkdtemp_public(dir_template); in ATF_TEST_CASE_BODY()
509 const fs::path cookie = dir / "not-secret"; in ATF_TEST_CASE_BODY()
557 const fs::path tmpdir = fs::current_path() / "tmp"; in ATF_TEST_CASE_BODY()
559 fs::mkdir(tmpdir, 0755); in ATF_TEST_CASE_BODY()
562 const fs::path tempfile = fs::mkstemp(file_template); in ATF_TEST_CASE_BODY()
571 const fs::path mount_point("mount_point"); in test_mount_tmpfs_ok()
572 fs::mkdir(mount_point, 0755); in test_mount_tmpfs_ok()
576 fs::mount_tmpfs(mount_point, size); in test_mount_tmpfs_ok()
584 fs::unmount(mount_point); in test_mount_tmpfs_ok()
585 } catch (const fs::unsupported_operation_error& e) { in test_mount_tmpfs_ok()
602 cleanup_mount_point(fs::path("mounted"), fs::path("mount_point")); in ATF_TEST_CASE_CLEANUP()
617 cleanup_mount_point(fs::path("mounted"), fs::path("mount_point")); in ATF_TEST_CASE_CLEANUP()
629 fs::mount_tmpfs(fs::path("non-existent")); in ATF_TEST_CASE_BODY()
630 } catch (const fs::unsupported_operation_error& e) { in ATF_TEST_CASE_BODY()
632 } catch (const fs::error& e) { in ATF_TEST_CASE_BODY()
641 fs::mkdir(fs::path("root"), 0755); in ATF_TEST_CASE_BODY()
643 fs::rm_r(fs::path("root")); in ATF_TEST_CASE_BODY()
651 fs::mkdir(fs::path("root"), 0755); in ATF_TEST_CASE_BODY()
653 fs::mkdir(fs::path("root/.hidden_dir"), 0755); in ATF_TEST_CASE_BODY()
657 fs::mkdir(fs::path("root/dir1"), 0755); in ATF_TEST_CASE_BODY()
658 fs::mkdir(fs::path("root/dir1/dir2"), 0755); in ATF_TEST_CASE_BODY()
660 fs::mkdir(fs::path("root/dir1/dir3"), 0755); in ATF_TEST_CASE_BODY()
662 fs::rm_r(fs::path("root")); in ATF_TEST_CASE_BODY()
672 fs::rmdir(fs::path("foo")); in ATF_TEST_CASE_BODY()
680 ATF_REQUIRE_THROW_RE(fs::system_error, "Removal of foo failed", in ATF_TEST_CASE_BODY()
681 fs::rmdir(fs::path("foo"))); in ATF_TEST_CASE_BODY()
688 fs::mkdir(fs::path("dir"), 0755); in ATF_TEST_CASE_BODY()
692 const std::set< fs::directory_entry > contents = fs::scan_directory( in ATF_TEST_CASE_BODY()
693 fs::path("dir")); in ATF_TEST_CASE_BODY()
695 std::set< fs::directory_entry > exp_contents; in ATF_TEST_CASE_BODY()
696 exp_contents.insert(fs::directory_entry(".")); in ATF_TEST_CASE_BODY()
697 exp_contents.insert(fs::directory_entry("..")); in ATF_TEST_CASE_BODY()
698 exp_contents.insert(fs::directory_entry(".hidden")); in ATF_TEST_CASE_BODY()
699 exp_contents.insert(fs::directory_entry("foo")); in ATF_TEST_CASE_BODY()
708 ATF_REQUIRE_THROW_RE(fs::system_error, "opendir(.*missing.*) failed", in ATF_TEST_CASE_BODY()
709 fs::scan_directory(fs::path("missing"))); in ATF_TEST_CASE_BODY()
718 fs::unlink(fs::path("foo")); in ATF_TEST_CASE_BODY()
726 ATF_REQUIRE_THROW_RE(fs::system_error, "Removal of foo failed", in ATF_TEST_CASE_BODY()
727 fs::unlink(fs::path("foo"))); in ATF_TEST_CASE_BODY()
738 const fs::path mount_point("mount_point"); in ATF_TEST_CASE_BODY()
739 fs::mkdir(mount_point, 0755); in ATF_TEST_CASE_BODY()
743 fs::mount_tmpfs(mount_point); in ATF_TEST_CASE_BODY()
744 } catch (const fs::unsupported_operation_error& e) { in ATF_TEST_CASE_BODY()
750 ATF_REQUIRE(!fs::exists(mount_point / "test1")); in ATF_TEST_CASE_BODY()
751 ATF_REQUIRE( fs::exists(mount_point / "test2")); in ATF_TEST_CASE_BODY()
752 fs::unmount(mount_point); in ATF_TEST_CASE_BODY()
753 ATF_REQUIRE( fs::exists(mount_point / "test1")); in ATF_TEST_CASE_BODY()
754 ATF_REQUIRE(!fs::exists(mount_point / "test2")); in ATF_TEST_CASE_BODY()
765 ATF_REQUIRE_THROW(fs::error, fs::unmount(fs::path("non-existent"))); in ATF_TEST_CASE_BODY()