summaryrefslogtreecommitdiff
path: root/test/utils/remote_execution/main-remote-execution.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-12 16:09:28 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-16 17:51:12 +0200
commit62d204ff4cc94c12c1635f189255710901682825 (patch)
tree0c5cdc5faf98d28ddf74721280756804a6decf83 /test/utils/remote_execution/main-remote-execution.cpp
parentde3ef374983d987d8ffd8e8516a4877fe68b3e4e (diff)
downloadjustbuild-62d204ff4cc94c12c1635f189255710901682825.tar.gz
Remove the RemoteExecutionConfig singleton
...and replace it with passed instances created early via a builder pattern. Tests are also updated accordingly.
Diffstat (limited to 'test/utils/remote_execution/main-remote-execution.cpp')
-rw-r--r--test/utils/remote_execution/main-remote-execution.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/test/utils/remote_execution/main-remote-execution.cpp b/test/utils/remote_execution/main-remote-execution.cpp
index e18ceb5a..3b4bc60e 100644
--- a/test/utils/remote_execution/main-remote-execution.cpp
+++ b/test/utils/remote_execution/main-remote-execution.cpp
@@ -29,6 +29,7 @@
#include "src/buildtool/logging/logger.hpp"
#include "test/utils/logging/log_config.hpp"
#include "test/utils/remote_execution/test_auth_config.hpp"
+#include "test/utils/remote_execution/test_remote_config.hpp"
#include "test/utils/test_env.hpp"
namespace {
@@ -41,7 +42,7 @@ void wait_for_grpc_to_shutdown() {
/// \brief Configure remote execution from test environment. In case the
/// environment variable is malformed, we write a message and stop execution.
/// \returns true If remote execution was successfully configured.
-[[nodiscard]] auto ConfigureRemoteExecution() -> bool {
+void ConfigureRemoteExecution() {
ReadCompatibilityFromEnv();
// Ensure authentication config is available
@@ -52,19 +53,11 @@ void wait_for_grpc_to_shutdown() {
HashFunction::SetHashType(Compatibility::IsCompatible()
? HashFunction::JustHash::Compatible
: HashFunction::JustHash::Native);
- auto address = ReadRemoteAddressFromEnv();
- if (address and not RemoteExecutionConfig::SetRemoteAddress(*address)) {
- Logger::Log(LogLevel::Error, "parsing address '{}' failed.", *address);
+
+ auto remote_config = TestRemoteConfig::ReadFromEnvironment();
+ if (not remote_config or remote_config->remote_address == std::nullopt) {
std::exit(EXIT_FAILURE);
}
- for (auto const& property : ReadPlatformPropertiesFromEnv()) {
- if (not RemoteExecutionConfig::AddPlatformProperty(property)) {
- Logger::Log(
- LogLevel::Error, "parsing property '{}' failed.", property);
- std::exit(EXIT_FAILURE);
- }
- }
- return static_cast<bool>(RemoteExecutionConfig::RemoteAddress());
}
} // namespace
@@ -72,9 +65,7 @@ void wait_for_grpc_to_shutdown() {
auto main(int argc, char* argv[]) -> int {
ConfigureLogging();
- if (not ConfigureRemoteExecution()) {
- return EXIT_FAILURE;
- }
+ ConfigureRemoteExecution();
/**
* The current implementation of libgit2 uses pthread_key_t incorrectly