diff options
author | asatarin <asatarin@yandex-team.ru> | 2022-02-10 16:47:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:30 +0300 |
commit | 4ca29390ac54b7877174de542de47532c67453b5 (patch) | |
tree | 14f6fc2edf989ce65a7555e8882e3eae3e9306fe /library | |
parent | 05f59b2581f074c756adaee6b260014ac3a0c3ec (diff) | |
download | ydb-4ca29390ac54b7877174de542de47532c67453b5.tar.gz |
Restoring authorship annotation for <asatarin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library')
19 files changed, 220 insertions, 220 deletions
diff --git a/library/cpp/actors/core/actor_coroutine_ut.cpp b/library/cpp/actors/core/actor_coroutine_ut.cpp index 951512b877..3397987bc8 100644 --- a/library/cpp/actors/core/actor_coroutine_ut.cpp +++ b/library/cpp/actors/core/actor_coroutine_ut.cpp @@ -7,8 +7,8 @@ #include "hfunc.h" #include <library/cpp/testing/unittest/registar.h> -#include <util/system/sanitizers.h> - +#include <util/system/sanitizers.h> + using namespace NActors; Y_UNIT_TEST_SUITE(ActorCoro) { @@ -128,10 +128,10 @@ Y_UNIT_TEST_SUITE(ActorCoro) { } Y_UNIT_TEST(Basic) { - if (NSan::TSanIsOn()) { - // TODO https://st.yandex-team.ru/DEVTOOLS-3154 - return; - } + if (NSan::TSanIsOn()) { + // TODO https://st.yandex-team.ru/DEVTOOLS-3154 + return; + } Check(MakeHolder<TEvEnough>()); } diff --git a/library/cpp/actors/core/mailbox.cpp b/library/cpp/actors/core/mailbox.cpp index d84b4f9e46..f3a0b48287 100644 --- a/library/cpp/actors/core/mailbox.cpp +++ b/library/cpp/actors/core/mailbox.cpp @@ -3,8 +3,8 @@ #include <library/cpp/actors/util/datetime.h> -#include <util/system/sanitizers.h> - +#include <util/system/sanitizers.h> + namespace NActors { TMailboxTable::TMailboxTable() : LastAllocatedLine(0) @@ -178,7 +178,7 @@ namespace NActors { switch (x->MailboxType) { case TMailboxType::Simple: { TSimpleMailbox* const mailbox = TSimpleMailbox::Get(lineHint, x); -#if (!defined(_tsan_enabled_)) +#if (!defined(_tsan_enabled_)) Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType); #endif mailbox->Queue.Push(ev.Release()); @@ -202,7 +202,7 @@ namespace NActors { return false; TRevolvingMailbox* const mailbox = TRevolvingMailbox::Get(lineHint, x); -#if (!defined(_tsan_enabled_)) +#if (!defined(_tsan_enabled_)) Y_VERIFY_DEBUG(mailbox->Type == (ui32)x->MailboxType); #endif mailbox->QueueWriter.Push(ev.Release()); diff --git a/library/cpp/actors/memory_log/memlog.cpp b/library/cpp/actors/memory_log/memlog.cpp index 8e6b46727d..d7aa94d762 100644 --- a/library/cpp/actors/memory_log/memlog.cpp +++ b/library/cpp/actors/memory_log/memlog.cpp @@ -198,32 +198,32 @@ void NoCacheMemcpy(char* dst, const char* src, size_t size) noexcept { } memcpy(dst, src, size); } - -NO_SANITIZE_THREAD -void NoWCacheMemcpy(char* dst, const char* src, size_t size) noexcept { - constexpr ui16 ITEMS_COUNT = 1024; - alignas(TMemoryLog::MemcpyAlignment) __m128 buf[ITEMS_COUNT]; - while (size >= sizeof(buf)) { - memcpy(&buf, src, sizeof(buf)); - - for (ui16 i = 0; i < ITEMS_COUNT; ++i) { - _mm_stream_ps((float*)dst, buf[i]); - dst += sizeof(__m128); - } - - size -= sizeof(buf); - src += sizeof(buf); - } - - memcpy(&buf, src, size); - // no problem to copy few bytes more - size = AlignUp(size, sizeof(__m128)); - for (ui16 i = 0; i < size / sizeof(__m128); ++i) { - _mm_stream_ps((float*)dst, buf[i]); - dst += sizeof(__m128); - } -} - + +NO_SANITIZE_THREAD +void NoWCacheMemcpy(char* dst, const char* src, size_t size) noexcept { + constexpr ui16 ITEMS_COUNT = 1024; + alignas(TMemoryLog::MemcpyAlignment) __m128 buf[ITEMS_COUNT]; + while (size >= sizeof(buf)) { + memcpy(&buf, src, sizeof(buf)); + + for (ui16 i = 0; i < ITEMS_COUNT; ++i) { + _mm_stream_ps((float*)dst, buf[i]); + dst += sizeof(__m128); + } + + size -= sizeof(buf); + src += sizeof(buf); + } + + memcpy(&buf, src, size); + // no problem to copy few bytes more + size = AlignUp(size, sizeof(__m128)); + for (ui16 i = 0; i < size / sizeof(__m128); ++i) { + _mm_stream_ps((float*)dst, buf[i]); + dst += sizeof(__m128); + } +} + #endif NO_SANITIZE_THREAD @@ -240,12 +240,12 @@ char* BareMemLogWrite(const char* begin, size_t msgSize, bool isLast) noexcept { #if defined(_x86_64_) || defined(_i386_) if (AlignDown(begin, TMemoryLog::MemcpyAlignment) == begin) { NoCacheMemcpy(buffer, begin, msgSize); - } else { - NoWCacheMemcpy(buffer, begin, msgSize); - } -#else - memcpy(buffer, begin, msgSize); -#endif + } else { + NoWCacheMemcpy(buffer, begin, msgSize); + } +#else + memcpy(buffer, begin, msgSize); +#endif if (lastMark) { TMemoryLog::ChangeLastMark(buffer + msgSize); @@ -267,7 +267,7 @@ bool MemLogWrite(const char* begin, size_t msgSize, bool addLF) noexcept { // check for format for snprintf constexpr size_t prologSize = 48; alignas(TMemoryLog::MemcpyAlignment) char prolog[prologSize + 1]; - Y_VERIFY(AlignDown(&prolog, TMemoryLog::MemcpyAlignment) == &prolog); + Y_VERIFY(AlignDown(&prolog, TMemoryLog::MemcpyAlignment) == &prolog); int snprintfResult = snprintf(prolog, prologSize + 1, "TS %020" PRIu64 " TI %020" PRIu64 " ", GetCycleCountFast(), threadId); @@ -288,18 +288,18 @@ bool MemLogWrite(const char* begin, size_t msgSize, bool addLF) noexcept { } #if defined(_x86_64_) || defined(_i386_) - // warning: copy prolog first to avoid corruption of the message - // by prolog tail - NoCacheMemcpy(buffer, prolog, prologSize); + // warning: copy prolog first to avoid corruption of the message + // by prolog tail + NoCacheMemcpy(buffer, prolog, prologSize); if (AlignDown(begin + prologSize, TMemoryLog::MemcpyAlignment) == begin + prologSize) { - NoCacheMemcpy(buffer + prologSize, begin, msgSize); + NoCacheMemcpy(buffer + prologSize, begin, msgSize); } else { - NoWCacheMemcpy(buffer + prologSize, begin, msgSize); - } -#else - memcpy(buffer, prolog, prologSize); - memcpy(buffer + prologSize, begin, msgSize); -#endif + NoWCacheMemcpy(buffer + prologSize, begin, msgSize); + } +#else + memcpy(buffer, prolog, prologSize); + memcpy(buffer + prologSize, begin, msgSize); +#endif if (addLF) { buffer[prologSize + msgSize] = '\n'; @@ -336,9 +336,9 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { // alignment required by NoCacheMemcpy alignas(TMemoryLog::MemcpyAlignment) char buf[TMemoryLog::MAX_MESSAGE_SIZE]; - Y_VERIFY(AlignDown(&buf, TMemoryLog::MemcpyAlignment) == &buf); + Y_VERIFY(AlignDown(&buf, TMemoryLog::MemcpyAlignment) == &buf); - int prologSize = snprintf(buf, + int prologSize = snprintf(buf, TMemoryLog::MAX_MESSAGE_SIZE - 2, "TS %020" PRIu64 " TI %020" PRIu64 " ", GetCycleCountFast(), @@ -350,7 +350,7 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { Y_VERIFY((ui32)prologSize <= TMemoryLog::MAX_MESSAGE_SIZE); int add = vsnprintf( - &buf[prologSize], + &buf[prologSize], TMemoryLog::MAX_MESSAGE_SIZE - prologSize - 2, format, params); @@ -360,8 +360,8 @@ bool MemLogVPrintF(const char* format, va_list params) noexcept { Y_VERIFY(add >= 0); auto totalSize = prologSize + add; - buf[totalSize++] = '\n'; + buf[totalSize++] = '\n'; Y_VERIFY((ui32)totalSize <= TMemoryLog::MAX_MESSAGE_SIZE); - return BareMemLogWrite(buf, totalSize) != nullptr; + return BareMemLogWrite(buf, totalSize) != nullptr; } diff --git a/library/cpp/actors/testlib/test_runtime.cpp b/library/cpp/actors/testlib/test_runtime.cpp index 6fa25b9965..eea97fb613 100644 --- a/library/cpp/actors/testlib/test_runtime.cpp +++ b/library/cpp/actors/testlib/test_runtime.cpp @@ -12,7 +12,7 @@ #include <library/cpp/actors/interconnect/interconnect.h> #include <library/cpp/actors/interconnect/interconnect_tcp_proxy.h> #include <library/cpp/actors/interconnect/interconnect_proxy_wrapper.h> - + #include <util/generic/maybe.h> #include <util/generic/bt_exception.h> #include <util/random/mersenne.h> @@ -23,7 +23,7 @@ bool VERBOSE = false; const bool PRINT_EVENT_BODY = false; namespace { - + TString MakeClusterId() { pid_t pid = getpid(); TStringBuilder uuid; @@ -457,7 +457,7 @@ namespace NActors { TTestActorRuntimeBase::TTestActorRuntimeBase(ui32 nodeCount, ui32 dataCenterCount, bool useRealThreads) : ScheduledCount(0) - , ScheduledLimit(100000) + , ScheduledLimit(100000) , MainThreadId(TThread::CurrentThreadId()) , ClusterUUID(MakeClusterId()) , FirstNodeId(NextNodeId) @@ -472,7 +472,7 @@ namespace NActors { , TimeProvider(new TTimeProvider(*this)) , ShouldContinue() , CurrentTimestamp(0) - , DispatchTimeout(DEFAULT_DISPATCH_TIMEOUT) + , DispatchTimeout(DEFAULT_DISPATCH_TIMEOUT) , ReschedulingDelay(TDuration::MicroSeconds(0)) , ObserverFunc(&TTestActorRuntimeBase::DefaultObserverFunc) , ScheduledEventsSelectorFunc(&CollapsedTimeScheduledEventsSelector) @@ -1832,12 +1832,12 @@ namespace NActors { while (Context->Queue->Head()) { HasReply = false; ctx.ExecutorThread.Send(GetForwardedEvent().Release()); - int count = 100; - while (!HasReply && count > 0) { + int count = 100; + while (!HasReply && count > 0) { try { Runtime->DispatchEvents(DelegateeOptions); } catch (TEmptyEventQueueException&) { - count--; + count--; Cerr << "No reply" << Endl; } } diff --git a/library/cpp/actors/testlib/test_runtime.h b/library/cpp/actors/testlib/test_runtime.h index 26e3b45c98..dabca4bac4 100644 --- a/library/cpp/actors/testlib/test_runtime.h +++ b/library/cpp/actors/testlib/test_runtime.h @@ -26,18 +26,18 @@ #include <util/system/mutex.h> #include <util/system/condvar.h> #include <util/system/thread.h> -#include <util/system/sanitizers.h> -#include <util/system/valgrind.h> +#include <util/system/sanitizers.h> +#include <util/system/valgrind.h> #include <utility> #include <functional> -const TDuration DEFAULT_DISPATCH_TIMEOUT = NSan::PlainOrUnderSanitizer( - NValgrind::PlainOrUnderValgrind(TDuration::Seconds(60), TDuration::Seconds(120)), - TDuration::Seconds(120) -); - - +const TDuration DEFAULT_DISPATCH_TIMEOUT = NSan::PlainOrUnderSanitizer( + NValgrind::PlainOrUnderValgrind(TDuration::Seconds(60), TDuration::Seconds(120)), + TDuration::Seconds(120) +); + + namespace NActors { struct THeSingleSystemEnv { }; diff --git a/library/cpp/bucket_quoter/bucket_quoter.h b/library/cpp/bucket_quoter/bucket_quoter.h index 3d92ef8450..0e0ac59f1b 100644 --- a/library/cpp/bucket_quoter/bucket_quoter.h +++ b/library/cpp/bucket_quoter/bucket_quoter.h @@ -89,7 +89,7 @@ public: , UsecWaited(usecWaited) , AggregateInflow(aggregateInflow) , Bucket(fill ? capacity : 0) - , LastAdd(Timer::Now()) + , LastAdd(Timer::Now()) , InflowTokensPerSecond(&FixedInflow) , BucketTokensCapacity(&FixedCapacity) , FixedInflow(inflow) @@ -108,7 +108,7 @@ public: , UsecWaited(usecWaited) , AggregateInflow(aggregateInflow) , Bucket(fill ? AtomicGet(*capacity) : 0) - , LastAdd(Timer::Now()) + , LastAdd(Timer::Now()) , InflowTokensPerSecond(inflow) , BucketTokensCapacity(capacity) { diff --git a/library/cpp/messagebus/netaddr_ut.cpp b/library/cpp/messagebus/netaddr_ut.cpp index e5c68bf402..dcaeae3e8a 100644 --- a/library/cpp/messagebus/netaddr_ut.cpp +++ b/library/cpp/messagebus/netaddr_ut.cpp @@ -1,13 +1,13 @@ #include <library/cpp/testing/unittest/registar.h> #include "netaddr.h" -#include "test_utils.h" +#include "test_utils.h" using namespace NBus; Y_UNIT_TEST_SUITE(TNetAddr) { Y_UNIT_TEST(ResolveIpv4) { - ASSUME_IP_V4_ENABLED; + ASSUME_IP_V4_ENABLED; UNIT_ASSERT(TNetAddr("ns1.yandex.ru", 80, EIP_VERSION_4).IsIpv4()); } diff --git a/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp b/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp index 3fdd175d73..afc99b05e4 100644 --- a/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp +++ b/library/cpp/messagebus/test/ut/locator_uniq_ut.cpp @@ -15,8 +15,8 @@ protected: UNIT_TEST_SUITE_REGISTRATION(TLocatorRegisterUniqTest); void TLocatorRegisterUniqTest::TestRegister() { - ASSUME_IP_V4_ENABLED; - + ASSUME_IP_V4_ENABLED; + NBus::TBusLocator locator; const char* serviceName = "TestService"; const char* hostName = "192.168.0.42"; diff --git a/library/cpp/messagebus/test/ut/one_way_ut.cpp b/library/cpp/messagebus/test/ut/one_way_ut.cpp index 9c21227e2b..56f7697762 100644 --- a/library/cpp/messagebus/test/ut/one_way_ut.cpp +++ b/library/cpp/messagebus/test/ut/one_way_ut.cpp @@ -65,9 +65,9 @@ struct NullClient : TBusClientHandlerError { } ~NullClient() override { - Session->Shutdown(); - } - + Session->Shutdown(); + } + /// dispatch of requests is done here void Work() { int batch = 10; @@ -107,9 +107,9 @@ public: } ~NullServer() override { - Session->Shutdown(); - } - + Session->Shutdown(); + } + /// when message comes do not send reply, just acknowledge void OnMessage(TOnMessageContext& mess) override { TExampleRequest* fmess = static_cast<TExampleRequest*>(mess.GetMessage()); diff --git a/library/cpp/messagebus/test/ut/ya.make b/library/cpp/messagebus/test/ut/ya.make index fe1b4961d6..672f3febbe 100644 --- a/library/cpp/messagebus/test/ut/ya.make +++ b/library/cpp/messagebus/test/ut/ya.make @@ -11,46 +11,46 @@ TAG( ya:fat ) -FORK_SUBTESTS() - -PEERDIR( +FORK_SUBTESTS() + +PEERDIR( library/cpp/testing/unittest_main library/cpp/messagebus library/cpp/messagebus/test/helper library/cpp/messagebus/www -) - -SRCS( - messagebus_ut.cpp - module_client_ut.cpp - module_client_one_way_ut.cpp - module_server_ut.cpp - one_way_ut.cpp - starter_ut.cpp - sync_client_ut.cpp - locator_uniq_ut.cpp - ../../actor/actor_ut.cpp - ../../actor/ring_buffer_ut.cpp - ../../actor/tasks_ut.cpp - ../../actor/what_thread_does_guard_ut.cpp - ../../async_result_ut.cpp - ../../cc_semaphore_ut.cpp - ../../coreconn_ut.cpp - ../../duration_histogram_ut.cpp - ../../message_status_counter_ut.cpp - ../../misc/weak_ptr_ut.cpp - ../../latch_ut.cpp - ../../lfqueue_batch_ut.cpp - ../../local_flags_ut.cpp - ../../memory_ut.cpp - ../../moved_ut.cpp - ../../netaddr_ut.cpp - ../../network_ut.cpp - ../../nondestroying_holder_ut.cpp - ../../scheduler_actor_ut.cpp - ../../scheduler/scheduler_ut.cpp - ../../socket_addr_ut.cpp - ../../vector_swaps_ut.cpp -) - -END() +) + +SRCS( + messagebus_ut.cpp + module_client_ut.cpp + module_client_one_way_ut.cpp + module_server_ut.cpp + one_way_ut.cpp + starter_ut.cpp + sync_client_ut.cpp + locator_uniq_ut.cpp + ../../actor/actor_ut.cpp + ../../actor/ring_buffer_ut.cpp + ../../actor/tasks_ut.cpp + ../../actor/what_thread_does_guard_ut.cpp + ../../async_result_ut.cpp + ../../cc_semaphore_ut.cpp + ../../coreconn_ut.cpp + ../../duration_histogram_ut.cpp + ../../message_status_counter_ut.cpp + ../../misc/weak_ptr_ut.cpp + ../../latch_ut.cpp + ../../lfqueue_batch_ut.cpp + ../../local_flags_ut.cpp + ../../memory_ut.cpp + ../../moved_ut.cpp + ../../netaddr_ut.cpp + ../../network_ut.cpp + ../../nondestroying_holder_ut.cpp + ../../scheduler_actor_ut.cpp + ../../scheduler/scheduler_ut.cpp + ../../socket_addr_ut.cpp + ../../vector_swaps_ut.cpp +) + +END() diff --git a/library/cpp/messagebus/test_utils.h b/library/cpp/messagebus/test_utils.h index 2abdf504b1..42725c0b9b 100644 --- a/library/cpp/messagebus/test_utils.h +++ b/library/cpp/messagebus/test_utils.h @@ -1,6 +1,6 @@ -#pragma once - -// Do nothing if there is no support for IPv4 +#pragma once + +// Do nothing if there is no support for IPv4 #define ASSUME_IP_V4_ENABLED \ do { \ try { \ @@ -9,4 +9,4 @@ Y_UNUSED(ex); \ return; \ } \ - } while (0) + } while (0) diff --git a/library/cpp/messagebus/ya.make b/library/cpp/messagebus/ya.make index e13cf06dea..f022234eb3 100644 --- a/library/cpp/messagebus/ya.make +++ b/library/cpp/messagebus/ya.make @@ -3,9 +3,9 @@ LIBRARY() OWNER(g:messagebus) IF (SANITIZER_TYPE == "undefined") - NO_SANITIZE() -ENDIF() - + NO_SANITIZE() +ENDIF() + SRCS( acceptor.cpp acceptor_status.cpp diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp index 3679b768ed..614217c1a5 100644 --- a/library/cpp/testing/unittest/registar.cpp +++ b/library/cpp/testing/unittest/registar.cpp @@ -50,7 +50,7 @@ void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, boo if (::NUnitTest::ContinueOnFail || !fatalFailure) { return; } - throw TAssertException(); + throw TAssertException(); } void ::NUnitTest::SetRaiseErrorHandler(::NUnitTest::TRaiseErrorHandler handler) { diff --git a/library/cpp/testing/unittest/registar.h b/library/cpp/testing/unittest/registar.h index 44517a0092..00466a8cc7 100644 --- a/library/cpp/testing/unittest/registar.h +++ b/library/cpp/testing/unittest/registar.h @@ -437,18 +437,18 @@ public: \ #define UNIT_ASSERT_STRINGS_EQUAL(A, B) UNIT_ASSERT_STRINGS_EQUAL_C(A, B, "") -#define UNIT_ASSERT_STRING_CONTAINS_C(A, B, C) \ - do { \ +#define UNIT_ASSERT_STRING_CONTAINS_C(A, B, C) \ + do { \ const TString _a(A); \ const TString _b(B); \ - if (!_a.Contains(_b)) { \ + if (!_a.Contains(_b)) { \ auto&& msg = Sprintf("\"%s\" does not contain \"%s\", %s", ToString(_a).data(), ToString(_b).data(), (::TStringBuilder() << C).data()); \ - UNIT_FAIL_IMPL("strings contains assertion failed", msg); \ - } \ - } while (false) - -#define UNIT_ASSERT_STRING_CONTAINS(A, B) UNIT_ASSERT_STRING_CONTAINS_C(A, B, "") - + UNIT_FAIL_IMPL("strings contains assertion failed", msg); \ + } \ + } while (false) + +#define UNIT_ASSERT_STRING_CONTAINS(A, B) UNIT_ASSERT_STRING_CONTAINS_C(A, B, "") + #define UNIT_ASSERT_NO_DIFF(A, B) \ do { \ const TString _a(A); \ diff --git a/library/cpp/threading/skip_list/perf/main.cpp b/library/cpp/threading/skip_list/perf/main.cpp index 4ad52049e7..c3eb6a6917 100644 --- a/library/cpp/threading/skip_list/perf/main.cpp +++ b/library/cpp/threading/skip_list/perf/main.cpp @@ -215,7 +215,7 @@ namespace { for (const TTest& test : Tests) { LogInfo() << "Starting test " << test.Name << Endl; - + TInstant started = TInstant::Now(); try { test.Func(); @@ -226,7 +226,7 @@ namespace { } LogInfo() << "List size = " << List.GetSize() << Endl; - + TDuration duration = TInstant::Now() - started; LogInfo() << "test " << test.Name << " duration: " << duration @@ -276,8 +276,8 @@ namespace { for (size_t i = 0; i < Iterations; ++i) { List.Insert(TListItem(Random.GetString(KeyLen), Random.GetString(ValueLen))); } - } - + } + void TEST_LookupRandom() { for (size_t i = 0; i < Iterations; ++i) { List.SeekTo(TListItem(Random.GetString(KeyLen), TStringBuf())); @@ -296,7 +296,7 @@ namespace { TGuard<TMutex> guard(Mutex); List.Insert(TListItem(Random.GetString(KeyLen), Random.GetString(ValueLen))); } - } + } TDuration duration = TInstant::Now() - started; LogInfo() << "Average time for producer = " diff --git a/library/python/testing/yatest_common/yatest/common/network.py b/library/python/testing/yatest_common/yatest/common/network.py index 37bcb1b8e0..ef33444dad 100644 --- a/library/python/testing/yatest_common/yatest/common/network.py +++ b/library/python/testing/yatest_common/yatest/common/network.py @@ -19,12 +19,12 @@ class PortManagerException(Exception): class PortManager(object): - """ - See documentation here + """ + See documentation here https://wiki.yandex-team.ru/yatool/test/#python-acquire-ports - """ - + """ + def __init__(self, sync_dir=None): self._sync_dir = sync_dir or os.environ.get('PORT_SYNC_PATH') if self._sync_dir: diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py index a8bcc21f51..d56eeb3f75 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -356,7 +356,7 @@ class _Execution(object): finally: self._elapsed = time.time() - self._start self._save_outputs() - self.verify_no_coredumps() + self.verify_no_coredumps() self._finalise(check_exit_code) @@ -370,11 +370,11 @@ class _Execution(object): # Don't search for sanitize errors if stderr was redirected self.verify_sanitize_errors() - def verify_no_coredumps(self): - """ - Verify there is no coredump from this binary. If there is then report backtrace. - """ - if self.exit_code < 0 and self._collect_cores: + def verify_no_coredumps(self): + """ + Verify there is no coredump from this binary. If there is then report backtrace. + """ + if self.exit_code < 0 and self._collect_cores: if cores: try: self._recover_core() @@ -382,11 +382,11 @@ class _Execution(object): yatest_logger.exception("Exception while recovering core") else: yatest_logger.warning("Core dump file recovering is skipped: module cores isn't available") - + def verify_sanitize_errors(self): - """ - Verify there are no sanitizer (ASAN, MSAN, TSAN, etc) errors for this binary. If there are any report them. - """ + """ + Verify there are no sanitizer (ASAN, MSAN, TSAN, etc) errors for this binary. If there are any report them. + """ if self._std_err and self._check_sanitizer and runtime._get_ya_config().sanitizer_extra_checks: build_path = runtime.build_path() if self.command[0].startswith(build_path): diff --git a/library/python/testing/yatest_common/yatest/common/runtime.py b/library/python/testing/yatest_common/yatest/common/runtime.py index e55e193446..c827169f43 100644 --- a/library/python/testing/yatest_common/yatest/common/runtime.py +++ b/library/python/testing/yatest_common/yatest/common/runtime.py @@ -198,15 +198,15 @@ def get_param(key, default=None): return _get_ya_plugin_instance().get_param(key, default) -def get_param_dict_copy(): - """ - Return copy of dictionary with all parameters. Changes to this dictionary do *not* change parameters. - - :return: copy of dictionary with all parameters - """ - return _get_ya_plugin_instance().get_param_dict_copy() - - +def get_param_dict_copy(): + """ + Return copy of dictionary with all parameters. Changes to this dictionary do *not* change parameters. + + :return: copy of dictionary with all parameters + """ + return _get_ya_plugin_instance().get_param_dict_copy() + + @not_test def test_output_path(path=None): """ @@ -317,11 +317,11 @@ class Context(object): @property def sanitize(self): - """ - Detect if current test run is under sanitizer - - :return: one of `None`, 'address', 'memory', 'thread', 'undefined' - """ + """ + Detect if current test run is under sanitizer + + :return: one of `None`, 'address', 'memory', 'thread', 'undefined' + """ return _get_ya_plugin_instance().get_context("sanitize") @property diff --git a/library/python/testing/yatest_lib/test_splitter.py b/library/python/testing/yatest_lib/test_splitter.py index acbcd4300e..ba90a47291 100644 --- a/library/python/testing/yatest_lib/test_splitter.py +++ b/library/python/testing/yatest_lib/test_splitter.py @@ -1,50 +1,50 @@ # coding: utf-8 - -import collections - - + +import collections + + def flatten_tests(test_classes): - """ - >>> test_classes = {x: [x] for x in range(5)} + """ + >>> test_classes = {x: [x] for x in range(5)} >>> flatten_tests(test_classes) - [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] - >>> test_classes = {x: [x + 1, x + 2] for x in range(2)} + [(0, 0), (1, 1), (2, 2), (3, 3), (4, 4)] + >>> test_classes = {x: [x + 1, x + 2] for x in range(2)} >>> flatten_tests(test_classes) - [(0, 1), (0, 2), (1, 2), (1, 3)] - """ - tests = [] - for class_name, test_names in test_classes.items(): - tests += [(class_name, test_name) for test_name in test_names] - return tests - - + [(0, 1), (0, 2), (1, 2), (1, 3)] + """ + tests = [] + for class_name, test_names in test_classes.items(): + tests += [(class_name, test_name) for test_name in test_names] + return tests + + def get_sequential_chunk(tests, modulo, modulo_index, is_sorted=False): - """ + """ >>> get_sequential_chunk(range(10), 4, 0) - [0, 1, 2] + [0, 1, 2] >>> get_sequential_chunk(range(10), 4, 1) - [3, 4, 5] + [3, 4, 5] >>> get_sequential_chunk(range(10), 4, 2) [6, 7] >>> get_sequential_chunk(range(10), 4, 3) [8, 9] >>> get_sequential_chunk(range(10), 4, 4) - [] + [] >>> get_sequential_chunk(range(10), 4, 5) - [] - """ + [] + """ if not is_sorted: tests = sorted(tests) chunk_size = len(tests) // modulo not_used = len(tests) % modulo shift = chunk_size + (modulo_index < not_used) start = chunk_size * modulo_index + min(modulo_index, not_used) - end = start + shift + end = start + shift return [] if end > len(tests) else tests[start:end] - - + + def get_shuffled_chunk(tests, modulo, modulo_index, is_sorted=False): - """ + """ >>> get_shuffled_chunk(range(10), 4, 0) [0, 4, 8] >>> get_shuffled_chunk(range(10), 4, 1) @@ -78,25 +78,25 @@ def get_splitted_tests(test_entities, modulo, modulo_index, partition_mode, is_s def filter_tests_by_modulo(test_classes, modulo, modulo_index, split_by_tests, partition_mode="SEQUENTIAL"): """ - >>> test_classes = {x: [x] for x in range(20)} - >>> filter_tests_by_modulo(test_classes, 4, 0, False) - {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]} - >>> filter_tests_by_modulo(test_classes, 4, 1, False) - {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]} - >>> filter_tests_by_modulo(test_classes, 4, 2, False) - {10: [10], 11: [11], 12: [12], 13: [13], 14: [14]} - - >>> dict(filter_tests_by_modulo(test_classes, 4, 0, True)) - {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]} - >>> dict(filter_tests_by_modulo(test_classes, 4, 1, True)) - {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]} - """ - if split_by_tests: + >>> test_classes = {x: [x] for x in range(20)} + >>> filter_tests_by_modulo(test_classes, 4, 0, False) + {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]} + >>> filter_tests_by_modulo(test_classes, 4, 1, False) + {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]} + >>> filter_tests_by_modulo(test_classes, 4, 2, False) + {10: [10], 11: [11], 12: [12], 13: [13], 14: [14]} + + >>> dict(filter_tests_by_modulo(test_classes, 4, 0, True)) + {0: [0], 1: [1], 2: [2], 3: [3], 4: [4]} + >>> dict(filter_tests_by_modulo(test_classes, 4, 1, True)) + {8: [8], 9: [9], 5: [5], 6: [6], 7: [7]} + """ + if split_by_tests: tests = get_splitted_tests(flatten_tests(test_classes), modulo, modulo_index, partition_mode) - test_classes = collections.defaultdict(list) - for class_name, test_name in tests: - test_classes[class_name].append(test_name) - return test_classes - else: + test_classes = collections.defaultdict(list) + for class_name, test_name in tests: + test_classes[class_name].append(test_name) + return test_classes + else: target_classes = get_splitted_tests(test_classes, modulo, modulo_index, partition_mode) - return {class_name: test_classes[class_name] for class_name in target_classes} + return {class_name: test_classes[class_name] for class_name in target_classes} |