summaryrefslogtreecommitdiff
path: root/test/buildtool
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-02-14 13:04:28 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-02-19 17:50:30 +0100
commit56df7b3916f669edd315808f92e63e7553367f1d (patch)
tree93a269402da87f33a9e95f82e540f6fef667aa6b /test/buildtool
parent888573c86e2eff6d1657f42955c388cda347680d (diff)
downloadjustbuild-56df7b3916f669edd315808f92e63e7553367f1d.tar.gz
Store HashFunction by value
Although references give an additional information about ownership, they introduce additional design difficulties.
Diffstat (limited to 'test/buildtool')
-rw-r--r--test/buildtool/execution_api/bazel/bazel_api.test.cpp2
-rw-r--r--test/buildtool/execution_api/bazel/bazel_network.test.cpp4
-rw-r--r--test/buildtool/execution_engine/executor/TARGETS1
-rw-r--r--test/buildtool/execution_engine/executor/executor.test.cpp18
-rw-r--r--test/buildtool/execution_engine/executor/executor_api.test.hpp16
-rw-r--r--test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp70
-rw-r--r--test/buildtool/file_system/TARGETS1
-rw-r--r--test/buildtool/file_system/object_cas.test.cpp5
-rw-r--r--test/buildtool/serve_api/source_tree_client.test.cpp2
9 files changed, 58 insertions, 61 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_api.test.cpp b/test/buildtool/execution_api/bazel/bazel_api.test.cpp
index 982dc756..230ee2dc 100644
--- a/test/buildtool/execution_api/bazel/bazel_api.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_api.test.cpp
@@ -49,7 +49,7 @@ class FactoryApi final {
&auth_,
&retry_config,
{},
- &hash_function_}};
+ hash_function_}};
}
private:
diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
index 0a7d78c9..6dc39363 100644
--- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
@@ -63,7 +63,7 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") {
&*auth_config,
&retry_config,
{},
- &hash_function};
+ hash_function};
std::string content_foo("foo");
std::string content_bar("bar");
@@ -127,7 +127,7 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
&*auth_config,
&retry_config,
{},
- &hash_function};
+ hash_function};
std::string content_foo("foo");
std::string content_bar(kLargeSize, 'x'); // single larger blob
diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS
index f9faa576..74d0329b 100644
--- a/test/buildtool/execution_engine/executor/TARGETS
+++ b/test/buildtool/execution_engine/executor/TARGETS
@@ -95,7 +95,6 @@
, "private-deps":
[ "executor_api_tests"
, ["@", "catch2", "", "catch2"]
- , ["@", "gsl", "", "gsl"]
, ["@", "src", "src/buildtool/auth", "auth"]
, ["@", "src", "src/buildtool/common", "common"]
, ["@", "src", "src/buildtool/common", "config"]
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp
index c317f80e..891c8198 100644
--- a/test/buildtool/execution_engine/executor/executor.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor.test.cpp
@@ -337,7 +337,7 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
@@ -355,7 +355,7 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
@@ -373,7 +373,7 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
@@ -420,7 +420,7 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
@@ -441,7 +441,7 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
@@ -462,7 +462,7 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
@@ -486,7 +486,7 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
@@ -507,7 +507,7 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
@@ -531,7 +531,7 @@ TEST_CASE("Executor: Process action", "[executor]") {
auto api = std::make_shared<TestApi>(config);
Statistics stats{};
Progress progress{};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = &repo_config,
.apis = &apis,
.remote_context = &remote_context,
diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp
index 4ba486c6..c5a2126a 100644
--- a/test/buildtool/execution_engine/executor/executor_api.test.hpp
+++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp
@@ -157,7 +157,7 @@ static inline void RunHelloWorldCompilation(
HashFunction const hash_function{TestHashType::ReadFromEnvironment()};
auto api = factory();
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = repo_config,
.apis = &apis,
@@ -290,7 +290,7 @@ static inline void RunGreeterCompilation(
HashFunction const hash_function{TestHashType::ReadFromEnvironment()};
auto api = factory();
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = repo_config,
.apis = &apis,
@@ -458,7 +458,7 @@ static inline void TestUploadAndDownloadTrees(
.retry_config = &retry_config,
.exec_config = &*remote_config};
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = repo_config,
.apis = &apis,
@@ -632,7 +632,7 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = repo_config,
.apis = &apis,
@@ -686,7 +686,7 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = repo_config,
.apis = &apis,
@@ -757,7 +757,7 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{.repo_config = repo_config,
.apis = &apis,
@@ -830,7 +830,7 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{
.repo_config = repo_config,
@@ -857,7 +857,7 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
- auto const apis = CreateTestApiBundle(&hash_function, api);
+ auto const apis = CreateTestApiBundle(hash_function, api);
ExecutionContext const exec_context{
.repo_config = repo_config,
diff --git a/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp b/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp
index a9fd6c10..a809d04f 100644
--- a/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp
@@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <memory>
#include <optional>
#include "catch2/catch_test_macros.hpp"
-#include "gsl/gsl"
#include "src/buildtool/auth/authentication.hpp"
#include "src/buildtool/common/remote/remote_common.hpp"
#include "src/buildtool/common/remote/retry_config.hpp"
@@ -47,13 +47,13 @@ TEST_CASE("Executor<BazelApi>: Upload blob", "[executor]") {
HashFunction const hash_function{TestHashType::ReadFromEnvironment()};
TestBlobUpload(&repo_config, [&] {
- return BazelApi::Ptr{new BazelApi{"remote-execution",
+ return std::make_shared<BazelApi>("remote-execution",
remote_config->remote_address->host,
remote_config->remote_address->port,
&*auth_config,
&retry_config,
config,
- &hash_function}};
+ hash_function);
});
}
@@ -80,14 +80,14 @@ TEST_CASE("Executor<BazelApi>: Compile hello world", "[executor]") {
&stats,
&progress,
[&] {
- return BazelApi::Ptr{
- new BazelApi{"remote-execution",
- remote_config->remote_address->host,
- remote_config->remote_address->port,
- &*auth_config,
- &retry_config,
- config,
- &hash_function}};
+ return std::make_shared<BazelApi>(
+ "remote-execution",
+ remote_config->remote_address->host,
+ remote_config->remote_address->port,
+ &*auth_config,
+ &retry_config,
+ config,
+ hash_function);
},
&*auth_config,
false /* not hermetic */);
@@ -116,14 +116,14 @@ TEST_CASE("Executor<BazelApi>: Compile greeter", "[executor]") {
&stats,
&progress,
[&] {
- return BazelApi::Ptr{
- new BazelApi{"remote-execution",
- remote_config->remote_address->host,
- remote_config->remote_address->port,
- &*auth_config,
- &retry_config,
- config,
- &hash_function}};
+ return std::make_shared<BazelApi>(
+ "remote-execution",
+ remote_config->remote_address->host,
+ remote_config->remote_address->port,
+ &*auth_config,
+ &retry_config,
+ config,
+ hash_function);
},
&*auth_config,
false /* not hermetic */);
@@ -152,14 +152,14 @@ TEST_CASE("Executor<BazelApi>: Upload and download trees", "[executor]") {
&stats,
&progress,
[&] {
- return BazelApi::Ptr{
- new BazelApi{"remote-execution",
- remote_config->remote_address->host,
- remote_config->remote_address->port,
- &*auth_config,
- &retry_config,
- config,
- &hash_function}};
+ return std::make_shared<BazelApi>(
+ "remote-execution",
+ remote_config->remote_address->host,
+ remote_config->remote_address->port,
+ &*auth_config,
+ &retry_config,
+ config,
+ hash_function);
},
&*auth_config,
false /* not hermetic */);
@@ -188,14 +188,14 @@ TEST_CASE("Executor<BazelApi>: Retrieve output directories", "[executor]") {
&stats,
&progress,
[&] {
- return BazelApi::Ptr{
- new BazelApi{"remote-execution",
- remote_config->remote_address->host,
- remote_config->remote_address->port,
- &*auth_config,
- &retry_config,
- config,
- &hash_function}};
+ return std::make_shared<BazelApi>(
+ "remote-execution",
+ remote_config->remote_address->host,
+ remote_config->remote_address->port,
+ &*auth_config,
+ &retry_config,
+ config,
+ hash_function);
},
&*auth_config,
false /* not hermetic */);
diff --git a/test/buildtool/file_system/TARGETS b/test/buildtool/file_system/TARGETS
index d8d2ddbf..d630f6bf 100644
--- a/test/buildtool/file_system/TARGETS
+++ b/test/buildtool/file_system/TARGETS
@@ -21,7 +21,6 @@
, "srcs": ["object_cas.test.cpp"]
, "private-deps":
[ ["@", "catch2", "", "catch2"]
- , ["@", "gsl", "", "gsl"]
, ["@", "src", "src/buildtool/common", "artifact_digest_factory"]
, ["@", "src", "src/buildtool/common", "common"]
, ["@", "src", "src/buildtool/crypto", "hash_function"]
diff --git a/test/buildtool/file_system/object_cas.test.cpp b/test/buildtool/file_system/object_cas.test.cpp
index 44cea6bb..fa11fb17 100644
--- a/test/buildtool/file_system/object_cas.test.cpp
+++ b/test/buildtool/file_system/object_cas.test.cpp
@@ -19,7 +19,6 @@
#include <string>
#include "catch2/catch_test_macros.hpp"
-#include "gsl/gsl"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/common/artifact_digest_factory.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
@@ -37,7 +36,7 @@ TEST_CASE("ObjectCAS", "[file_system]") {
storage_config.Get().hash_function, test_content);
SECTION("CAS for files") {
- ObjectCAS<ObjectType::File> cas{&storage_config.Get().hash_function,
+ ObjectCAS<ObjectType::File> cas{storage_config.Get().hash_function,
gen_config.cas_f};
CHECK(not cas.BlobPath(test_digest));
@@ -77,7 +76,7 @@ TEST_CASE("ObjectCAS", "[file_system]") {
SECTION("CAS for executables") {
ObjectCAS<ObjectType::Executable> cas{
- &storage_config.Get().hash_function, gen_config.cas_x};
+ storage_config.Get().hash_function, gen_config.cas_x};
CHECK(not cas.BlobPath(test_digest));
SECTION("Add blob from bytes and verify") {
diff --git a/test/buildtool/serve_api/source_tree_client.test.cpp b/test/buildtool/serve_api/source_tree_client.test.cpp
index f5428af8..f30518fd 100644
--- a/test/buildtool/serve_api/source_tree_client.test.cpp
+++ b/test/buildtool/serve_api/source_tree_client.test.cpp
@@ -60,7 +60,7 @@ TEST_CASE("Serve service client: tree-of-commit request", "[serve_api]") {
.exec_config = &exec_config};
SourceTreeClient st_client(
- *config->remote_address, &hash_function, &remote_context);
+ *config->remote_address, hash_function, &remote_context);
SECTION("Commit in bare checkout") {
auto root_id = st_client.ServeCommitTree(kRootCommit, ".", false);