MCPcopy Create free account
hub / github.com/catboost/catboost / InitFromEnv

Method InitFromEnv

library/cpp/testing/common/network.cpp:114–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

112 }
113
114 void InitFromEnv() {
115 SyncDir_ = TFsPath(GetEnv("PORT_SYNC_PATH"));
116 if (!SyncDir_.IsDefined()) {
117 SyncDir_ = TFsPath(GetSystemTempDir()) / "testing_port_locks";
118 }
119 Y_ABORT_UNLESS(SyncDir_.IsDefined());
120 NFs::MakeDirectoryRecursive(SyncDir_);
121 Chmod(SyncDir_.c_str(), NFs::FP_COMMON_FILE); // override umask
122
123 Ranges_ = GetPortRanges();
124 TotalCount_ = 0;
125 for (auto [left, right] : Ranges_) {
126 TotalCount_ += right - left;
127 }
128 Y_ABORT_UNLESS(0 != TotalCount_);
129
130 DisableRandomPorts_ = !GetEnv("NO_RANDOM_PORTS").empty();
131 }
132
133 NTesting::TPortHolder GetFreePort() const {
134 ui16 salt = RandomNumber<ui16>();

Callers 1

InitPortManagerFromEnvFunction · 0.80

Calls 9

GetSystemTempDirFunction · 0.85
MakeDirectoryRecursiveFunction · 0.85
GetPortRangesFunction · 0.85
TFsPathClass · 0.50
GetEnvFunction · 0.50
ChmodFunction · 0.50
IsDefinedMethod · 0.45
c_strMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected