The Inbox: KernelTests-jar.406.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Inbox: KernelTests-jar.406.mcz

commits-2
A new version of KernelTests was added to project The Inbox:
http://source.squeak.org/inbox/KernelTests-jar.406.mcz

==================== Summary ====================

Name: KernelTests-jar.406
Author: jar
Time: 24 May 2021, 11:02:39.394885 pm
UUID: 08657090-5a49-f84b-904f-8a37f5f2ec75
Ancestors: KernelTests-jar.405

Test a situation when a process terminating another process is terminated in the middle of the unwind. make sure both processes are unwound correctly.

=============== Diff against KernelTests-jar.405 ===============

Item was added:
+ ----- Method: ProcessTest>>testTerminateInTerminate (in category 'tests') -----
+ testTerminateInTerminate
+ "Terminating a terminator process should unwind both the terminator and its terminatee process"
+
+ | terminator terminatee unwound |
+ unwound := false.
+ terminatee := [[Processor activeProcess suspend] ensure: [unwound := true]] fork.
+ Processor yield.
+ terminator := [terminatee terminate] newProcess.
+ self assert: terminatee isSuspended.
+ self assert: terminator isSuspended.
+ terminator runUntil: [:ctx | ctx selectorToSendOrSelf = #suspend]. "first #suspend in #terminate"
+ self assert: terminator isSuspended.
+ terminator terminate.
+ self assert: terminator isTerminated.
+ self assert: unwound!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: KernelTests-jar.406.mcz

Christoph Thiede
Hi Jaromir,

thanks for writing these tests! Just a few comments here:

- #testTerminateInEnsure uses underscore assignments. This is a deprecated syntax and apparently, in current Trunk images even disabled by default. Without turning on my #allowUnderscoreAsAssignment preference, I cannot even run the test in my image. Could you please convert this to modern `:=` assignments?

- Also, there is no guarantee that in #testTerminateInEnsure, process will not have completed earlier, is it? This totally depends on the speed & implementation of the VM. We don't want this test to fail when running on a NSA machine or on your coffee machine in 2050, do we? ;P Did you consider using semaphores instead? :-)

- #testTerminateInTerminate is very fancy. :D

Best,
Christoph

Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: KernelTests-jar.406.mcz

Jaromir Matas
Hi Christoph,


Christoph Thiede wrote
> Hi Jaromir,
>
> thanks for writing these tests! Just a few comments here:
>
> - #testTerminateInEnsure uses underscore assignments. This is a deprecated
> syntax and apparently, in current Trunk images even disabled by default.
> Without turning on my #allowUnderscoreAsAssignment preference, I cannot
> even run the test in my image. Could you please convert this to modern
> `:=` assignments?

Thanks for noticing! That's a shame ;) I must have uploaded the original
Cuis version I was testing (Juan brought my attention to the test). I'm
testing #terminate in parallel in both Squeak and Cuis to catch potential
irregularities (unfortunately Pharo diverged a bit too much for an "easy"
parallel implementation).


Christoph Thiede wrote
> - Also, there is no guarantee that in #testTerminateInEnsure, process will
> not have completed earlier, is it? This totally depends on the speed &
> implementation of the VM. We don't want this test to fail when running on
> a NSA machine or on your coffee machine in 2050, do we? ;P Did you
> consider using semaphores instead? :-)

This is the original Martin McClure's test, I didn't do any refinements yet
but I share your concerns ;)

Christoph Thiede wrote
> - #testTerminateInTerminate is very fancy. :D

Well, it gave me a real scare when I realized what happens when termination
is interrupted and terminated in the middle. Fortunately the fix is so easy
:)

Thanks very much for your comments,
best,

> Best,
> Christoph






-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

