diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-13 13:14:27 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2025-06-16 17:27:29 +0200 |
commit | 223f67c2cbf4648c3aaa907ec0edf98e53b574e9 (patch) | |
tree | 7dd1e9aa2dd8a2470984a65d841e222b2226fa59 | |
parent | febe0937cf4394bc0f908e13fd0b6ab63b2c29c2 (diff) | |
download | justbuild-223f67c2cbf4648c3aaa907ec0edf98e53b574e9.tar.gz |
Avoid unnecessary work in accessing container entries
- in sequence containers, use operator[] instead of .at() when
accessing indices guaranteed to be in bound;
- in associative containers, prefer .find() and reusing the
returned const iterator to using .contains() and .at(); while
there, make any so obtained iterators const if they are read-only.
-rw-r--r-- | src/buildtool/build_engine/expression/evaluator.cpp | 15 | ||||
-rw-r--r-- | src/buildtool/common/cli.hpp | 6 | ||||
-rw-r--r-- | src/buildtool/execution_api/common/bytestream_utils.cpp | 26 | ||||
-rw-r--r-- | src/buildtool/execution_api/local/local_action.cpp | 2 | ||||
-rw-r--r-- | src/buildtool/execution_engine/executor/executor.hpp | 8 | ||||
-rw-r--r-- | src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp | 11 | ||||
-rw-r--r-- | src/buildtool/main/build_utils.cpp | 6 | ||||
-rw-r--r-- | src/other_tools/just_mr/fetch.cpp | 5 | ||||
-rw-r--r-- | src/other_tools/just_mr/launch.cpp | 20 | ||||
-rw-r--r-- | src/other_tools/just_mr/mirrors.hpp | 2 | ||||
-rw-r--r-- | src/other_tools/just_mr/update.cpp | 6 | ||||
-rw-r--r-- | src/other_tools/repo_map/repos_to_setup_map.cpp | 10 | ||||
-rw-r--r-- | test/buildtool/build_engine/base_maps/rule_map.test.cpp | 6 | ||||
-rw-r--r-- | test/buildtool/graph_traverser/graph_traverser.test.hpp | 37 |
14 files changed, 83 insertions, 77 deletions
diff --git a/src/buildtool/build_engine/expression/evaluator.cpp b/src/buildtool/build_engine/expression/evaluator.cpp index 3283c2b1..0aa553e8 100644 --- a/src/buildtool/build_engine/expression/evaluator.cpp +++ b/src/buildtool/build_engine/expression/evaluator.cpp @@ -840,14 +840,11 @@ auto LookupExpr(SubExprEvaluator&& eval, throw Evaluator::EvaluationError{fmt::format( "Map expected to be mapping but found {}.", d->ToString())}; } - auto lookup = Expression::kNone; - if (d->Map().contains(k->String())) { - lookup = d->Map().at(k->String()); + auto const& lookup = d->Map().Find(k->String()); + if (lookup and (*lookup)->IsNotNull()) { + return **lookup; } - if (lookup->IsNone()) { - lookup = eval(expr->Get("default", Expression::none_t()), env); - } - return lookup; + return eval(expr->Get("default", Expression::none_t()), env); } auto ArrayAccessExpr(SubExprEvaluator&& eval, @@ -936,7 +933,7 @@ auto ToSubdirExpr(SubExprEvaluator&& eval, else { for (auto const& el : d->Map()) { auto new_key = ToNormalPath(subdir / el.first).string(); - if (auto it = result.find(new_key); + if (auto const it = result.find(new_key); it != result.end() and (not((it->second == el.second) and el.second->IsCacheable()))) { auto msg_expr = expr->Map().Find("msg"); @@ -979,7 +976,7 @@ auto FromSubdirExpr(SubExprEvaluator&& eval, std::filesystem::path(el.first).lexically_relative(subdir)); if (PathIsNonUpwards(new_path)) { auto new_key = new_path.string(); - if (auto it = result.find(new_key); + if (auto const it = result.find(new_key); it != result.end() && (!((it->second == el.second) && el.second->IsCacheable()))) { throw Evaluator::EvaluationError{ diff --git a/src/buildtool/common/cli.hpp b/src/buildtool/common/cli.hpp index ff4db0bb..096044e0 100644 --- a/src/buildtool/common/cli.hpp +++ b/src/buildtool/common/cli.hpp @@ -26,6 +26,7 @@ #include <string> #include <thread> #include <type_traits> +#include <unordered_map> #include <vector> #include "CLI/CLI.hpp" @@ -705,8 +706,9 @@ static inline auto SetupToAddArguments( app->add_option_function<std::string>( "--resolve-special", [clargs](auto const& raw_value) { - if (kResolveSpecialMap.contains(raw_value)) { - clargs->resolve_special = kResolveSpecialMap.at(raw_value); + if (auto const it = kResolveSpecialMap.find(raw_value); + it != kResolveSpecialMap.end()) { + clargs->resolve_special = it->second; } else { Logger::Log(LogLevel::Warning, diff --git a/src/buildtool/execution_api/common/bytestream_utils.cpp b/src/buildtool/execution_api/common/bytestream_utils.cpp index 93acede8..fa91cd98 100644 --- a/src/buildtool/execution_api/common/bytestream_utils.cpp +++ b/src/buildtool/execution_api/common/bytestream_utils.cpp @@ -34,15 +34,15 @@ namespace { std::size_t shift = 0; for (std::size_t length = 0; shift + length < request.size(); ++length) { - if (request.at(shift + length) == '/') { - parts.emplace_back(&request.at(shift), length); + if (request[shift + length] == '/') { + parts.emplace_back(&request[shift], length); shift += length + 1; length = 0; } } if (shift < request.size()) { - parts.emplace_back(&request.at(shift), request.size() - shift); + parts.emplace_back(&request[shift], request.size() - shift); } } catch (...) { return {}; @@ -80,15 +80,15 @@ auto ByteStreamUtils::ReadRequest::FromString( auto const parts = ::SplitRequest(request); if (parts.size() != kReadRequestPartsCount or - parts.at(kBlobsIndex).compare(ByteStreamUtils::kBlobs) != 0) { + parts[kBlobsIndex].compare(ByteStreamUtils::kBlobs) != 0) { return std::nullopt; } ReadRequest result; - result.instance_name_ = std::string(parts.at(kInstanceNameIndex)); - result.hash_ = std::string(parts.at(kHashIndex)); + result.instance_name_ = std::string(parts[kInstanceNameIndex]); + result.hash_ = std::string(parts[kHashIndex]); try { - result.size_ = std::stoi(std::string(parts.at(kSizeIndex))); + result.size_ = std::stoi(std::string(parts[kSizeIndex])); } catch (...) { return std::nullopt; } @@ -126,17 +126,17 @@ auto ByteStreamUtils::WriteRequest::FromString( auto const parts = ::SplitRequest(request); if (parts.size() != kWriteRequestPartsCount or - parts.at(kUploadsIndex).compare(ByteStreamUtils::kUploads) != 0 or - parts.at(kBlobsIndex).compare(ByteStreamUtils::kBlobs) != 0) { + parts[kUploadsIndex].compare(ByteStreamUtils::kUploads) != 0 or + parts[kBlobsIndex].compare(ByteStreamUtils::kBlobs) != 0) { return std::nullopt; } WriteRequest result; - result.instance_name_ = std::string(parts.at(kInstanceNameIndex)); - result.uuid_ = std::string(parts.at(kUUIDIndex)); - result.hash_ = std::string(parts.at(kHashIndex)); + result.instance_name_ = std::string(parts[kInstanceNameIndex]); + result.uuid_ = std::string(parts[kUUIDIndex]); + result.hash_ = std::string(parts[kHashIndex]); try { - result.size_ = std::stoul(std::string(parts.at(kSizeIndex))); + result.size_ = std::stoul(std::string(parts[kSizeIndex])); } catch (...) { return std::nullopt; } diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp index d202233f..174caf08 100644 --- a/src/buildtool/execution_api/local/local_action.cpp +++ b/src/buildtool/execution_api/local/local_action.cpp @@ -337,7 +337,7 @@ auto LocalAction::StageInputs( return false; } for (std::size_t i{}; i < result->paths.size(); ++i) { - if (not StageInput(result->paths.at(i), result->infos.at(i), copies)) { + if (not StageInput(result->paths[i], result->infos[i], copies)) { return false; } } diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index f009783d..5f5c2e92 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -632,8 +632,8 @@ class ExecutorImpl { std::vector<DependencyGraph::NamedArtifactNodePtr> const& artifacts) -> std::optional<ArtifactDigest> { if (artifacts.size() == 1 and - (artifacts.at(0).path == "." or artifacts.at(0).path.empty())) { - auto const& info = artifacts.at(0).node->Content().Info(); + (artifacts[0].path == "." or artifacts[0].path.empty())) { + auto const& info = artifacts[0].node->Content().Info(); if (info and IsTreeObject(info->type)) { // Artifact list contains single tree with path "." or "". Reuse // the existing tree artifact by returning its digest. @@ -831,7 +831,7 @@ class ExecutorImpl { msg << nlohmann::json(action->Env()).dump(); } auto const& origin_map = progress->OriginMap(); - auto origins = origin_map.find(action->Content().Id()); + auto const origins = origin_map.find(action->Content().Id()); if (origins != origin_map.end() and not origins->second.empty()) { msg << "\nrequested by"; for (auto const& origin : origins->second) { @@ -887,7 +887,7 @@ class ExecutorImpl { remote_context->exec_config->dispatch) { bool match = true; for (auto const& [k, v] : pred) { - auto v_it = properties.find(k); + auto const v_it = properties.find(k); if (not(v_it != properties.end() and v_it->second == v)) { match = false; } diff --git a/src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp b/src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp index ecf08e8e..fb7d3bf0 100644 --- a/src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp +++ b/src/buildtool/execution_engine/tree_operations/tree_operations_utils.cpp @@ -221,9 +221,16 @@ auto TreeOperationsUtils::SerializeGitTree( } auto it = git_entries.find(*git_hash); if (it == git_entries.end()) { - git_entries.insert({*git_hash, std::vector<GitRepo::TreeEntry>{}}); + if (auto res = git_entries.insert( + {*git_hash, std::vector<GitRepo::TreeEntry>{}}); + res.second) { + it = std::move(res).first; + } + else { + return std::nullopt; + } } - git_entries.at(*git_hash).emplace_back(name, entry.info.type); + it->second.emplace_back(name, entry.info.type); } // Serialize git entries. diff --git a/src/buildtool/main/build_utils.cpp b/src/buildtool/main/build_utils.cpp index 684d2dd1..17b26d80 100644 --- a/src/buildtool/main/build_utils.cpp +++ b/src/buildtool/main/build_utils.cpp @@ -92,7 +92,8 @@ auto CreateTargetCacheWriterMap( // get the TaretCacheKey corresponding to this Id TargetCacheKey tc_key{key}; // check if entry actually needs storing - if (not cache_targets.contains(tc_key)) { + auto const tc_key_it = cache_targets.find(tc_key); + if (tc_key_it == cache_targets.end()) { if (tc.Read(tc_key)) { // entry already in target-cache, so nothing to be done (*setter)(nullptr); @@ -104,9 +105,8 @@ auto CreateTargetCacheWriterMap( true); return; } - auto const& target = cache_targets.at(tc_key); auto entry = TargetCacheEntry::FromTarget( - apis->remote->GetHashType(), target, extra_infos); + apis->remote->GetHashType(), tc_key_it->second, extra_infos); if (not entry) { (*logger)( fmt::format("Failed creating target cache entry for key {}", diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index 3585d2f3..a7afc575 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -223,7 +223,8 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, return kExitFetchError; } auto repo_type_str = repo_type->get()->String(); - if (not kCheckoutTypeMap.contains(repo_type_str)) { + auto const checkout_type_it = kCheckoutTypeMap.find(repo_type_str); + if (checkout_type_it == kCheckoutTypeMap.end()) { Logger::Log(LogLevel::Error, "Config: Unknown repository type {} for {}", nlohmann::json(repo_type_str).dump(), @@ -231,7 +232,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, return kExitFetchError; } // only do work if repo is archive or git tree type - switch (kCheckoutTypeMap.at(repo_type_str)) { + switch (checkout_type_it->second) { case CheckoutType::Archive: { auto logger = std::make_shared<AsyncMapConsumerLogger>( [&repo_name](std::string const& msg, bool fatal) { diff --git a/src/other_tools/just_mr/launch.cpp b/src/other_tools/just_mr/launch.cpp index 0a061031..c085f5be 100644 --- a/src/other_tools/just_mr/launch.cpp +++ b/src/other_tools/just_mr/launch.cpp @@ -93,8 +93,9 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, std::optional<LockFile> lock{}; if (subcommand and kKnownJustSubcommands.contains(*subcommand)) { + auto const& flags = kKnownJustSubcommands.at(*subcommand); // Read the config file if needed - if (kKnownJustSubcommands.at(*subcommand).config) { + if (flags.config) { auto repo_lock = RepositoryGarbageCollector::SharedLock(storage_config); if (not repo_lock) { @@ -128,15 +129,14 @@ auto CallJust(std::optional<std::filesystem::path> const& config_file, return kExitSetupError; } } - use_build_root = kKnownJustSubcommands.at(*subcommand).build_root; - use_launcher = kKnownJustSubcommands.at(*subcommand).launch; - supports_defines = kKnownJustSubcommands.at(*subcommand).defines; - supports_remote = kKnownJustSubcommands.at(*subcommand).remote; - supports_remote_properties = - kKnownJustSubcommands.at(*subcommand).remote_props; - supports_serve = kKnownJustSubcommands.at(*subcommand).serve; - supports_dispatch = kKnownJustSubcommands.at(*subcommand).dispatch; - does_build = kKnownJustSubcommands.at(*subcommand).does_build; + use_build_root = flags.build_root; + use_launcher = flags.launch; + supports_defines = flags.defines; + supports_remote = flags.remote; + supports_remote_properties = flags.remote_props; + supports_serve = flags.serve; + supports_dispatch = flags.dispatch; + does_build = flags.does_build; } // build just command std::vector<std::string> cmd = {common_args.just_path->string()}; diff --git a/src/other_tools/just_mr/mirrors.hpp b/src/other_tools/just_mr/mirrors.hpp index 7480a839..41351bbb 100644 --- a/src/other_tools/just_mr/mirrors.hpp +++ b/src/other_tools/just_mr/mirrors.hpp @@ -158,7 +158,7 @@ namespace MirrorsUtils { CurlURLHandle::GetHostname(mirror).value_or(std::string{}); auto it = mirrors_by_hostname.find(hostname); if (it != mirrors_by_hostname.end()) { - mirrors_by_hostname.at(hostname).emplace_back(mirror); + it->second.emplace_back(mirror); } else { // add missing or unknown hostnames to fallback list with key "" diff --git a/src/other_tools/just_mr/update.cpp b/src/other_tools/just_mr/update.cpp index e2ed9197..43fd2de6 100644 --- a/src/other_tools/just_mr/update.cpp +++ b/src/other_tools/just_mr/update.cpp @@ -24,6 +24,7 @@ #include <optional> #include <thread> #include <unordered_map> +#include <utility> #include <vector> #include "fmt/core.h" @@ -118,7 +119,8 @@ auto MultiRepoUpdate(std::shared_ptr<Configuration> const& config, return kExitUpdateError; } auto repo_type_str = repo_type->get()->String(); - if (not kCheckoutTypeMap.contains(repo_type_str)) { + auto const checkout_type_it = kCheckoutTypeMap.find(repo_type_str); + if (checkout_type_it == kCheckoutTypeMap.end()) { Logger::Log(LogLevel::Error, "Unknown repository type {} for {}", nlohmann::json(repo_type_str).dump(), @@ -126,7 +128,7 @@ auto MultiRepoUpdate(std::shared_ptr<Configuration> const& config, return kExitUpdateError; } // only do work if repo is git type - if (kCheckoutTypeMap.at(repo_type_str) == CheckoutType::Git) { + if (checkout_type_it->second == CheckoutType::Git) { auto repo_desc_repository = (*resolved_repo_desc)->At("repository"); if (not repo_desc_repository) { diff --git a/src/other_tools/repo_map/repos_to_setup_map.cpp b/src/other_tools/repo_map/repos_to_setup_map.cpp index 4e29ffc2..7aeb69f7 100644 --- a/src/other_tools/repo_map/repos_to_setup_map.cpp +++ b/src/other_tools/repo_map/repos_to_setup_map.cpp @@ -502,7 +502,8 @@ void DistdirCheckout(ExpressionPtr const& repo_desc, } // get repo_type auto repo_type_str = repo_type->get()->String(); - if (not kCheckoutTypeMap.contains(repo_type_str)) { + auto const checkout_type_it = kCheckoutTypeMap.find(repo_type_str); + if (checkout_type_it == kCheckoutTypeMap.end()) { (*logger)(fmt::format("DistdirCheckout: Unknown type {} for " "repository {}", nlohmann::json(repo_type_str).dump(), @@ -511,7 +512,7 @@ void DistdirCheckout(ExpressionPtr const& repo_desc, return; } // only do work if repo is archive type - if (kCheckoutTypeMap.at(repo_type_str) == CheckoutType::Archive) { + if (checkout_type_it->second == CheckoutType::Archive) { auto const archive = ParseArchiveContent(*resolved_repo_desc, dist_repo_name); if (not archive) { @@ -794,7 +795,8 @@ auto CreateReposToSetupMap( } // get repo_type auto repo_type_str = repo_type->get()->String(); - if (not kCheckoutTypeMap.contains(repo_type_str)) { + auto const checkout_type_it = kCheckoutTypeMap.find(repo_type_str); + if (checkout_type_it == kCheckoutTypeMap.end()) { (*logger)( fmt::format("Config: Unknown type {} for repository {}", nlohmann::json(repo_type_str).dump(), @@ -811,7 +813,7 @@ auto CreateReposToSetupMap( fatal); }); // do checkout - switch (kCheckoutTypeMap.at(repo_type_str)) { + switch (checkout_type_it->second) { case CheckoutType::Git: { GitCheckout(*resolved_repo_desc, std::move(repos), diff --git a/test/buildtool/build_engine/base_maps/rule_map.test.cpp b/test/buildtool/build_engine/base_maps/rule_map.test.cpp index f3a64954..2b948a10 100644 --- a/test/buildtool/build_engine/base_maps/rule_map.test.cpp +++ b/test/buildtool/build_engine/base_maps/rule_map.test.cpp @@ -103,9 +103,9 @@ TEST_CASE("Test rule fields", "[rule_map]") { REQUIRE_FALSE((*values[0])->StringFields().empty()); REQUIRE_FALSE((*values[0])->TargetFields().empty()); REQUIRE_FALSE((*values[0])->ConfigFields().empty()); - CHECK((*values[0])->StringFields().at(0) == "foo"); - CHECK((*values[0])->TargetFields().at(0) == "bar"); - CHECK((*values[0])->ConfigFields().at(0) == "baz"); + CHECK((*values[0])->StringFields()[0] == "foo"); + CHECK((*values[0])->TargetFields()[0] == "bar"); + CHECK((*values[0])->ConfigFields()[0] == "baz"); }; SECTION("via file") { diff --git a/test/buildtool/graph_traverser/graph_traverser.test.hpp b/test/buildtool/graph_traverser/graph_traverser.test.hpp index 2b10271e..43060a0d 100644 --- a/test/buildtool/graph_traverser/graph_traverser.test.hpp +++ b/test/buildtool/graph_traverser/graph_traverser.test.hpp @@ -211,9 +211,8 @@ class TestProject { REQUIRE(result); REQUIRE(result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(result->output_paths.at(0))); - auto const contents = - FileSystemManager::ReadFile(result->output_paths.at(0)); + CHECK(FileSystemManager::IsFile(result->output_paths[0])); + auto const contents = FileSystemManager::ReadFile(result->output_paths[0]); CHECK(contents.has_value()); CHECK(contents == "Hello, World!\n"); @@ -232,7 +231,7 @@ class TestProject { REQUIRE(exec_result); REQUIRE(exec_result->output_paths.size() == 1); - auto const exec_path = exec_result->output_paths.at(0); + auto const exec_path = exec_result->output_paths[0]; CHECK(FileSystemManager::IsFile(exec_path)); CHECK(FileSystemManager::IsExecutable(exec_path)); CHECK(FileSystemManager::Type(exec_path) == ObjectType::Executable); @@ -288,7 +287,7 @@ class TestProject { REQUIRE(result); REQUIRE(result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(result->output_paths[0])); if (is_hermetic) { CHECK(stats.ActionsQueuedCounter() == 0); @@ -339,7 +338,7 @@ class TestProject { REQUIRE(result); REQUIRE(result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(result->output_paths[0])); auto const clargs_full_build = p.CmdLineArgs("_entry_points_full_build"); GraphTraverser const gt_full_build{clargs_full_build.gtargs, @@ -350,7 +349,7 @@ class TestProject { REQUIRE(full_build_result); REQUIRE(full_build_result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(full_build_result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(full_build_result->output_paths[0])); if (is_hermetic) { CHECK(stats.ActionsQueuedCounter() == 8); @@ -408,7 +407,7 @@ class TestProject { REQUIRE(cpp_result); REQUIRE(cpp_result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(cpp_result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(cpp_result->output_paths[0])); if (is_hermetic) { CHECK(stats.ActionsQueuedCounter() == 0); @@ -435,7 +434,7 @@ class TestProject { REQUIRE(result); REQUIRE(result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(result->output_paths[0])); if (is_hermetic) { CHECK(stats.ActionsQueuedCounter() == 2); @@ -489,10 +488,9 @@ static void TestBlobsUploadedAndUsed( REQUIRE(result); REQUIRE(result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(result->output_paths[0])); - auto const contents = - FileSystemManager::ReadFile(result->output_paths.at(0)); + auto const contents = FileSystemManager::ReadFile(result->output_paths[0]); CHECK(contents.has_value()); CHECK(contents == "this is a test to check if blobs are uploaded"); @@ -548,10 +546,9 @@ static void TestEnvironmentVariablesSetAndUsed( REQUIRE(result); REQUIRE(result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(result->output_paths[0])); - auto const contents = - FileSystemManager::ReadFile(result->output_paths.at(0)); + auto const contents = FileSystemManager::ReadFile(result->output_paths[0]); CHECK(contents.has_value()); CHECK(contents == "content from environment variable"); @@ -607,10 +604,9 @@ static void TestTreesUsed( REQUIRE(result); REQUIRE(result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(result->output_paths[0])); - auto const contents = - FileSystemManager::ReadFile(result->output_paths.at(0)); + auto const contents = FileSystemManager::ReadFile(result->output_paths[0]); CHECK(contents.has_value()); CHECK(contents == "this is a test to check if blobs are uploaded"); @@ -666,10 +662,9 @@ static void TestNestedTreesUsed( REQUIRE(result); REQUIRE(result->output_paths.size() == 1); - CHECK(FileSystemManager::IsFile(result->output_paths.at(0))); + CHECK(FileSystemManager::IsFile(result->output_paths[0])); - auto const contents = - FileSystemManager::ReadFile(result->output_paths.at(0)); + auto const contents = FileSystemManager::ReadFile(result->output_paths[0]); CHECK(contents.has_value()); CHECK(contents == "this is a test to check if blobs are uploaded"); |