diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-03-24 21:22:01 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-04-02 15:30:03 +0200 |
commit | ba65c0978e2a6e72b73c0675b0c0f413872c3674 (patch) | |
tree | 8e1c1edeb92f88aeb6dac54852aa4ae26c5e2a81 /test/buildtool/storage | |
parent | fb04df06a3586f211532453903f7414907b2a7b0 (diff) | |
download | justbuild-ba65c0978e2a6e72b73c0675b0c0f413872c3674.tar.gz |
LargeBlobs: Splice large objects implicitly.
Implicitly reconstruct objects during regular uplinking of Blobs/Trees.
Diffstat (limited to 'test/buildtool/storage')
-rw-r--r-- | test/buildtool/storage/large_object_cas.test.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/buildtool/storage/large_object_cas.test.cpp b/test/buildtool/storage/large_object_cas.test.cpp index 61aa25da..0a070349 100644 --- a/test/buildtool/storage/large_object_cas.test.cpp +++ b/test/buildtool/storage/large_object_cas.test.cpp @@ -122,6 +122,7 @@ TEST_CASE_METHOD(HermeticLocalTestFixture, // Test splitting of a large object. The split must be successful and the entry // must be placed to the LargeCAS. The second split of the same object must load // the result from the LargeCAS, no actual split must occur. +// The object can be implicitly reconstructed from the LargeCAS. template <ObjectType kType> static void TestLarge() noexcept { SECTION("Large") { @@ -160,12 +161,23 @@ static void TestLarge() noexcept { // There must be no spliced file: CHECK_FALSE(FileSystemManager::IsFile(path)); } + + SECTION("Splice") { + // Check implicit splice: + auto spliced_path = + kIsTree ? cas.TreePath(digest) : cas.BlobPath(digest, kIsExec); + REQUIRE(spliced_path); + + // The result must be in the same location: + CHECK(*spliced_path == path); + } } } // Test splitting of a small object. The split must be successful, but the entry // must not be placed to the LargeCAS. The result of spliting must contain one // blob. +// The object cannot be implicitly reconstructed. template <ObjectType kType> static void TestSmall() noexcept { SECTION("Small") { @@ -209,12 +221,21 @@ static void TestSmall() noexcept { auto* error_2 = std::get_if<LargeObjectError>(&pack_2); CHECK(error_2); CHECK(error_2->Code() == LargeObjectErrorCode::FileNotFound); + + // There must be no spliced file: + CHECK_FALSE(FileSystemManager::IsFile(path)); + + // Check implicit splice fails: + auto spliced_path = + kIsTree ? cas.TreePath(digest) : cas.BlobPath(digest, kIsExec); + CHECK_FALSE(spliced_path); } } // Test splitting of an empty object. The split must be successful, but the // entry must not be placed to the LargeCAS. The result of splitting must be // empty. +// The object cannot be implicitly reconstructed. template <ObjectType kType> static void TestEmpty() noexcept { SECTION("Empty") { @@ -257,6 +278,14 @@ static void TestEmpty() noexcept { auto* error_2 = std::get_if<LargeObjectError>(&pack_2); CHECK(error_2); CHECK(error_2->Code() == LargeObjectErrorCode::FileNotFound); + + // There must be no spliced file: + CHECK_FALSE(FileSystemManager::IsFile(path)); + + // Check implicit splice fails: + auto spliced_path = + kIsTree ? cas.TreePath(digest) : cas.BlobPath(digest, kIsExec); + CHECK_FALSE(spliced_path); } } |