^[^ Jaromir
Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: KernelTests-jar.406.mcz

David T. Lewis
Hi Jaromir,

On Sat, May 29, 2021 at 02:34:13AM -0500, Jaromir Matas wrote:

> Hi Christoph,
>
>
> Christoph Thiede wrote
> > Hi Jaromir,
> >
> > thanks for writing these tests! Just a few comments here:
> >
> > - #testTerminateInEnsure uses underscore assignments. This is a deprecated
> > syntax and apparently, in current Trunk images even disabled by default.
> > Without turning on my #allowUnderscoreAsAssignment preference, I cannot
> > even run the test in my image. Could you please convert this to modern
> > `:=` assignments?
>
> Thanks for noticing! That's a shame ;) I must have uploaded the original
> Cuis version I was testing (Juan brought my attention to the test). I'm
> testing #terminate in parallel in both Squeak and Cuis to catch potential
> irregularities (unfortunately Pharo diverged a bit too much for an "easy"
> parallel implementation).
>

You may not need it for the work you are doing, but it is worth knowing
that the FixUnderscores utility can be used for updating from _ to :=
assignments without losing the original author stamps.

You can find it on SqueakMap. From the world menu, open a SqueakMap
Catalog browser. Right-click on the left side panel and de-select the
"New safely-available packages" box. Scroll down the long list of
packages until you find FixUnderscores. Install version 1.0, and ignore
any warnings about compatibility.

Once installed you can use the FixUnderscores>>fixPackage: method to
update the underscores in an given package.

For moving code the other way from Squeak to Cuis, you can use any
convenient text editor (such as vi on unix) to replace all occurencees
of := with _. You also will want to convert <cr> to <lf> line endings
for Cuis conventions, which you can do with unix sed or directly in
the Cuis file browser before filing in the code.

Dave
 

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: KernelTests-jar.406.mcz

Jaromir Matas
Hi David,


David T. Lewis wrote

> Hi Jaromir,
>
> On Sat, May 29, 2021 at 02:34:13AM -0500, Jaromir Matas wrote:
>> Hi Christoph,
>>
>>
>> Christoph Thiede wrote
>> > Hi Jaromir,
>> >
>> > thanks for writing these tests! Just a few comments here:
>> >
>> > - #testTerminateInEnsure uses underscore assignments. This is a
>> deprecated
>> > syntax and apparently, in current Trunk images even disabled by
>> default.
>> > Without turning on my #allowUnderscoreAsAssignment preference, I cannot
>> > even run the test in my image. Could you please convert this to modern
>> > `:=` assignments?
>>
>> Thanks for noticing! That's a shame ;) I must have uploaded the original
>> Cuis version I was testing (Juan brought my attention to the test). I'm
>> testing #terminate in parallel in both Squeak and Cuis to catch potential
>> irregularities (unfortunately Pharo diverged a bit too much for an "easy"
>> parallel implementation).
>>
>
> You may not need it for the work you are doing, but it is worth knowing
> that the FixUnderscores utility can be used for updating from _ to :=
> assignments without losing the original author stamps.
>
> You can find it on SqueakMap. From the world menu, open a SqueakMap
> Catalog browser. Right-click on the left side panel and de-select the
> "New safely-available packages" box. Scroll down the long list of
> packages until you find FixUnderscores. Install version 1.0, and ignore
> any warnings about compatibility.
>
> Once installed you can use the FixUnderscores>>fixPackage: method to
> update the underscores in an given package.
>
> For moving code the other way from Squeak to Cuis, you can use any
> convenient text editor (such as vi on unix) to replace all occurencees
> of := with _. You also will want to convert
> <cr>
>  to
> <lf>
>  line endings
> for Cuis conventions, which you can do with unix sed or directly in
> the Cuis file browser before filing in the code.
>
> Dave

Cool, thanks! (and thanks, Vanessa)

I now see Squeak automatically replaces underscores in the copy/pasted or
filed-in code - but only for viewing; the source still contains the original
underscores (that's why I unwittingly uploaded the test with
underscores...). I've now tried to file-in with underscores -> see := in the
browser -> file out and underscores still there.

So the tool really comes in handy here and preserving the original
author/timestamp is cool too. Thanks again.
best,



-----
^[^ Jaromir
--
Sent from: http://forum.world.st/Squeak-Dev-f45488.html

^[^ Jaromir