summaryrefslogtreecommitdiff
path: root/test/end-to-end/just-mr/create_test_archives.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/end-to-end/just-mr/create_test_archives.cpp')
-rw-r--r--test/end-to-end/just-mr/create_test_archives.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/test/end-to-end/just-mr/create_test_archives.cpp b/test/end-to-end/just-mr/create_test_archives.cpp
index 2f4327b7..3fa6759a 100644
--- a/test/end-to-end/just-mr/create_test_archives.cpp
+++ b/test/end-to-end/just-mr/create_test_archives.cpp
@@ -35,16 +35,27 @@ Structure of content tree:
+--root
+--bar
+--foo
+ +--foo_l
+ +--baz_l
+--baz
+--bar
+--foo
+ +--foo_l
+
+foo_l is symlink "baz/foo_l" [non-upwards, pointing to file]
+baz_l is symlink "baz" [non-upwards, pointing to tree]
+baz/foo_l is symlink "../foo_l" [upwards & confined, pointing to symlink]
*/
-auto const kExpected = filetree_t{{"root", {"", ObjectType::Tree}},
- {"root/foo", {"foo", ObjectType::File}},
- {"root/bar", {"bar", ObjectType::File}},
- {"root/baz", {"", ObjectType::Tree}},
- {"root/baz/foo", {"foo", ObjectType::File}},
- {"root/baz/bar", {"bar", ObjectType::File}}};
+auto const kExpected =
+ filetree_t{{"root", {"", ObjectType::Tree}},
+ {"root/foo", {"foo", ObjectType::File}},
+ {"root/bar", {"bar", ObjectType::File}},
+ {"root/baz", {"", ObjectType::Tree}},
+ {"root/baz_l", {"baz", ObjectType::Symlink}},
+ {"root/foo_l", {"foo", ObjectType::Symlink}},
+ {"root/baz/foo", {"foo", ObjectType::File}},
+ {"root/baz/bar", {"bar", ObjectType::File}},
+ {"root/baz/foo_l", {"../foo_l", ObjectType::Symlink}}};
void create_files(std::filesystem::path const& destDir = ".") {
for (auto const& [path, file] : kExpected) {
@@ -66,6 +77,15 @@ void create_files(std::filesystem::path const& destDir = ".") {
std::exit(1);
};
} break;
+ case ObjectType::Symlink: {
+ if (not FileSystemManager::CreateSymlink(content,
+ destDir / path)) {
+ Logger::Log(LogLevel::Error,
+ "Could not create test symlink at path {}",
+ (destDir / path).string());
+ std::exit(1);
+ };
+ } break;
default: {
Logger::Log(LogLevel::Error,
"File system failure in creating test archive");