[squeak-dev] [Question/Bug] SUnit CodeCoverage uses #valueUnpreemptively

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Thu Apr 9 13:33:11 UTC 2020


Hi all,


I have a question regarding to the implementation of TestRunner >> #collectCoverageFor:. Why does it use #valueUnpreemptively during running the coverage tests?


I found two major disadvantages of using #valueUnpreemptively in the TestRunner:


  1.  You cannot interrupt the system via cmd+dot if you lose your patience to wait for all tests to complete.

  2.  In addition, I found a quite interesting bug that makes your image unusable if you do the following:


TestCase subclass: #MyTestCase

instanceVariableNames: ''

classVariableNames: ''

poolDictionaries: ''

category: 'UserObjects'.

MyTestCase compile: 'testTimeout

[] repeat'.

TestRunner openForSuite: MyTestCase suite.

"Now press 'Run coverage' abd choose any non-empty package."


The coverage test will never end!

#valueUnpreemptively's comment says that you should use it very carefully, what makes absolutely sense to me, and it has only two senders in the Trunk at all (the second one is ClassBuilder >> #update:to:).

Why should it be necessary to use it in the TestRunner? Because we replace CompiledMethods? That's nothing WrappedBreakpoint wouldn't do, too. I replaced #valueUnpreemptively in this method by a normal #value in my image and the world did not end - thanks to dynamic forwarding, I could even keep browsing the patched methods. However, I admit it would not be a good idea to recompile any method during the coverage tests are running. (We could also use some property like Class >> #beLocked to avoid this, hypothetically).


I am looking forward to your advice.


Best,

Christoph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200409/88e6df26/attachment.html>


More information about the Squeak-dev mailing list