diff options
author | Andrey Fomichev <andrey.fomichev@gmail.com> | 2022-02-10 16:49:15 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:15 +0300 |
commit | 1c61afbf3db63940d05e6fefa3104b03457788a1 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/testing | |
parent | e542cc14db4240643a06bb0dde87ecf361f101ab (diff) | |
download | ydb-1c61afbf3db63940d05e6fefa3104b03457788a1.tar.gz |
Restoring authorship annotation for Andrey Fomichev <andrey.fomichev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/testing')
-rw-r--r-- | library/cpp/testing/common/env.h | 4 | ||||
-rw-r--r-- | library/cpp/testing/unittest/tests_data.h | 38 |
2 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/testing/common/env.h b/library/cpp/testing/common/env.h index 952faa91bc..7b89aa1bed 100644 --- a/library/cpp/testing/common/env.h +++ b/library/cpp/testing/common/env.h @@ -17,10 +17,10 @@ TString ArcadiaFromCurrentLocation(TStringBuf where, TStringBuf path); // @brief return build folder path TString BuildRoot(); - + // @brief return full path to built artefact, where path is relative from arcadia root TString BinaryPath(TStringBuf path); - + // @brief return true if environment is testenv otherwise false bool FromYaTest(); diff --git a/library/cpp/testing/unittest/tests_data.h b/library/cpp/testing/unittest/tests_data.h index 6775e98b5d..6536bc1ae6 100644 --- a/library/cpp/testing/unittest/tests_data.h +++ b/library/cpp/testing/unittest/tests_data.h @@ -5,28 +5,28 @@ #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> #include <util/generic/string.h> -#include <util/network/sock.h> +#include <util/network/sock.h> class TInet6StreamSocket; -// set two options: SO_REUSEADDR and SO_REUSEPORT, both are required for -// correct implementation of TPortManager because of different operating systems -// incompatibility: singe SO_REUSEADDR is enough for Linux, but not enough for Darwin -template <class TSocketType> -void SetReuseAddressAndPort(const TSocketType& sock) { - const int retAddr = SetSockOpt(sock, SOL_SOCKET, SO_REUSEADDR, 1); - if (retAddr < 0) { - ythrow yexception() << "can't set SO_REUSEADDR: " << LastSystemErrorText(-retAddr); - } - -#ifdef SO_REUSEPORT - const int retPort = SetSockOpt(sock, SOL_SOCKET, SO_REUSEPORT, 1); - if (retPort < 0) { - ythrow yexception() << "can't set SO_REUSEPORT: " << LastSystemErrorText(-retPort); - } -#endif -} - +// set two options: SO_REUSEADDR and SO_REUSEPORT, both are required for +// correct implementation of TPortManager because of different operating systems +// incompatibility: singe SO_REUSEADDR is enough for Linux, but not enough for Darwin +template <class TSocketType> +void SetReuseAddressAndPort(const TSocketType& sock) { + const int retAddr = SetSockOpt(sock, SOL_SOCKET, SO_REUSEADDR, 1); + if (retAddr < 0) { + ythrow yexception() << "can't set SO_REUSEADDR: " << LastSystemErrorText(-retAddr); + } + +#ifdef SO_REUSEPORT + const int retPort = SetSockOpt(sock, SOL_SOCKET, SO_REUSEPORT, 1); + if (retPort < 0) { + ythrow yexception() << "can't set SO_REUSEPORT: " << LastSystemErrorText(-retPort); + } +#endif +} + class TPortManager: public TNonCopyable { public: TPortManager(bool reservePortsForCurrentTest = true); |