MCPcopy Create free account
hub / github.com/catboost/catboost / DoTestJoin

Function DoTestJoin

library/cpp/coroutine/engine/coroutine_ut.cpp:363–435  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361 };
362
363 void DoTestJoin(EContPoller pollerType) {
364 auto poller = IPollerFace::Construct(pollerType);
365
366 if (!poller) {
367 return;
368 }
369
370 TContExecutor e(32000, std::move(poller));
371
372 TPipe in, out;
373 TPipe::Pipe(in, out);
374 SetNonBlock(in.GetHandle());
375
376 {
377 TSleepCont sc = {TInstant::Max(), 0};
378 TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(sc, "sc"), true};
379
380 e.Execute(jc);
381
382 UNIT_ASSERT_EQUAL(sc.Result, ECANCELED);
383 UNIT_ASSERT_EQUAL(jc.Result, false);
384 }
385
386 {
387 TSleepCont sc = {TDuration::MilliSeconds(100).ToDeadLine(), 0};
388 TJoinCont jc = {TDuration::MilliSeconds(200).ToDeadLine(), e.Create(sc, "sc"), false};
389
390 e.Execute(jc);
391
392 UNIT_ASSERT_EQUAL(sc.Result, ETIMEDOUT);
393 UNIT_ASSERT_EQUAL(jc.Result, true);
394 }
395
396 {
397 TSleepCont sc = {TDuration::MilliSeconds(200).ToDeadLine(), 0};
398 TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(sc, "sc"), true};
399
400 e.Execute(jc);
401
402 UNIT_ASSERT_EQUAL(sc.Result, ECANCELED);
403 UNIT_ASSERT_EQUAL(jc.Result, false);
404 }
405
406 {
407 TReadCont rc = {TInstant::Max(), in.GetHandle(), 0};
408 TJoinCont jc = {TDuration::MilliSeconds(100).ToDeadLine(), e.Create(rc, "rc"), true};
409
410 e.Execute(jc);
411
412 UNIT_ASSERT_EQUAL(rc.Result, ECANCELED);
413 UNIT_ASSERT_EQUAL(jc.Result, false);
414 }
415
416 {
417 TReadCont rc = {TDuration::MilliSeconds(100).ToDeadLine(), in.GetHandle(), 0};
418 TJoinCont jc = {TDuration::MilliSeconds(200).ToDeadLine(), e.Create(rc, "rc"), false};
419
420 e.Execute(jc);

Callers 5

TestJoinDefaultMethod · 0.85
TestJoinEpollMethod · 0.85
TestJoinKqueueMethod · 0.85
TestJoinPollMethod · 0.85
TestJoinSelectMethod · 0.85

Calls 9

SetNonBlockFunction · 0.85
MilliSecondsFunction · 0.85
ToDeadLineMethod · 0.80
ConstructFunction · 0.50
moveFunction · 0.50
MaxFunction · 0.50
GetHandleMethod · 0.45
CreateMethod · 0.45
ExecuteMethod · 0.45

Tested by 5

TestJoinDefaultMethod · 0.68
TestJoinEpollMethod · 0.68
TestJoinKqueueMethod · 0.68
TestJoinPollMethod · 0.68
TestJoinSelectMethod · 0.68