summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-06-20 17:26:30 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-06-26 17:57:29 +0200
commit01a0ed081f8eb6f7c41cd1052b146813fb94f699 (patch)
tree2a9a40c969279c063e66369a81bc6bac698fa7fa /test
parentc11e9142d2a1b04004dcbed282dc1e04d116e03f (diff)
downloadjustbuild-01a0ed081f8eb6f7c41cd1052b146813fb94f699.tar.gz
FileRoot: Add handling of non-upwards symlink...
...and update tests accordingly.
Diffstat (limited to 'test')
-rw-r--r--test/buildtool/build_engine/base_maps/create_maps_test_git_bundle.sh10
-rw-r--r--test/buildtool/build_engine/base_maps/directory_map.test.cpp4
-rw-r--r--test/buildtool/build_engine/base_maps/test_repo.hpp4
-rw-r--r--test/buildtool/file_system/directory_entries.test.cpp91
-rw-r--r--test/buildtool/file_system/file_root.test.cpp152
5 files changed, 160 insertions, 101 deletions
diff --git a/test/buildtool/build_engine/base_maps/create_maps_test_git_bundle.sh b/test/buildtool/build_engine/base_maps/create_maps_test_git_bundle.sh
index 141fbf78..7eab650e 100644
--- a/test/buildtool/build_engine/base_maps/create_maps_test_git_bundle.sh
+++ b/test/buildtool/build_engine/base_maps/create_maps_test_git_bundle.sh
@@ -20,23 +20,24 @@ set -e
# ---
# <root>
# |
-# +--src <--kSrcTreeId
+# +--src <--kSrcTreeId (6d57ba31821f69286e280334e4fd5f9dbd141721)
# | +--file
# | +--foo
+# | | +--link <--kSrcLinkId (2995a4d0e74917fd3e1383c577d0fc301fff1b04)
# | | +--bar
# | | | +--file
# |
-# +--expr <--kExprTreeId
+# +--expr <--kExprTreeId (4946bd21d0a5b3e0c82d6944f3d47adaf1bb66f7)
# | +--EXRESSIONS
# | +--readers
# | | +--EXPRESSIONS
# |
-# +--rule <--kRuleTreeId
+# +--rule <--kRuleTreeId (c6dd902c9d4e7afa8b20eb04e58503e63ecab84d)
# | +--RULES
# | +--composers
# | | +--EXPRESSIONS
# |
-# +--json <--kJsonTreeId
+# +--json <--kJsonTreeId (6982563dfc4dcdd1362792dbbc9d8243968d1ec9)
# | +--data_json
# | | +--bad.json
# | | +--foo.json
@@ -61,6 +62,7 @@ git config user.email "nobody@example.org"
mkdir -p src/foo/bar
touch src/file
touch src/foo/bar/file
+ln -s dummy src/foo/link
# create src commit
git add .
diff --git a/test/buildtool/build_engine/base_maps/directory_map.test.cpp b/test/buildtool/build_engine/base_maps/directory_map.test.cpp
index 1b9fe6cd..e05e5269 100644
--- a/test/buildtool/build_engine/base_maps/directory_map.test.cpp
+++ b/test/buildtool/build_engine/base_maps/directory_map.test.cpp
@@ -63,8 +63,8 @@ TEST_CASE("simple usage") {
bool as_expected{false};
auto name = ModuleName{"", "."};
auto consumer = [&as_expected](auto values) {
- if (values[0]->ContainsFile("file") &&
- not values[0]->ContainsFile("does_not_exist")) {
+ if (values[0]->ContainsBlob("file") &&
+ not values[0]->ContainsBlob("does_not_exist")) {
as_expected = true;
};
};
diff --git a/test/buildtool/build_engine/base_maps/test_repo.hpp b/test/buildtool/build_engine/base_maps/test_repo.hpp
index 00185432..d3a04d41 100644
--- a/test/buildtool/build_engine/base_maps/test_repo.hpp
+++ b/test/buildtool/build_engine/base_maps/test_repo.hpp
@@ -25,7 +25,9 @@ static auto const kBasePath =
std::filesystem::path{"test/buildtool/build_engine/base_maps"};
static auto const kBundlePath = kBasePath / "data/test_repo.bundle";
static auto const kSrcTreeId =
- std::string{"a35c324c6cf79354f6fd8a3c962f9ce7db801915"};
+ std::string{"6d57ba31821f69286e280334e4fd5f9dbd141721"};
+static auto const kSrcLinkId =
+ std::string{"2995a4d0e74917fd3e1383c577d0fc301fff1b04"};
static auto const kRuleTreeId =
std::string{"c6dd902c9d4e7afa8b20eb04e58503e63ecab84d"};
static auto const kExprTreeId =
diff --git a/test/buildtool/file_system/directory_entries.test.cpp b/test/buildtool/file_system/directory_entries.test.cpp
index 8109db61..278f79d6 100644
--- a/test/buildtool/file_system/directory_entries.test.cpp
+++ b/test/buildtool/file_system/directory_entries.test.cpp
@@ -84,10 +84,10 @@ TEST_CASE("Get entries of a directory", "[directory_entries]") {
auto fs_root = FileRoot();
auto dir_entries = fs_root.ReadDirectory(dir);
- CHECK(dir_entries.ContainsFile("test_repo.bundle"));
- CHECK(dir_entries.ContainsFile("test_repo_symlinks.bundle"));
- CHECK(dir_entries.ContainsFile("empty_executable"));
- CHECK(dir_entries.ContainsFile("example_file"));
+ CHECK(dir_entries.ContainsBlob("test_repo.bundle"));
+ CHECK(dir_entries.ContainsBlob("test_repo_symlinks.bundle"));
+ CHECK(dir_entries.ContainsBlob("empty_executable"));
+ CHECK(dir_entries.ContainsBlob("example_file"));
{
// all the entries returned by FilesIterator are files,
// are contained in reference_entries,
@@ -95,7 +95,7 @@ TEST_CASE("Get entries of a directory", "[directory_entries]") {
auto counter = 0;
for (const auto& x : dir_entries.FilesIterator()) {
REQUIRE(reference_entries.contains(x));
- CHECK(dir_entries.ContainsFile(x));
+ CHECK(dir_entries.ContainsBlob(x));
++counter;
}
@@ -110,7 +110,7 @@ TEST_CASE("Get entries of a directory", "[directory_entries]") {
auto counter = 0;
for (const auto& x : dir_entries.DirectoriesIterator()) {
REQUIRE(reference_entries.contains(x));
- CHECK_FALSE(dir_entries.ContainsFile(x));
+ CHECK_FALSE(dir_entries.ContainsBlob(x));
++counter;
}
@@ -124,9 +124,9 @@ TEST_CASE("Get entries of a git tree", "[directory_entries]") {
auto repo = *CreateTestRepo(true);
auto fs_root = FileRoot();
auto dir_entries = fs_root.ReadDirectory(repo);
- CHECK(dir_entries.ContainsFile("bar"));
- CHECK(dir_entries.ContainsFile("foo"));
- CHECK_FALSE(dir_entries.ContainsFile("baz"));
+ CHECK(dir_entries.ContainsBlob("bar"));
+ CHECK(dir_entries.ContainsBlob("foo"));
+ CHECK_FALSE(dir_entries.ContainsBlob("baz"));
{
// all the entries returned by FilesIterator are files,
// are contained in reference_entries,
@@ -134,7 +134,7 @@ TEST_CASE("Get entries of a git tree", "[directory_entries]") {
auto counter = 0;
for (const auto& x : dir_entries.FilesIterator()) {
REQUIRE(reference_entries.contains(x));
- CHECK(dir_entries.ContainsFile(x));
+ CHECK(dir_entries.ContainsBlob(x));
++counter;
}
@@ -148,7 +148,7 @@ TEST_CASE("Get entries of a git tree", "[directory_entries]") {
auto counter = 0;
for (const auto& x : dir_entries.DirectoriesIterator()) {
REQUIRE(reference_entries.contains(x));
- CHECK_FALSE(dir_entries.ContainsFile(x));
+ CHECK_FALSE(dir_entries.ContainsBlob(x));
++counter;
}
@@ -164,12 +164,12 @@ TEST_CASE("Get entries of an empty directory", "[directory_entries]") {
auto dir_entries =
FileRoot::DirectoryEntries{FileRoot::DirectoryEntries::pairs_t{}};
// of course, no files should be there
- CHECK_FALSE(dir_entries.ContainsFile("test_repo.bundle"));
+ CHECK_FALSE(dir_entries.ContainsBlob("test_repo.bundle"));
{
// FilesIterator should be an empty range
auto counter = 0;
for (const auto& x : dir_entries.FilesIterator()) {
- CHECK_FALSE(dir_entries.ContainsFile(x)); // should never be called
+ CHECK_FALSE(dir_entries.ContainsBlob(x)); // should never be called
++counter;
}
@@ -179,7 +179,7 @@ TEST_CASE("Get entries of an empty directory", "[directory_entries]") {
// DirectoriesIterator should be an empty range
auto counter = 0;
for (const auto& x : dir_entries.DirectoriesIterator()) {
- CHECK(dir_entries.ContainsFile(x)); // should never be called
+ CHECK(dir_entries.ContainsBlob(x)); // should never be called
++counter;
}
@@ -194,9 +194,9 @@ TEST_CASE("Get ignore-special entries of a git tree with symlinks",
auto repo = *CreateTestRepoSymlinks(true);
auto fs_root = FileRoot(/*ignore_special=*/true);
auto dir_entries = fs_root.ReadDirectory(repo);
- CHECK(dir_entries.ContainsFile("bar"));
- CHECK(dir_entries.ContainsFile("foo"));
- CHECK_FALSE(dir_entries.ContainsFile("baz"));
+ CHECK(dir_entries.ContainsBlob("bar"));
+ CHECK(dir_entries.ContainsBlob("foo"));
+ CHECK_FALSE(dir_entries.ContainsBlob("baz"));
{
// all the entries returned by FilesIterator are files,
// are contained in reference_entries,
@@ -204,7 +204,7 @@ TEST_CASE("Get ignore-special entries of a git tree with symlinks",
auto counter = 0;
for (const auto& x : dir_entries.FilesIterator()) {
REQUIRE(reference_entries.contains(x));
- CHECK(dir_entries.ContainsFile(x));
+ CHECK(dir_entries.ContainsBlob(x));
++counter;
}
@@ -218,7 +218,60 @@ TEST_CASE("Get ignore-special entries of a git tree with symlinks",
auto counter = 0;
for (const auto& x : dir_entries.DirectoriesIterator()) {
REQUIRE(reference_entries.contains(x));
- CHECK_FALSE(dir_entries.ContainsFile(x));
+ CHECK_FALSE(dir_entries.ContainsBlob(x));
+ ++counter;
+ }
+
+ CHECK(counter == 2);
+ }
+}
+
+TEST_CASE("Get entries of a git tree with symlinks", "[directory_entries]") {
+ auto reference_entries = std::unordered_set<std::string>{
+ "foo", "bar", "baz", "foo_l", "baz_l", ".git"};
+ auto repo = *CreateTestRepoSymlinks(true);
+ auto fs_root = FileRoot(/*ignore_special=*/false);
+ auto dir_entries = fs_root.ReadDirectory(repo);
+ CHECK(dir_entries.ContainsBlob("bar"));
+ CHECK(dir_entries.ContainsBlob("foo"));
+ CHECK_FALSE(dir_entries.ContainsBlob("baz"));
+ CHECK(dir_entries.ContainsBlob("foo_l"));
+ CHECK(dir_entries.ContainsBlob("baz_l"));
+ {
+ // all the entries returned by FilesIterator are files,
+ // are contained in reference_entries,
+ // and are 2 (foo, and bar)
+ auto counter = 0;
+ for (const auto& x : dir_entries.FilesIterator()) {
+ REQUIRE(reference_entries.contains(x));
+ CHECK(dir_entries.ContainsBlob(x));
+ ++counter;
+ }
+
+ CHECK(counter == 2);
+ }
+ {
+ // all the entries returned by SymlinksIterator are symlinks,
+ // are contained in reference_entries,
+ // and are 2 (foo_l, and baz_l)
+ auto counter = 0;
+ for (const auto& x : dir_entries.SymlinksIterator()) {
+ REQUIRE(reference_entries.contains(x));
+ CHECK(dir_entries.ContainsBlob(x));
+ ++counter;
+ }
+
+ CHECK(counter == 2);
+ }
+ {
+ // all the entries returned by DirectoriesIterator are not files (e.g.,
+ // trees),
+ // are contained in reference_entries,
+ // and are 2 (baz, and .git)
+ auto counter = 0;
+ for (const auto& x : dir_entries.DirectoriesIterator()) {
+ REQUIRE(reference_entries.contains(x));
+ CHECK_FALSE(dir_entries.ContainsBlob(x));
++counter;
}
diff --git a/test/buildtool/file_system/file_root.test.cpp b/test/buildtool/file_system/file_root.test.cpp
index e6b4a930..eab17ff6 100644
--- a/test/buildtool/file_system/file_root.test.cpp
+++ b/test/buildtool/file_system/file_root.test.cpp
@@ -23,15 +23,11 @@
namespace {
-auto const kBundlePath =
- std::string{"test/buildtool/file_system/data/test_repo.bundle"};
-auto const kTreeId = std::string{"c610db170fbcad5f2d66fe19972495923f3b2536"};
-auto const kFooId = std::string{"19102815663d23f8b75a47e7a01965dcdc96468c"};
-auto const kBarId = std::string{"ba0e162e1c47469e3fe4b393a8bf8c569f302116"};
-
auto const kBundleSymPath =
std::string{"test/buildtool/file_system/data/test_repo_symlinks.bundle"};
auto const kTreeSymId = std::string{"18770dacfe14c15d88450c21c16668e13ab0e7f9"};
+auto const kFooId = std::string{"19102815663d23f8b75a47e7a01965dcdc96468c"};
+auto const kBarId = std::string{"ba0e162e1c47469e3fe4b393a8bf8c569f302116"};
[[nodiscard]] auto GetTestDir() -> std::filesystem::path {
auto* tmp_dir = std::getenv("TEST_TMPDIR");
@@ -42,22 +38,6 @@ auto const kTreeSymId = std::string{"18770dacfe14c15d88450c21c16668e13ab0e7f9"};
"test/buildtool/file_system";
}
-[[nodiscard]] auto CreateTestRepo(bool do_checkout = false)
- -> std::optional<std::filesystem::path> {
- static std::atomic<int> counter{};
- auto repo_path =
- GetTestDir() / "test_repo" /
- std::filesystem::path{std::to_string(counter++)}.filename();
- auto cmd = fmt::format("git clone {}{} {}",
- do_checkout ? "--branch master " : "",
- QuoteForShell(kBundlePath),
- QuoteForShell(repo_path.string()));
- if (std::system(cmd.c_str()) == 0) {
- return repo_path;
- }
- return std::nullopt;
-}
-
[[nodiscard]] auto CreateTestRepoSymlinks(bool do_checkout = false)
-> std::optional<std::filesystem::path> {
static std::atomic<int> counter{};
@@ -74,16 +54,16 @@ auto const kTreeSymId = std::string{"18770dacfe14c15d88450c21c16668e13ab0e7f9"};
return std::nullopt;
}
-void TestFileRootReadFile(FileRoot const& root) {
+void TestFileRootReadCommonFiles(FileRoot const& root) {
REQUIRE(root.Exists("foo"));
REQUIRE(root.IsFile("foo"));
- auto foo = root.ReadFile("foo");
+ auto foo = root.ReadContent("foo");
REQUIRE(foo);
CHECK(*foo == "foo");
REQUIRE(root.Exists("bar"));
REQUIRE(root.IsFile("bar"));
- auto bar = root.ReadFile("bar");
+ auto bar = root.ReadContent("bar");
REQUIRE(bar);
CHECK(*bar == "bar");
@@ -93,15 +73,20 @@ void TestFileRootReadFile(FileRoot const& root) {
// Check subdir
REQUIRE(root.Exists("baz/foo"));
REQUIRE(root.IsFile("baz/foo"));
- auto bazfoo = root.ReadFile("baz/foo");
+ auto bazfoo = root.ReadContent("baz/foo");
REQUIRE(bazfoo);
CHECK(*bazfoo == "foo");
REQUIRE(root.Exists("baz/bar"));
REQUIRE(root.IsFile("baz/bar"));
- auto bazbar = root.ReadFile("baz/bar");
+ auto bazbar = root.ReadContent("baz/bar");
REQUIRE(bazbar);
CHECK(*bazbar == "bar");
+}
+
+void TestFileRootReadFilesOnly(FileRoot const& root) {
+ // Check common files
+ TestFileRootReadCommonFiles(root);
// Check symlinks are missing
CHECK_FALSE(root.Exists("baz_l"));
@@ -109,49 +94,65 @@ void TestFileRootReadFile(FileRoot const& root) {
CHECK_FALSE(root.Exists("baz/bar_l"));
}
+void TestFileRootReadFilesAndSymlinks(FileRoot const& root) {
+ // Check common files
+ TestFileRootReadCommonFiles(root);
+
+ // Check symlinks
+ CHECK(root.Exists("baz_l"));
+ CHECK(root.Exists("foo_l"));
+ CHECK(root.Exists("baz/bar_l"));
+}
+
void TestFileRootReadEntries(FileRoot const& root,
std::string const& path,
- bool has_baz) {
+ bool has_baz,
+ bool with_symlinks) {
REQUIRE(root.Exists(path));
REQUIRE(root.IsDirectory(path));
auto entries = root.ReadDirectory(path);
CHECK_FALSE(entries.Empty());
- CHECK(entries.ContainsFile("foo"));
- CHECK(entries.ContainsFile("bar"));
+ CHECK(entries.ContainsBlob("foo"));
+ CHECK(entries.ContainsBlob("bar"));
if (has_baz) {
- CHECK_FALSE(entries.ContainsFile("baz"));
+ CHECK_FALSE(entries.ContainsBlob("baz"));
+ CHECK(with_symlinks == entries.ContainsBlob("baz_l"));
+ CHECK(with_symlinks == entries.ContainsBlob("foo_l"));
+ }
+ else {
+ CHECK(with_symlinks == entries.ContainsBlob("bar_l"));
}
- CHECK_FALSE(entries.ContainsFile("does_not_exist"));
+ CHECK_FALSE(entries.ContainsBlob("does_not_exist"));
}
-void TestFileRootReadDirectory(FileRoot const& root) {
- TestFileRootReadEntries(root, ".", true);
- TestFileRootReadEntries(root, "baz", false);
+void TestFileRootReadDirectory(FileRoot const& root, bool with_symlinks) {
+ TestFileRootReadEntries(root, ".", true, with_symlinks);
+ TestFileRootReadEntries(root, "baz", false, with_symlinks);
}
-void TestFileRootReadFileType(FileRoot const& root) {
- auto foo_type = root.FileType("baz/foo");
+void TestFileRootReadBlobType(FileRoot const& root) {
+ auto foo_type = root.BlobType("baz/foo");
REQUIRE(foo_type);
CHECK(*foo_type == ObjectType::File);
- auto bar_type = root.FileType("baz/bar");
+ auto bar_type = root.BlobType("baz/bar");
REQUIRE(bar_type);
CHECK(*bar_type == ObjectType::Executable);
- CHECK_FALSE(root.FileType("baz"));
- CHECK_FALSE(root.FileType("does_not_exist"));
+ CHECK_FALSE(root.BlobType("baz"));
+ CHECK_FALSE(root.BlobType("does_not_exist"));
// Check subdir
REQUIRE(root.Exists("baz/foo"));
REQUIRE(root.IsFile("baz/foo"));
- auto bazfoo = root.ReadFile("baz/foo");
+ auto bazfoo = root.ReadContent("baz/foo");
REQUIRE(bazfoo);
CHECK(*bazfoo == "foo");
REQUIRE(root.Exists("baz/bar"));
REQUIRE(root.IsFile("baz/bar"));
- auto bazbar = root.ReadFile("baz/bar");
+ auto bazbar = root.ReadContent("baz/bar");
REQUIRE(bazbar);
CHECK(*bazbar == "bar");
}
@@ -160,7 +161,7 @@ void TestFileRootReadFileType(FileRoot const& root) {
TEST_CASE("Creating file root", "[file_root]") {
SECTION("local root") {
- auto root_path = CreateTestRepo(true);
+ auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
CHECK(FileRoot{*root_path}.Exists("."));
@@ -168,14 +169,14 @@ TEST_CASE("Creating file root", "[file_root]") {
}
SECTION("git root") {
- auto repo_path = CreateTestRepo(false);
+ auto repo_path = CreateTestRepoSymlinks(false);
REQUIRE(repo_path);
- auto root = FileRoot::FromGit(*repo_path, kTreeId);
+ auto root = FileRoot::FromGit(*repo_path, kTreeSymId);
REQUIRE(root);
CHECK(root->Exists("."));
- CHECK_FALSE(FileRoot::FromGit("does_not_exist", kTreeId));
+ CHECK_FALSE(FileRoot::FromGit("does_not_exist", kTreeSymId));
}
SECTION("local root ignore-special") {
@@ -203,26 +204,27 @@ TEST_CASE("Creating file root", "[file_root]") {
TEST_CASE("Reading files", "[file_root]") {
SECTION("local root") {
- auto root_path = CreateTestRepo(true);
+ auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
- TestFileRootReadFile(FileRoot{*root_path});
+ TestFileRootReadFilesAndSymlinks(FileRoot{*root_path});
}
SECTION("git root") {
- auto repo_path = CreateTestRepo(false);
+ auto repo_path = CreateTestRepoSymlinks(false);
REQUIRE(repo_path);
- auto root = FileRoot::FromGit(*repo_path, kTreeId);
+ auto root = FileRoot::FromGit(*repo_path, kTreeSymId);
REQUIRE(root);
- TestFileRootReadFile(*root);
+ TestFileRootReadFilesAndSymlinks(*root);
}
SECTION("local root ignore-special") {
auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
- TestFileRootReadFile(FileRoot{*root_path, /*ignore_special=*/true});
+ TestFileRootReadFilesOnly(
+ FileRoot{*root_path, /*ignore_special=*/true});
}
SECTION("git root ignore-special") {
@@ -232,33 +234,33 @@ TEST_CASE("Reading files", "[file_root]") {
FileRoot::FromGit(*repo_path, kTreeSymId, /*ignore_special=*/true);
REQUIRE(root);
- TestFileRootReadFile(*root);
+ TestFileRootReadFilesOnly(*root);
}
}
TEST_CASE("Reading directories", "[file_root]") {
SECTION("local root") {
- auto root_path = CreateTestRepo(true);
+ auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
- TestFileRootReadDirectory(FileRoot{*root_path});
+ TestFileRootReadDirectory(FileRoot{*root_path}, /*with_symlinks=*/true);
}
SECTION("git root") {
- auto repo_path = CreateTestRepo(false);
+ auto repo_path = CreateTestRepoSymlinks(false);
REQUIRE(repo_path);
- auto root = FileRoot::FromGit(*repo_path, kTreeId);
+ auto root = FileRoot::FromGit(*repo_path, kTreeSymId);
REQUIRE(root);
- TestFileRootReadDirectory(*root);
+ TestFileRootReadDirectory(*root, /*with_symlinks=*/true);
}
SECTION("local root ignore-special") {
auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
- TestFileRootReadDirectory(
- FileRoot{*root_path, /*ignore_special=*/true});
+ TestFileRootReadDirectory(FileRoot{*root_path, /*ignore_special=*/true},
+ /*with_symlinks=*/false);
}
SECTION("git root ignore-special") {
@@ -268,22 +270,22 @@ TEST_CASE("Reading directories", "[file_root]") {
FileRoot::FromGit(*repo_path, kTreeSymId, /*ignore_special=*/true);
REQUIRE(root);
- TestFileRootReadDirectory(*root);
+ TestFileRootReadDirectory(*root, /*with_symlinks=*/false);
}
}
TEST_CASE("Reading blobs", "[file_root]") {
SECTION("local root") {
- auto root_path = CreateTestRepo(true);
+ auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
CHECK_FALSE(FileRoot{*root_path}.ReadBlob(kFooId));
}
SECTION("git root") {
- auto repo_path = CreateTestRepo(false);
+ auto repo_path = CreateTestRepoSymlinks(false);
REQUIRE(repo_path);
- auto root = FileRoot::FromGit(*repo_path, kTreeId);
+ auto root = FileRoot::FromGit(*repo_path, kTreeSymId);
REQUIRE(root);
auto foo = root->ReadBlob(kFooId);
@@ -316,28 +318,28 @@ TEST_CASE("Reading blobs", "[file_root]") {
}
}
-TEST_CASE("Reading file type", "[file_root]") {
+TEST_CASE("Reading blob type", "[file_root]") {
SECTION("local root") {
- auto root_path = CreateTestRepo(true);
+ auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
- TestFileRootReadFileType(FileRoot{*root_path});
+ TestFileRootReadBlobType(FileRoot{*root_path});
}
SECTION("git root") {
- auto repo_path = CreateTestRepo(false);
+ auto repo_path = CreateTestRepoSymlinks(false);
REQUIRE(repo_path);
- auto root = FileRoot::FromGit(*repo_path, kTreeId);
+ auto root = FileRoot::FromGit(*repo_path, kTreeSymId);
REQUIRE(root);
- TestFileRootReadFileType(*root);
+ TestFileRootReadBlobType(*root);
}
SECTION("local root ignore-special") {
auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
- TestFileRootReadFileType(FileRoot{*root_path, /*ignore_special=*/true});
+ TestFileRootReadBlobType(FileRoot{*root_path, /*ignore_special=*/true});
}
SECTION("git root ignore-special") {
@@ -347,13 +349,13 @@ TEST_CASE("Reading file type", "[file_root]") {
FileRoot::FromGit(*repo_path, kTreeSymId, /*ignore_special=*/true);
REQUIRE(root);
- TestFileRootReadFileType(*root);
+ TestFileRootReadBlobType(*root);
}
}
TEST_CASE("Creating artifact descriptions", "[file_root]") {
SECTION("local root") {
- auto root_path = CreateTestRepo(true);
+ auto root_path = CreateTestRepoSymlinks(true);
REQUIRE(root_path);
auto root = FileRoot{*root_path};
@@ -366,9 +368,9 @@ TEST_CASE("Creating artifact descriptions", "[file_root]") {
}
SECTION("git root") {
- auto repo_path = CreateTestRepo(false);
+ auto repo_path = CreateTestRepoSymlinks(false);
REQUIRE(repo_path);
- auto root = FileRoot::FromGit(*repo_path, kTreeId);
+ auto root = FileRoot::FromGit(*repo_path, kTreeSymId);
REQUIRE(root);
auto foo = root->ToArtifactDescription("baz/foo", "repo");