diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-08 15:56:38 +0200 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-07-22 17:01:13 +0200 |
commit | 57388e7624c71762e6aac30f16809c467f96ca58 (patch) | |
tree | 9a865c096ee11e450939404cfa53cb70098910b1 /test/buildtool/storage | |
parent | f58946aeabb30363f41e3eb189f6bbfcea4009dd (diff) | |
download | justbuild-57388e7624c71762e6aac30f16809c467f96ca58.tar.gz |
Store HashFunction in StorageConfig
Diffstat (limited to 'test/buildtool/storage')
-rw-r--r-- | test/buildtool/storage/TARGETS | 2 | ||||
-rw-r--r-- | test/buildtool/storage/local_ac.test.cpp | 13 | ||||
-rw-r--r-- | test/buildtool/storage/local_cas.test.cpp | 8 |
3 files changed, 10 insertions, 13 deletions
diff --git a/test/buildtool/storage/TARGETS b/test/buildtool/storage/TARGETS index a2b0b0d2..4a2881c3 100644 --- a/test/buildtool/storage/TARGETS +++ b/test/buildtool/storage/TARGETS @@ -24,7 +24,6 @@ , ["utils", "blob_creator"] , ["@", "src", "src/buildtool/storage", "storage"] , ["@", "src", "src/buildtool/storage", "config"] - , ["@", "src", "src/buildtool/crypto", "hash_function"] ] , "stage": ["test", "buildtool", "storage"] } @@ -42,7 +41,6 @@ , ["@", "src", "src/buildtool/storage", "storage"] , ["@", "src", "src/buildtool/storage", "config"] , ["utils", "test_storage_config"] - , ["@", "src", "src/buildtool/crypto", "hash_function"] ] , "stage": ["test", "buildtool", "storage"] } diff --git a/test/buildtool/storage/local_ac.test.cpp b/test/buildtool/storage/local_ac.test.cpp index b3a4fcd1..c692a75c 100644 --- a/test/buildtool/storage/local_ac.test.cpp +++ b/test/buildtool/storage/local_ac.test.cpp @@ -18,7 +18,6 @@ #include "gsl/gsl" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/bazel_types.hpp" -#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "src/buildtool/storage/config.hpp" @@ -38,7 +37,7 @@ TEST_CASE("LocalAC: Single action, single result", "[storage]") { auto const& cas = storage.CAS(); auto action_id = ArtifactDigest::Create<ObjectType::File>( - HashFunction::Instance(), "action"); + storage_config.Get().hash_function, "action"); CHECK(not ac.CachedResult(action_id)); CHECK(RunDummyExecution(&ac, &cas, action_id, "result")); auto ac_result = ac.CachedResult(action_id); @@ -53,9 +52,9 @@ TEST_CASE("LocalAC: Two different actions, two different results", auto const& cas = storage.CAS(); auto action_id1 = ArtifactDigest::Create<ObjectType::File>( - HashFunction::Instance(), "action1"); + storage_config.Get().hash_function, "action1"); auto action_id2 = ArtifactDigest::Create<ObjectType::File>( - HashFunction::Instance(), "action2"); + storage_config.Get().hash_function, "action2"); CHECK(not ac.CachedResult(action_id1)); CHECK(not ac.CachedResult(action_id2)); @@ -84,9 +83,9 @@ TEST_CASE("LocalAC: Two different actions, same two results", "[storage]") { auto const& cas = storage.CAS(); auto action_id1 = ArtifactDigest::Create<ObjectType::File>( - HashFunction::Instance(), "action1"); + storage_config.Get().hash_function, "action1"); auto action_id2 = ArtifactDigest::Create<ObjectType::File>( - HashFunction::Instance(), "action2"); + storage_config.Get().hash_function, "action2"); CHECK(not ac.CachedResult(action_id1)); CHECK(not ac.CachedResult(action_id2)); @@ -115,7 +114,7 @@ TEST_CASE("LocalAC: Same two actions, two different results", "[storage]") { auto const& cas = storage.CAS(); auto action_id = ArtifactDigest::Create<ObjectType::File>( - HashFunction::Instance(), "same action"); + storage_config.Get().hash_function, "same action"); CHECK(not ac.CachedResult(action_id)); std::string result_content1{}; diff --git a/test/buildtool/storage/local_cas.test.cpp b/test/buildtool/storage/local_cas.test.cpp index c1d65b8e..b4ede8ca 100644 --- a/test/buildtool/storage/local_cas.test.cpp +++ b/test/buildtool/storage/local_cas.test.cpp @@ -17,7 +17,6 @@ #include "catch2/catch_test_macros.hpp" #include "src/buildtool/common/artifact_digest.hpp" -#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/object_type.hpp" @@ -34,7 +33,7 @@ TEST_CASE("LocalCAS: Add blob to storage from bytes", "[storage]") { std::string test_bytes("test"); auto test_digest = ArtifactDigest::Create<ObjectType::File>( - HashFunction::Instance(), test_bytes); + storage_config.Get().hash_function, test_bytes); // check blob not in storage CHECK(not cas.BlobPath(test_digest, true)); @@ -85,7 +84,7 @@ TEST_CASE("LocalCAS: Add blob to storage from non-executable file", "test/buildtool/storage/data/non_executable_file"}; auto test_blob = - CreateBlobFromPath(non_exec_file, HashFunction::Instance()); + CreateBlobFromPath(non_exec_file, storage_config.Get().hash_function); REQUIRE(test_blob); // check blob not in storage @@ -135,7 +134,8 @@ 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, HashFunction::Instance()); + auto test_blob = + CreateBlobFromPath(exec_file, storage_config.Get().hash_function); REQUIRE(test_blob); // check blob not in storage |