diff options
author | bulatman <bulatman@yandex-team.ru> | 2022-02-10 16:45:50 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:50 +0300 |
commit | 6560e4993b14d193f8c879e33a3de5e5eba6e21d (patch) | |
tree | cfd2e2baa05c3196f2caacbb63c32e1df40bc3de /library/cpp/testing/unittest | |
parent | 7489e4682331202b9c7d863c0898eb83d7b12c2b (diff) | |
download | ydb-6560e4993b14d193f8c879e33a3de5e5eba6e21d.tar.gz |
Restoring authorship annotation for <bulatman@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/testing/unittest')
-rw-r--r-- | library/cpp/testing/unittest/env.h | 4 | ||||
-rw-r--r-- | library/cpp/testing/unittest/plugin.h | 2 | ||||
-rw-r--r-- | library/cpp/testing/unittest/tests_data.cpp | 70 | ||||
-rw-r--r-- | library/cpp/testing/unittest/tests_data.h | 6 | ||||
-rw-r--r-- | library/cpp/testing/unittest/utmain.cpp | 24 | ||||
-rw-r--r-- | library/cpp/testing/unittest/ya.make | 14 |
6 files changed, 60 insertions, 60 deletions
diff --git a/library/cpp/testing/unittest/env.h b/library/cpp/testing/unittest/env.h index 4807539ab2..ed4236e314 100644 --- a/library/cpp/testing/unittest/env.h +++ b/library/cpp/testing/unittest/env.h @@ -1,3 +1,3 @@ -// just shortcut -#include <library/cpp/testing/common/env.h> +// just shortcut +#include <library/cpp/testing/common/env.h> diff --git a/library/cpp/testing/unittest/plugin.h b/library/cpp/testing/unittest/plugin.h index 102f2c1469..abf70764d4 100644 --- a/library/cpp/testing/unittest/plugin.h +++ b/library/cpp/testing/unittest/plugin.h @@ -3,7 +3,7 @@ #include <util/generic/ptr.h> namespace NUnitTest { - // Plugins are deprecated, please use Y_TEST_HOOK_* from library/cpp/hook/hook.h + // Plugins are deprecated, please use Y_TEST_HOOK_* from library/cpp/hook/hook.h namespace NPlugin { class IPlugin { public: diff --git a/library/cpp/testing/unittest/tests_data.cpp b/library/cpp/testing/unittest/tests_data.cpp index b51cbc4b87..d7c7a40a0f 100644 --- a/library/cpp/testing/unittest/tests_data.cpp +++ b/library/cpp/testing/unittest/tests_data.cpp @@ -1,59 +1,59 @@ #include "tests_data.h" #include "registar.h" -#include <library/cpp/testing/common/network.h> - -#include <util/system/env.h> -#include <util/system/mutex.h> +#include <library/cpp/testing/common/network.h> +#include <util/system/env.h> +#include <util/system/mutex.h> + class TPortManager::TPortManagerImpl { public: - TPortManagerImpl(bool reservePortsForCurrentTest) - : EnableReservePortsForCurrentTest(reservePortsForCurrentTest) - , DisableRandomPorts(!GetEnv("NO_RANDOM_PORTS").empty()) + TPortManagerImpl(bool reservePortsForCurrentTest) + : EnableReservePortsForCurrentTest(reservePortsForCurrentTest) + , DisableRandomPorts(!GetEnv("NO_RANDOM_PORTS").empty()) { } ui16 GetPort(ui16 port) { - if (port && DisableRandomPorts) { + if (port && DisableRandomPorts) { return port; } - TAtomicSharedPtr<NTesting::IPort> holder(NTesting::GetFreePort().Release()); - ReservePortForCurrentTest(holder); + TAtomicSharedPtr<NTesting::IPort> holder(NTesting::GetFreePort().Release()); + ReservePortForCurrentTest(holder); - TGuard<TMutex> g(Lock); - ReservedPorts.push_back(holder); - return holder->Get(); - } + TGuard<TMutex> g(Lock); + ReservedPorts.push_back(holder); + return holder->Get(); + } - ui16 GetUdpPort(ui16 port) { - return GetPort(port); - } + ui16 GetUdpPort(ui16 port) { + return GetPort(port); + } - ui16 GetTcpPort(ui16 port) { - return GetPort(port); + ui16 GetTcpPort(ui16 port) { + return GetPort(port); } ui16 GetTcpAndUdpPort(ui16 port) { - return GetPort(port); + return GetPort(port); } ui16 GetPortsRange(const ui16 startPort, const ui16 range) { - Y_UNUSED(startPort); - auto ports = NTesting::NLegacy::GetFreePortsRange(range); - ui16 first = ports[0]; + Y_UNUSED(startPort); + auto ports = NTesting::NLegacy::GetFreePortsRange(range); + ui16 first = ports[0]; TGuard<TMutex> g(Lock); - for (auto& port : ports) { - ReservedPorts.emplace_back(port.Release()); - ReservePortForCurrentTest(ReservedPorts.back()); + for (auto& port : ports) { + ReservedPorts.emplace_back(port.Release()); + ReservePortForCurrentTest(ReservedPorts.back()); } - return first; + return first; } private: - void ReservePortForCurrentTest(const TAtomicSharedPtr<NTesting::IPort>& portGuard) { - if (EnableReservePortsForCurrentTest) { + void ReservePortForCurrentTest(const TAtomicSharedPtr<NTesting::IPort>& portGuard) { + if (EnableReservePortsForCurrentTest) { TTestBase* currentTest = NUnitTest::NPrivate::GetCurrentTest(); if (currentTest != nullptr) { currentTest->RunAfterTest([guard = portGuard]() mutable { @@ -65,13 +65,13 @@ private: private: TMutex Lock; - TVector<TAtomicSharedPtr<NTesting::IPort>> ReservedPorts; - const bool EnableReservePortsForCurrentTest; - const bool DisableRandomPorts; + TVector<TAtomicSharedPtr<NTesting::IPort>> ReservedPorts; + const bool EnableReservePortsForCurrentTest; + const bool DisableRandomPorts; }; -TPortManager::TPortManager(bool reservePortsForCurrentTest) - : Impl_(new TPortManagerImpl(reservePortsForCurrentTest)) +TPortManager::TPortManager(bool reservePortsForCurrentTest) + : Impl_(new TPortManagerImpl(reservePortsForCurrentTest)) { } @@ -99,6 +99,6 @@ ui16 TPortManager::GetPortsRange(const ui16 startPort, const ui16 range) { } ui16 GetRandomPort() { - TPortManager* pm = Singleton<TPortManager>(false); + TPortManager* pm = Singleton<TPortManager>(false); return pm->GetPort(); } diff --git a/library/cpp/testing/unittest/tests_data.h b/library/cpp/testing/unittest/tests_data.h index 6536bc1ae6..ff542d2c64 100644 --- a/library/cpp/testing/unittest/tests_data.h +++ b/library/cpp/testing/unittest/tests_data.h @@ -1,7 +1,7 @@ #pragma once -#include <library/cpp/testing/common/env.h> - +#include <library/cpp/testing/common/env.h> + #include <util/generic/noncopyable.h> #include <util/generic/ptr.h> #include <util/generic/string.h> @@ -29,7 +29,7 @@ void SetReuseAddressAndPort(const TSocketType& sock) { class TPortManager: public TNonCopyable { public: - TPortManager(bool reservePortsForCurrentTest = true); + TPortManager(bool reservePortsForCurrentTest = true); ~TPortManager(); // Gets free TCP port diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp index 305bc6b40f..a5b74ee801 100644 --- a/library/cpp/testing/unittest/utmain.cpp +++ b/library/cpp/testing/unittest/utmain.cpp @@ -7,13 +7,13 @@ #include <library/cpp/json/writer/json.h> #include <library/cpp/json/writer/json_value.h> #include <library/cpp/testing/common/env.h> -#include <library/cpp/testing/hook/hook.h> +#include <library/cpp/testing/hook/hook.h> #include <util/datetime/base.h> #include <util/generic/hash.h> #include <util/generic/hash_set.h> -#include <util/generic/scope.h> +#include <util/generic/scope.h> #include <util/generic/string.h> #include <util/generic/yexception.h> @@ -647,7 +647,7 @@ int NUnitTest::RunMain(int argc, char** argv) { Y_VERIFY(!sigaction(SIGUSR2, &sa, nullptr)); } #endif - NTesting::THook::CallBeforeInit(); + NTesting::THook::CallBeforeInit(); InitNetworkSubSystem(); try { @@ -658,11 +658,11 @@ int NUnitTest::RunMain(int argc, char** argv) { #ifndef UT_SKIP_EXCEPTIONS try { #endif - NTesting::THook::CallBeforeRun(); - Y_DEFER { NTesting::THook::CallAfterRun(); }; - + NTesting::THook::CallBeforeRun(); + Y_DEFER { NTesting::THook::CallAfterRun(); }; + NPlugin::OnStartMain(argc, argv); - Y_DEFER { NPlugin::OnStopMain(argc, argv); }; + Y_DEFER { NPlugin::OnStopMain(argc, argv); }; TColoredProcessor processor(GetExecPath()); IOutputStream* listStream = &Cout; @@ -749,18 +749,18 @@ int NUnitTest::RunMain(int argc, char** argv) { TTestFactory::Instance().SetProcessor(&processor); - unsigned ret; + unsigned ret; for (;;) { - ret = TTestFactory::Instance().Execute(); + ret = TTestFactory::Instance().Execute(); if (!processor.GetIsForked() && ret && processor.GetPrintSummary()) { Cerr << "SOME TESTS FAILED!!!!" << Endl; } - if (0 != ret || !processor.IsLoop()) { - break; + if (0 != ret || !processor.IsLoop()) { + break; } } - return ret; + return ret; #ifndef UT_SKIP_EXCEPTIONS } catch (...) { Cerr << "caught exception in test suite(" << CurrentExceptionMessage() << ")" << Endl; diff --git a/library/cpp/testing/unittest/ya.make b/library/cpp/testing/unittest/ya.make index aaa4f2ba85..f291fec2cb 100644 --- a/library/cpp/testing/unittest/ya.make +++ b/library/cpp/testing/unittest/ya.make @@ -12,8 +12,8 @@ PEERDIR( library/cpp/dbg_output library/cpp/diff library/cpp/json/writer - library/cpp/testing/common - library/cpp/testing/hook + library/cpp/testing/common + library/cpp/testing/hook ) SRCS( @@ -26,8 +26,8 @@ SRCS( ) END() - -RECURSE_FOR_TESTS( - fat - ut -) + +RECURSE_FOR_TESTS( + fat + ut +) |