test: fix epollex error when some Linus versions don't contain that engine
@@ -34,19 +34,28 @@ pub use macros::*;
pub use security::*;
pub fn setup_for_ci() {
- if env::var("CI").is_ok() && env::var("LOG_FILE").is_ok() {
+ if env::var("CI").is_ok() {
+ if env::var("LOG_FILE").is_ok() {
logging::init_log_for_test();
}
+
+ // HACK! Use `epollex` as the polling engine for gRPC when running CI tests on
+ // Linux and it hasn't been set before.
+ // See more: https://github.com/grpc/grpc/blob/v1.17.2/src/core/lib/iomgr/ev_posix.cc#L124
+ // See more: https://grpc.io/grpc/core/md_doc_core_grpc-polling-engines.html
+ #[cfg(target_os = "linux")]
+ {
+ if env::var("GRPC_POLL_STRATEGY").is_err() {
+ env::set_var("GRPC_POLL_STRATEGY", "epollex");
+ }
+ }
+ }
+
if env::var("PANIC_ABORT").is_ok() {
// Panics as aborts, it's helpful for debugging,
// but also stops tests immediately.
tikv::util::set_panic_hook(true, "./");
}
- // HACK! Always use epollex in tests on Linux.
- // See more: https://github.com/grpc/grpc/blob/v1.17.2/src/core/lib/iomgr/ev_posix.cc#L124
- #[cfg(target_os = "linux")]
- env::set_var("GRPC_POLL_STRATEGY", "epollex");
-
tikv::util::check_environment_variables();
}
