diff options
Diffstat (limited to 'test')
3 files changed, 62 insertions, 12 deletions
diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS index cb33854a..c5a9b810 100644 --- a/test/buildtool/execution_engine/executor/TARGETS +++ b/test/buildtool/execution_engine/executor/TARGETS @@ -13,6 +13,7 @@ , ["@", "src", "src/buildtool/file_system", "file_system_manager"] , ["@", "src", "src/buildtool/progress_reporting", "progress"] , ["@", "src", "src/buildtool/crypto", "hash_function"] + , ["@", "src", "src/buildtool/compatibility", "compatibility"] , ["@", "catch2", "", "catch2"] , ["@", "gsl", "", "gsl"] , ["utils", "test_remote_config"] @@ -33,6 +34,8 @@ , ["@", "src", "src/buildtool/execution_engine/dag", "dag"] , ["@", "src", "src/buildtool/execution_engine/executor", "executor"] , ["@", "src", "src/buildtool/progress_reporting", "progress"] + , ["@", "src", "src/buildtool/crypto", "hash_function"] + , ["@", "src", "src/buildtool/compatibility", "compatibility"] , ["", "catch-main"] , ["@", "catch2", "", "catch2"] , ["@", "gsl", "", "gsl"] diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp index c1e8f06a..6a71f497 100644 --- a/test/buildtool/execution_engine/executor/executor.test.cpp +++ b/test/buildtool/execution_engine/executor/executor.test.cpp @@ -27,6 +27,8 @@ #include "src/buildtool/common/artifact_description.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/common/statistics.hpp" +#include "src/buildtool/compatibility/compatibility.hpp" +#include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/execution_engine/executor/executor.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" @@ -270,6 +272,10 @@ TEST_CASE("Executor: Process artifact", "[executor]") { DependencyGraph g; auto [config, repo_config] = CreateTest(&g, workspace_path); + HashFunction const hash_function{Compatibility::IsCompatible() + ? HashFunction::JustHash::Compatible + : HashFunction::JustHash::Native}; + auto const local_cpp_id = ArtifactDescription::CreateLocal("local.cpp", "").Id(); @@ -289,6 +295,7 @@ TEST_CASE("Executor: Process artifact", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, @@ -311,6 +318,7 @@ TEST_CASE("Executor: Process artifact", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, @@ -333,6 +341,7 @@ TEST_CASE("Executor: Process artifact", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, @@ -350,6 +359,10 @@ TEST_CASE("Executor: Process action", "[executor]") { DependencyGraph g; auto [config, repo_config] = CreateTest(&g, workspace_path); + HashFunction const hash_function{Compatibility::IsCompatible() + ? HashFunction::JustHash::Compatible + : HashFunction::JustHash::Native}; + auto const local_cpp_id = ArtifactDescription::CreateLocal("local.cpp", "").Id(); @@ -376,6 +389,7 @@ TEST_CASE("Executor: Process action", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, @@ -401,6 +415,7 @@ TEST_CASE("Executor: Process action", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, @@ -426,6 +441,7 @@ TEST_CASE("Executor: Process action", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, @@ -454,6 +470,7 @@ TEST_CASE("Executor: Process action", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, @@ -479,6 +496,7 @@ TEST_CASE("Executor: Process action", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, @@ -507,6 +525,7 @@ TEST_CASE("Executor: Process action", "[executor]") { api.get(), /*properties=*/{}, /*dispatch_list=*/{}, + hash_function, &auth, &retry_config, &stats, diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp index 7009b075..4990e805 100644 --- a/test/buildtool/execution_engine/executor/executor_api.test.hpp +++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp @@ -29,6 +29,7 @@ #include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/common/statistics.hpp" +#include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/crypto/hash_function.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" #include "src/buildtool/execution_api/remote/config.hpp" @@ -51,12 +52,15 @@ static inline void RunBlobUpload(RepositoryConfig* repo_config, ApiFactory const& factory) { SetupConfig(repo_config); auto api = factory(); + HashFunction const hash_function{Compatibility::IsCompatible() + ? HashFunction::JustHash::Compatible + : HashFunction::JustHash::Native}; + std::string const blob = "test"; CHECK(api->Upload(ArtifactBlobContainer{{ArtifactBlob{ - ArtifactDigest{ - HashFunction::Instance().ComputeBlobHash(blob).HexString(), - blob.size(), - /*is_tree=*/false}, + ArtifactDigest{hash_function.ComputeBlobHash(blob).HexString(), + blob.size(), + /*is_tree=*/false}, blob, /*is_exec=*/false}}})); } @@ -134,12 +138,17 @@ static inline void RunHelloWorldCompilation( RetryConfig retry_config{}; // default retry config + HashFunction const hash_function{Compatibility::IsCompatible() + ? HashFunction::JustHash::Compatible + : HashFunction::JustHash::Native}; + auto api = factory(); Executor runner{repo_config, api.get(), api.get(), remote_config->platform_properties, remote_config->dispatch, + hash_function, auth, &retry_config, stats, @@ -263,12 +272,17 @@ static inline void RunGreeterCompilation( RetryConfig retry_config{}; // default retry config + HashFunction const hash_function{Compatibility::IsCompatible() + ? HashFunction::JustHash::Compatible + : HashFunction::JustHash::Native}; + auto api = factory(); Executor runner{repo_config, api.get(), api.get(), remote_config->platform_properties, remote_config->dispatch, + hash_function, auth, &retry_config, stats, @@ -401,16 +415,20 @@ static inline void TestUploadAndDownloadTrees( env.emplace("PATH", "/bin:/usr/bin"); } + HashFunction const hash_function{Compatibility::IsCompatible() + ? HashFunction::JustHash::Compatible + : HashFunction::JustHash::Native}; + auto foo = std::string{"foo"}; auto bar = std::string{"bar"}; - auto foo_digest = ArtifactDigest{ - HashFunction::Instance().ComputeBlobHash(foo).HexString(), - foo.size(), - /*is_tree=*/false}; - auto bar_digest = ArtifactDigest{ - HashFunction::Instance().ComputeBlobHash(bar).HexString(), - bar.size(), - /*is_tree=*/false}; + auto foo_digest = + ArtifactDigest{hash_function.ComputeBlobHash(foo).HexString(), + foo.size(), + /*is_tree=*/false}; + auto bar_digest = + ArtifactDigest{hash_function.ComputeBlobHash(bar).HexString(), + bar.size(), + /*is_tree=*/false}; // upload blobs auto api = factory(); @@ -438,6 +456,7 @@ static inline void TestUploadAndDownloadTrees( api.get(), remote_config->platform_properties, remote_config->dispatch, + hash_function, auth, &retry_config, stats, @@ -555,6 +574,10 @@ static inline void TestRetrieveOutputDirectories( SetupConfig(repo_config); auto tmpdir = GetTestDir(); + HashFunction const hash_function{Compatibility::IsCompatible() + ? HashFunction::JustHash::Compatible + : HashFunction::JustHash::Native}; + auto const make_tree_id = std::string{"make_tree"}; auto const* make_tree_cmd = "mkdir -p baz/baz/\n" @@ -608,6 +631,7 @@ static inline void TestRetrieveOutputDirectories( api.get(), remote_config->platform_properties, remote_config->dispatch, + hash_function, auth, &retry_config, stats, @@ -663,6 +687,7 @@ static inline void TestRetrieveOutputDirectories( api.get(), remote_config->platform_properties, remote_config->dispatch, + hash_function, auth, &retry_config, stats, @@ -735,6 +760,7 @@ static inline void TestRetrieveOutputDirectories( api.get(), remote_config->platform_properties, remote_config->dispatch, + hash_function, auth, &retry_config, stats, @@ -809,6 +835,7 @@ static inline void TestRetrieveOutputDirectories( api.get(), remote_config->platform_properties, remote_config->dispatch, + hash_function, auth, &retry_config, stats, @@ -836,6 +863,7 @@ static inline void TestRetrieveOutputDirectories( api.get(), remote_config->platform_properties, remote_config->dispatch, + hash_function, auth, &retry_config, stats, |