chore(test): Allow running tests with epoll proactor (#364)

This commit is contained in:
Roman Gershman 2022-10-06 19:09:52 +03:00 committed by GitHub
parent d93eb8a5b5
commit fbdfe5885a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -24,7 +24,7 @@ cxx_link(dragonfly_lib dfly_transaction dfly_facade redis_lib strings_lib html_l
absl::random_random TRDP::jsoncons)
add_library(dfly_test_lib test_utils.cc)
cxx_link(dfly_test_lib dragonfly_lib facade_test gtest_main_ext)
cxx_link(dfly_test_lib dragonfly_lib epoll_fiber_lib facade_test gtest_main_ext)
cxx_test(dragonfly_test dfly_test_lib LABELS DFLY)
cxx_test(generic_family_test dfly_test_lib LABELS DFLY)

View File

@ -17,10 +17,13 @@ extern "C" {
#include "base/stl_util.h"
#include "facade/dragonfly_connection.h"
#include "util/uring/uring_pool.h"
#include "util/epoll/epoll_pool.h"
using namespace std;
ABSL_DECLARE_FLAG(string, dbfilename);
ABSL_FLAG(bool, force_epoll, false, "If true, uses epoll api instead iouring to run tests");
namespace dfly {
@ -123,7 +126,11 @@ void BaseFamilyTest::SetUpTestSuite() {
}
void BaseFamilyTest::SetUp() {
pp_.reset(new uring::UringPool(16, num_threads_));
if (absl::GetFlag(FLAGS_force_epoll)) {
pp_.reset(new epoll::EpollPool(num_threads_));
} else {
pp_.reset(new uring::UringPool(16, num_threads_));
}
pp_->Run();
service_.reset(new Service{pp_.get()});