Opened 13 months ago

Closed 5 months ago

#4688 closed change (fixed)

Get rid of long (forever) blocking operations in tests

Reported by: sergz Assignee:
Priority: P3 Milestone:
Module: Libadblockplus Keywords:
Cc: fhd, oleksandr, asmirnov, eric@… Blocked By:
Blocking: #3595, #5198 Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29367522/
https://codereview.adblockplus.org/29435645/

Description

Background

In tests we have many Lazy* classes which block a background thread. To achieve #3595 we need to make changes to have a way to finish all background threads withing a reasonable time span.

What to change

One possible way to achieve it is to introduce and mock in tests asynchronous interfaces for WebRequest, FileSystem and for timers. Implementation of this interfaces should work with threads or with some asynchronous API and to avoid race conditions the lifetime of them should be managed by JsEngine.

Change History (7)

comment:1 Changed 12 months ago by eric@…

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 12 months ago by eric@…

The solution in https://codereview.adblockplus.org/29367522/ is to explicitly block on a condition variable where the infinite loop once was, then to unblock it in a TearDown() function, after the test body has completed. This preserves the existing test behavior insofar as the test body is concerned, but improves the overall performance by allowing those threads to finish.

comment:3 Changed 8 months ago by sergz

  • Blocking 5198 added

comment:4 Changed 7 months ago by sergz

  • Review URL(s) modified (diff)

comment:5 Changed 7 months ago by abpbot

A commit referencing this issue has landed:
Issue 4688 - stop using of LazyWebRequest in tests/UpdateCheck.cpp

comment:6 Changed 7 months ago by sergz

  • Blocking 3593 removed

comment:7 Changed 5 months ago by sergz

  • Resolution set to fixed
  • Status changed from reviewing to closed

Basically there are no "long (forever) blocking operations in tests", so the issue can be closed.

Note: See TracTickets for help on using tickets.