What? You don’t think Travis can run these fast? 

> On Sep 15, 2017, at 2:07 PM, Galen O'Sullivan <gosulli...@pivotal.io> wrote:
> 
> +1 This is great! I'll take a look at your PR when I get the time.
> 
> We may want to think carefully about how often we run these tests, because
> unlike regular unit tests, they will take forever to run.
> 
> On Fri, Sep 15, 2017 at 1:42 PM, Michael William Dodge <mdo...@pivotal.io>
> wrote:
> 
>> +1 for unit tests for multithreaded code.
>> 
>> High fives to Dan.
>> 
>> Sarge
>> 
>>> On 15 Sep, 2017, at 12:08, Dan Smith <dsm...@pivotal.io> wrote:
>>> 
>>> Hi Geode devs,
>>> 
>>> I've been messing around with an open source tool called Java
>>> Pathfinder for writing tests of multithreaded code. Java Pathfinder is
>>> a special JVM which among other things tries to execute your code
>>> using all possible thread interleavings.
>>> 
>>> I'd like to propose two things:
>>> 
>>> 1) We introduce a framework for writing unit tests of code that is
>>> supposed to be thread safe. This framework should let a developer
>>> easily write a test with multiple things going on in parallel. The
>>> framework can then take that code and try to run it with different
>>> thread interleavings.
>>> 
>>> Here's an example of what this could look like:
>>> 
>>> @RunWith(ConcurrentTestRunner.class)
>>> public class AtomicIntegerTest {
>>> 
>>> @Test
>>> public void parallelIncrementReturns2(ParallelExecutor executor)
>>>     throws ExecutionException, InterruptedException {
>>>   AtomicInteger atomicInteger = new AtomicInteger();
>>>   executor.inParallel(() -> atomicInteger.incrementAndGet());
>>>   executor.inParallel(() -> atomicInteger.incrementAndGet());
>>>   executor.execute();
>>>   assertEquals(2, atomicInteger.get());
>>> }
>>> 
>>> 
>>> 2) We implement this framework initially using Java Pathfinder, but
>>> allow for other methods of testing the code to be plugged in for
>>> example just running the test in the loop. Java pathfinder is cool
>>> because it can run the code with different interleavings but it does
>>> have some serious limitations.
>>> 
>>> I've put together some code for this proposal which is available in
>>> this github PR:
>>> 
>>> https://github.com/apache/geode/pull/787
>>> 
>>> What do you think?
>>> 
>>> -Dan
>> 
>> 

Reply via email to