aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/testing
diff options
context:
space:
mode:
authorilnurkh <ilnurkh@yandex-team.com>2023-10-09 23:39:40 +0300
committerilnurkh <ilnurkh@yandex-team.com>2023-10-09 23:57:14 +0300
commite601ca03f859335d57ecff2e5aa6af234b6052ed (patch)
treede519a847e58a1b3993fcbfe05ff44cc946a3e24 /library/cpp/testing
parentbbf2b6878af3854815a2c0ecb07a687071787639 (diff)
downloadydb-e601ca03f859335d57ecff2e5aa6af234b6052ed.tar.gz
Y_VERIFY->Y_ABORT_UNLESS at ^l
https://clubs.at.yandex-team.ru/arcadia/29404
Diffstat (limited to 'library/cpp/testing')
-rw-r--r--library/cpp/testing/common/env.cpp2
-rw-r--r--library/cpp/testing/common/network.cpp8
-rw-r--r--library/cpp/testing/unittest/registar.cpp10
-rw-r--r--library/cpp/testing/unittest/utmain.cpp4
4 files changed, 12 insertions, 12 deletions
diff --git a/library/cpp/testing/common/env.cpp b/library/cpp/testing/common/env.cpp
index 6585de8584..13f3f186af 100644
--- a/library/cpp/testing/common/env.cpp
+++ b/library/cpp/testing/common/env.cpp
@@ -110,7 +110,7 @@ const TString& GetTestParam(TStringBuf name, const TString& def) {
const TString& GetGlobalResource(TStringBuf name) {
auto& resources = NPrivate::GetTestEnv().GlobalResources;
auto it = resources.find(name.data());
- Y_VERIFY(it != resources.end());
+ Y_ABORT_UNLESS(it != resources.end());
return it->second;
}
diff --git a/library/cpp/testing/common/network.cpp b/library/cpp/testing/common/network.cpp
index 7a7ff2544c..a1f9f22e5a 100644
--- a/library/cpp/testing/common/network.cpp
+++ b/library/cpp/testing/common/network.cpp
@@ -105,7 +105,7 @@ namespace {
if (!SyncDir_.IsDefined()) {
SyncDir_ = TFsPath(GetSystemTempDir()) / "testing_port_locks";
}
- Y_VERIFY(SyncDir_.IsDefined());
+ Y_ABORT_UNLESS(SyncDir_.IsDefined());
NFs::MakeDirectoryRecursive(SyncDir_);
Ranges_ = GetPortRanges();
@@ -113,7 +113,7 @@ namespace {
for (auto [left, right] : Ranges_) {
TotalCount_ += right - left;
}
- Y_VERIFY(0 != TotalCount_);
+ Y_ABORT_UNLESS(0 != TotalCount_);
DisableRandomPorts_ = !GetEnv("NO_RANDOM_PORTS").empty();
}
@@ -141,7 +141,7 @@ namespace {
}
TVector<NTesting::TPortHolder> GetFreePortsRange(size_t count) const {
- Y_VERIFY(count > 0);
+ Y_ABORT_UNLESS(count > 0);
TVector<NTesting::TPortHolder> ports(Reserve(count));
for (size_t i = 0; i < Retries; ++i) {
for (auto[left, right] : Ranges_) {
@@ -194,7 +194,7 @@ namespace {
TSockAddrInet6 addr("::", port);
if (sock.Bind(&addr) != 0) {
lock->Release();
- Y_VERIFY(EADDRINUSE == LastSystemError(), "unexpected error: %d, port: %d", LastSystemError(), port);
+ Y_ABORT_UNLESS(EADDRINUSE == LastSystemError(), "unexpected error: %d, port: %d", LastSystemError(), port);
return nullptr;
}
return MakeHolder<TPortGuard>(port, std::move(lock));
diff --git a/library/cpp/testing/unittest/registar.cpp b/library/cpp/testing/unittest/registar.cpp
index 4f032fa00b..675d1f6003 100644
--- a/library/cpp/testing/unittest/registar.cpp
+++ b/library/cpp/testing/unittest/registar.cpp
@@ -34,8 +34,8 @@ currentTest;
::NUnitTest::TRaiseErrorHandler RaiseErrorHandler;
void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, bool fatalFailure) {
- Y_VERIFY(UnittestThread, "%s in non-unittest thread with message:\n%s", what, msg.data());
- Y_VERIFY(GetCurrentTest());
+ Y_ABORT_UNLESS(UnittestThread, "%s in non-unittest thread with message:\n%s", what, msg.data());
+ Y_ABORT_UNLESS(GetCurrentTest());
if (RaiseErrorHandler) {
RaiseErrorHandler(what, msg, fatalFailure);
@@ -53,17 +53,17 @@ void ::NUnitTest::NPrivate::RaiseError(const char* what, const TString& msg, boo
}
void ::NUnitTest::SetRaiseErrorHandler(::NUnitTest::TRaiseErrorHandler handler) {
- Y_VERIFY(UnittestThread);
+ Y_ABORT_UNLESS(UnittestThread);
RaiseErrorHandler = std::move(handler);
}
void ::NUnitTest::NPrivate::SetUnittestThread(bool unittestThread) {
- Y_VERIFY(UnittestThread != unittestThread, "state check");
+ Y_ABORT_UNLESS(UnittestThread != unittestThread, "state check");
UnittestThread = unittestThread;
}
void ::NUnitTest::NPrivate::SetCurrentTest(TTestBase* test) {
- Y_VERIFY(!test || !currentTest, "state check");
+ Y_ABORT_UNLESS(!test || !currentTest, "state check");
currentTest = test;
}
diff --git a/library/cpp/testing/unittest/utmain.cpp b/library/cpp/testing/unittest/utmain.cpp
index cae713e3ac..1daabad4b8 100644
--- a/library/cpp/testing/unittest/utmain.cpp
+++ b/library/cpp/testing/unittest/utmain.cpp
@@ -566,7 +566,7 @@ private:
ythrow yexception() << "Forked test finished with unknown status";
}
case TShellCommand::SHELL_RUNNING: {
- Y_VERIFY(false, "This can't happen, we used sync mode, it's a bug!");
+ Y_ABORT_UNLESS(false, "This can't happen, we used sync mode, it's a bug!");
}
case TShellCommand::SHELL_INTERNAL_ERROR: {
ythrow yexception() << "Forked test failed with internal error: " << cmd.GetInternalError();
@@ -706,7 +706,7 @@ int NUnitTest::RunMain(int argc, char** argv) {
memset(&sa, 0, sizeof(sa));
sa.sa_handler = GracefulShutdownHandler;
sa.sa_flags = SA_SIGINFO | SA_RESTART;
- Y_VERIFY(!sigaction(SIGUSR2, &sa, nullptr));
+ Y_ABORT_UNLESS(!sigaction(SIGUSR2, &sa, nullptr));
}
#endif
NTesting::THook::CallBeforeInit();