summaryrefslogtreecommitdiff
path: root/test/buildtool/storage
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-08-29 11:32:23 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-08-30 17:17:09 +0200
commit60daf819bbe7db97064c7e102acedbf3cd693410 (patch)
tree43cd28daadadd1eede9db7882b76f02c12ad99d0 /test/buildtool/storage
parent9bc887e80bd1845f5ca4277518512149345d2422 (diff)
downloadjustbuild-60daf819bbe7db97064c7e102acedbf3cd693410.tar.gz
Remove blob_creator lib from tests
...and move this functionality to bazel_msg_factory_test, where it is actually used. For local_cas.test the regular hashing is used, since blob_creator is redundant there.
Diffstat (limited to 'test/buildtool/storage')
-rw-r--r--test/buildtool/storage/TARGETS1
-rw-r--r--test/buildtool/storage/local_cas.test.cpp41
2 files changed, 20 insertions, 22 deletions
diff --git a/test/buildtool/storage/TARGETS b/test/buildtool/storage/TARGETS
index 69d13137..c61cde66 100644
--- a/test/buildtool/storage/TARGETS
+++ b/test/buildtool/storage/TARGETS
@@ -21,7 +21,6 @@
, ["@", "src", "src/buildtool/file_system", "file_system_manager"]
, ["@", "src", "src/buildtool/file_system", "object_type"]
, ["@", "src", "src/buildtool/execution_api/bazel_msg", "bazel_msg"]
- , ["utils", "blob_creator"]
, ["@", "src", "src/buildtool/storage", "storage"]
, ["@", "src", "src/buildtool/storage", "config"]
]
diff --git a/test/buildtool/storage/local_cas.test.cpp b/test/buildtool/storage/local_cas.test.cpp
index b4ede8ca..4b7c844a 100644
--- a/test/buildtool/storage/local_cas.test.cpp
+++ b/test/buildtool/storage/local_cas.test.cpp
@@ -22,7 +22,6 @@
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
-#include "test/utils/blob_creator.hpp"
#include "test/utils/hermeticity/test_storage_config.hpp"
TEST_CASE("LocalCAS: Add blob to storage from bytes", "[storage]") {
@@ -83,27 +82,27 @@ TEST_CASE("LocalCAS: Add blob to storage from non-executable file",
std::filesystem::path non_exec_file{
"test/buildtool/storage/data/non_executable_file"};
- auto test_blob =
- CreateBlobFromPath(non_exec_file, storage_config.Get().hash_function);
+ auto test_blob = ArtifactDigest::CreateFromFile<ObjectType::File>(
+ storage_config.Get().hash_function, non_exec_file);
REQUIRE(test_blob);
// check blob not in storage
- CHECK(not cas.BlobPath(test_blob->digest, true));
- CHECK(not cas.BlobPath(test_blob->digest, false));
+ CHECK(not cas.BlobPath(*test_blob, true));
+ CHECK(not cas.BlobPath(*test_blob, false));
// ensure previous calls did not accidentially create the blob
- CHECK(not cas.BlobPath(test_blob->digest, true));
- CHECK(not cas.BlobPath(test_blob->digest, false));
+ CHECK(not cas.BlobPath(*test_blob, true));
+ CHECK(not cas.BlobPath(*test_blob, false));
SECTION("Add non-executable blob to storage") {
CHECK(cas.StoreBlob(non_exec_file, false));
- auto file_path = cas.BlobPath(test_blob->digest, false);
+ auto file_path = cas.BlobPath(*test_blob, false);
REQUIRE(file_path);
CHECK(FileSystemManager::IsFile(*file_path));
CHECK(not FileSystemManager::IsExecutable(*file_path));
- auto exe_path = cas.BlobPath(test_blob->digest, true);
+ auto exe_path = cas.BlobPath(*test_blob, true);
REQUIRE(exe_path);
CHECK(FileSystemManager::IsFile(*exe_path));
CHECK(FileSystemManager::IsExecutable(*exe_path));
@@ -113,12 +112,12 @@ TEST_CASE("LocalCAS: Add blob to storage from non-executable file",
SECTION("Add executable blob to storage") {
CHECK(cas.StoreBlob(non_exec_file, true));
- auto file_path = cas.BlobPath(test_blob->digest, false);
+ auto file_path = cas.BlobPath(*test_blob, false);
REQUIRE(file_path);
CHECK(FileSystemManager::IsFile(*file_path));
CHECK(not FileSystemManager::IsExecutable(*file_path));
- auto exe_path = cas.BlobPath(test_blob->digest, true);
+ auto exe_path = cas.BlobPath(*test_blob, true);
REQUIRE(exe_path);
CHECK(FileSystemManager::IsFile(*exe_path));
CHECK(FileSystemManager::IsExecutable(*exe_path));
@@ -134,27 +133,27 @@ TEST_CASE("LocalCAS: Add blob to storage from executable file", "[storage]") {
std::filesystem::path exec_file{
"test/buildtool/storage/data/executable_file"};
- auto test_blob =
- CreateBlobFromPath(exec_file, storage_config.Get().hash_function);
+ auto test_blob = ArtifactDigest::CreateFromFile<ObjectType::File>(
+ storage_config.Get().hash_function, exec_file);
REQUIRE(test_blob);
// check blob not in storage
- CHECK(not cas.BlobPath(test_blob->digest, true));
- CHECK(not cas.BlobPath(test_blob->digest, false));
+ CHECK(not cas.BlobPath(*test_blob, true));
+ CHECK(not cas.BlobPath(*test_blob, false));
// ensure previous calls did not accidentially create the blob
- CHECK(not cas.BlobPath(test_blob->digest, true));
- CHECK(not cas.BlobPath(test_blob->digest, false));
+ CHECK(not cas.BlobPath(*test_blob, true));
+ CHECK(not cas.BlobPath(*test_blob, false));
SECTION("Add non-executable blob to storage") {
CHECK(cas.StoreBlob(exec_file, false));
- auto file_path = cas.BlobPath(test_blob->digest, false);
+ auto file_path = cas.BlobPath(*test_blob, false);
REQUIRE(file_path);
CHECK(FileSystemManager::IsFile(*file_path));
CHECK(not FileSystemManager::IsExecutable(*file_path));
- auto exe_path = cas.BlobPath(test_blob->digest, true);
+ auto exe_path = cas.BlobPath(*test_blob, true);
REQUIRE(exe_path);
CHECK(FileSystemManager::IsFile(*exe_path));
CHECK(FileSystemManager::IsExecutable(*exe_path));
@@ -164,12 +163,12 @@ TEST_CASE("LocalCAS: Add blob to storage from executable file", "[storage]") {
SECTION("Add executable blob to storage") {
CHECK(cas.StoreBlob(exec_file, true));
- auto file_path = cas.BlobPath(test_blob->digest, false);
+ auto file_path = cas.BlobPath(*test_blob, false);
REQUIRE(file_path);
CHECK(FileSystemManager::IsFile(*file_path));
CHECK(not FileSystemManager::IsExecutable(*file_path));
- auto exe_path = cas.BlobPath(test_blob->digest, true);
+ auto exe_path = cas.BlobPath(*test_blob, true);
REQUIRE(exe_path);
CHECK(FileSystemManager::IsFile(*exe_path));
CHECK(FileSystemManager::IsExecutable(*exe_path));