summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-05-27 16:16:26 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-05-28 16:19:19 +0200
commitc0b46b2f4e47fc017beeae34ff555418d198e1d4 (patch)
tree6a4319a1b974fd6113fab80dd1047c1a8cb7be18 /test
parentfd8ad0f561dd253bf7399ce9a4594242e918ca25 (diff)
downloadjustbuild-c0b46b2f4e47fc017beeae34ff555418d198e1d4.tar.gz
Use shared_ptr for data in ContentBlob
...to reduce the "price" of copying.
Diffstat (limited to 'test')
-rw-r--r--test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp2
-rw-r--r--test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp2
-rw-r--r--test/buildtool/execution_api/bazel/bazel_network.test.cpp14
-rw-r--r--test/buildtool/execution_api/bazel/bytestream_client.test.cpp16
-rw-r--r--test/buildtool/execution_engine/executor/executor.test.cpp2
5 files changed, 18 insertions, 18 deletions
diff --git a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
index d9fec4dc..8daceb31 100644
--- a/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_cas_client.test.cpp
@@ -58,7 +58,7 @@ TEST_CASE("Bazel internals: CAS Client", "[execution_api]") {
instance_name, to_read.begin(), to_read.end());
REQUIRE(blobs.size() == 1);
CHECK(std::equal_to<bazel_re::Digest>{}(blobs[0].digest, digest));
- CHECK(blobs[0].data == content);
+ CHECK(*blobs[0].data == content);
}
SECTION("Invalid digest and blob") {
diff --git a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp
index 730420e9..0f9039d9 100644
--- a/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_msg_factory.test.cpp
@@ -45,7 +45,7 @@ TEST_CASE("Bazel internals: MessageFactory", "[execution_api]") {
CHECK(link_blob);
// both files are the same and should result in identical blobs
- CHECK(file1_blob->data == file2_blob->data);
+ CHECK(*file1_blob->data == *file2_blob->data);
CHECK(file1_blob->digest.hash() == file2_blob->digest.hash());
CHECK(file1_blob->digest.size_bytes() == file2_blob->digest.size_bytes());
diff --git a/test/buildtool/execution_api/bazel/bazel_network.test.cpp b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
index 9125fbc4..dff26a44 100644
--- a/test/buildtool/execution_api/bazel/bazel_network.test.cpp
+++ b/test/buildtool/execution_api/bazel/bazel_network.test.cpp
@@ -63,11 +63,11 @@ TEST_CASE("Bazel network: write/read blobs", "[execution_api]") {
// Check order maintained
REQUIRE(blobs.size() == 5);
- CHECK(blobs[0].data == content_foo);
- CHECK(blobs[1].data == content_bar);
- CHECK(blobs[2].data == content_baz);
- CHECK(blobs[3].data == content_bar);
- CHECK(blobs[4].data == content_foo);
+ CHECK(*blobs[0].data == content_foo);
+ CHECK(*blobs[1].data == content_bar);
+ CHECK(*blobs[2].data == content_baz);
+ CHECK(*blobs[3].data == content_bar);
+ CHECK(*blobs[4].data == content_foo);
}
TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
@@ -110,6 +110,6 @@ TEST_CASE("Bazel network: read blobs with unknown size", "[execution_api]") {
// Check order maintained
REQUIRE(blobs.size() == 2);
- CHECK(blobs[0].data == content_foo);
- CHECK(blobs[1].data == content_bar);
+ CHECK(*blobs[0].data == content_foo);
+ CHECK(*blobs[1].data == content_bar);
}
diff --git a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
index 285ec7d7..fea6edea 100644
--- a/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
+++ b/test/buildtool/execution_api/bazel/bytestream_client.test.cpp
@@ -130,7 +130,7 @@ TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") {
blob.digest.hash(),
blob.digest.size_bytes());
},
- [](auto const& blob) { return blob.data; }));
+ [](auto const& blob) { return *blob.data; }));
SECTION("Download small blobs") {
std::vector<std::string> contents{};
@@ -146,9 +146,9 @@ TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") {
contents.emplace_back(std::move(data));
});
REQUIRE(contents.size() == 3);
- CHECK(contents[0] == foo.data);
- CHECK(contents[1] == bar.data);
- CHECK(contents[2] == baz.data);
+ CHECK(contents[0] == *foo.data);
+ CHECK(contents[1] == *bar.data);
+ CHECK(contents[2] == *baz.data);
}
}
@@ -183,7 +183,7 @@ TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") {
blob.digest.hash(),
blob.digest.size_bytes());
},
- [](auto const& blob) { return blob.data; }));
+ [](auto const& blob) { return *blob.data; }));
SECTION("Download large blobs") {
std::vector<std::string> contents{};
@@ -199,9 +199,9 @@ TEST_CASE("ByteStream Client: Transfer multiple blobs", "[execution_api]") {
contents.emplace_back(std::move(data));
});
REQUIRE(contents.size() == 3);
- CHECK(contents[0] == foo.data);
- CHECK(contents[1] == bar.data);
- CHECK(contents[2] == baz.data);
+ CHECK(contents[0] == *foo.data);
+ CHECK(contents[1] == *bar.data);
+ CHECK(contents[2] == *baz.data);
}
}
}
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp
index 69e06df9..8eece895 100644
--- a/test/buildtool/execution_engine/executor/executor.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor.test.cpp
@@ -179,7 +179,7 @@ class TestApi : public IExecutionApi {
auto blob_range = blobs.Blobs();
return std::all_of(
blob_range.begin(), blob_range.end(), [this](auto const& blob) {
- return config_.artifacts[blob.data]
+ return config_.artifacts[*blob.data]
.uploads // for local artifacts
or config_.artifacts[blob.digest.hash()]
.uploads; // for known and action artifacts