summaryrefslogtreecommitdiff
path: root/test/buildtool/execution_api/common/api_test.hpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-07-16 12:26:13 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-07-22 17:02:34 +0200
commit8f3a09e42d25f533e9d9a007125a7661cef3b653 (patch)
treecd384b19f0a1c95c0d01b3b43d6d93968518cbbc /test/buildtool/execution_api/common/api_test.hpp
parent7caf8d3fc009c34b6a1484eac4cbd1b697a2e3c4 (diff)
downloadjustbuild-8f3a09e42d25f533e9d9a007125a7661cef3b653.tar.gz
Remove singleton calls to HashFunction in tests
Diffstat (limited to 'test/buildtool/execution_api/common/api_test.hpp')
-rw-r--r--test/buildtool/execution_api/common/api_test.hpp28
1 files changed, 22 insertions, 6 deletions
diff --git a/test/buildtool/execution_api/common/api_test.hpp b/test/buildtool/execution_api/common/api_test.hpp
index e00a3b32..81a11364 100644
--- a/test/buildtool/execution_api/common/api_test.hpp
+++ b/test/buildtool/execution_api/common/api_test.hpp
@@ -21,6 +21,7 @@
#include "catch2/catch_test_macros.hpp"
#include "src/buildtool/common/artifact_description.hpp"
+#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/common/execution_action.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
@@ -129,8 +130,13 @@ using ExecProps = std::map<std::string, std::string>;
ExecProps const& props,
bool is_hermetic = false) {
std::string test_content("test");
- auto test_digest = ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), test_content);
+
+ HashFunction const hash_function{Compatibility::IsCompatible()
+ ? HashFunction::JustHash::Compatible
+ : HashFunction::JustHash::Native};
+
+ auto test_digest =
+ ArtifactDigest::Create<ObjectType::File>(hash_function, test_content);
std::string output_path{"output_file"};
@@ -207,8 +213,13 @@ using ExecProps = std::map<std::string, std::string>;
ExecProps const& props,
bool is_hermetic = false) {
std::string test_content("test");
- auto test_digest = ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), test_content);
+
+ HashFunction const hash_function{Compatibility::IsCompatible()
+ ? HashFunction::JustHash::Compatible
+ : HashFunction::JustHash::Native};
+
+ auto test_digest =
+ ArtifactDigest::Create<ObjectType::File>(hash_function, test_content);
auto input_artifact_opt =
ArtifactDescription::CreateKnown(test_digest, ObjectType::File)
@@ -292,8 +303,13 @@ using ExecProps = std::map<std::string, std::string>;
ApiFactory const& api_factory,
ExecProps const& props) {
std::string test_content("test");
- auto test_digest = ArtifactDigest::Create<ObjectType::File>(
- HashFunction::Instance(), test_content);
+
+ HashFunction const hash_function{Compatibility::IsCompatible()
+ ? HashFunction::JustHash::Compatible
+ : HashFunction::JustHash::Native};
+
+ auto test_digest =
+ ArtifactDigest::Create<ObjectType::File>(hash_function, test_content);
std::string output_path{"output_file"};