You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by Itamar Syn-Hershko <it...@code972.com> on 2014/08/05 02:32:39 UTC

Re: [3/4] git commit: Bypassing NRE in RandomizedContext

Michael, can you please have a look at this?

AtLeast() seem to have never worked due to an NRE in the randomized context
you recently ported

https://github.com/apache/lucene.net/commit/23d1c0ac8604157b5975db4a8b34ac388b67c982

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Author of RavenDB in Action <http://manning.com/synhershko/>


On Tue, Aug 5, 2014 at 3:29 AM, <sy...@apache.org> wrote:

> Bypassing NRE in RandomizedContext
>
>
> Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
> Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/27d435b5
> Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/27d435b5
> Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/27d435b5
>
> Branch: refs/heads/branch_4x
> Commit: 27d435b561aa6ba50038d265e0ca4f2802336725
> Parents: bd24ffc
> Author: Itamar Syn-Hershko <it...@code972.com>
> Authored: Tue Aug 5 03:25:53 2014 +0300
> Committer: Itamar Syn-Hershko <it...@code972.com>
> Committed: Tue Aug 5 03:25:53 2014 +0300
>
> ----------------------------------------------------------------------
>  test/test-framework/LuceneTestCase.cs               | 3 ++-
>  test/test-framework/Randomized/RandomizedContext.cs | 7 ++-----
>  2 files changed, 4 insertions(+), 6 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/LuceneTestCase.cs
> ----------------------------------------------------------------------
> diff --git a/test/test-framework/LuceneTestCase.cs
> b/test/test-framework/LuceneTestCase.cs
> index 8586c9c..0460700 100644
> --- a/test/test-framework/LuceneTestCase.cs
> +++ b/test/test-framework/LuceneTestCase.cs
> @@ -557,7 +557,8 @@ namespace Lucene.Net
>
>          public static int AtLeast(int minimum)
>          {
> -            return AtLeast(RandomizedContext.Current.Random, minimum);
> +            return AtLeast(new Random(), minimum);
> +            //return AtLeast(RandomizedContext.Current.Random, minimum);
>          }
>
>          /// <summary>
>
>
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/Randomized/RandomizedContext.cs
> ----------------------------------------------------------------------
> diff --git a/test/test-framework/Randomized/RandomizedContext.cs
> b/test/test-framework/Randomized/RandomizedContext.cs
> index 69567be..9a8cad2 100644
> --- a/test/test-framework/Randomized/RandomizedContext.cs
> +++ b/test/test-framework/Randomized/RandomizedContext.cs
> @@ -46,7 +46,7 @@ namespace Lucene.Net.Randomized
>          private readonly ThreadGroup threadGroup;
>          private Type suiteClass;
>          private volatile Boolean isDisposed = false;
> -        private RandomizedRunner runner;
> +        private readonly RandomizedRunner runner;
>
>          public Type GetTargetType
>          {
> @@ -167,11 +167,8 @@ namespace Lucene.Net.Randomized
>              }
>          }
>
> -
> -
>          public void Dispose()
> -        {
> -            throw new NotImplementedException();
> +        {
>          }
>      }
>  }
>
>

Re: [3/4] git commit: Bypassing NRE in RandomizedContext

Posted by michael herndon <mh...@michaelherndon.com>.
The solutions are in the build folder due to folder re-org based on an
established consensus on the mailing list.  The solutions in the those
folders are what other committers will most likely use till a new consensus
is established.

Feel free to rip out the randomized code.  I will be working on the PCL
branch.



On Tue, Aug 5, 2014 at 4:38 PM, Itamar Syn-Hershko <it...@code972.com>
wrote:

> Please see the latest codebase - I've moved the sln files to the root of
> the repo to avoid those type of issues. Let's continue this path instead of
> trying to bend nuget, as nuget can get kinda stiff
>
> My point with the randomized code - it's obviously broken, so if you can
> complete development on a feature branch and merge it when it's ready that
> would be best, instead of putting it on the v4 master branch.
>
> On that note, I'm looking into ways of running the carrotsearch testing
> framework directly from .NET instead of porting it, I hope to have more
> news soon
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko>
> Freelance Developer & Consultant
> Author of RavenDB in Action <http://manning.com/synhershko/>
>
>
> On Tue, Aug 5, 2014 at 10:57 PM, michael herndon <
> mherndon@michaelherndon.com> wrote:
>
> > The package folder changes occur because of NuGet and the various
> Solution
> > files found under root/build/vs[year].
> >
> > I've add a NuGet.config file in the root so that all the solutions files
> > will use the same packages folder going forward.  There are some previous
> > versions of NuGet that ignore this setting.
> >
> > The randomized code is not finished.  There is now a stop gap measure to
> > use the RandomizeContext  instance for AtLeast.  Another possible short
> > term workaround would be to use a ThreadLocal<Random>.
> >
> > -M
> >
> >
> > On Tue, Aug 5, 2014 at 2:41 PM, Itamar Syn-Hershko <it...@code972.com>
> > wrote:
> >
> > > The problem isn't with AtLeast, it's with the randomized context thing.
> > It
> > > just isn't initialized properly or something. Can you uncomment
> > >
> > >
> >
> https://github.com/apache/lucene.net/commit/27d435b561aa6ba50038d265e0ca4f2802336725#diff-0
> > > and try run the tests at TestArrayUtil.cs, you should see the failures.
> > >
> > > Also, can you revert this change please:
> > >
> > > -    <Reference Include="nunit.framework, Version=2.6.3.13283,
> > > Culture=neutral, PublicKeyToken=96d09a1eb7f44a77,
> > > processorArchitecture=MSIL">
> > > -      <SpecificVersion>False</SpecificVersion>
> > > -
> > >
>  <HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
> > > +    <Reference Include="nunit.framework">
> > > +
> > >
> >
>  <HintPath>..\..\build\vs2013\test\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
> > >      </Reference>
> > >
> > > (in Lucene.Net.Test.csproj)
> > >
> > > We should use Nuget for managing dependencies, and this is just adding
> > > friction
> > >
> > > Thanks
> > >
> > > --
> > >
> > > Itamar Syn-Hershko
> > > http://code972.com | @synhershko <https://twitter.com/synhershko>
> > > Freelance Developer & Consultant
> > > Author of RavenDB in Action <http://manning.com/synhershko/>
> > >
> > >
> > > On Tue, Aug 5, 2014 at 9:30 PM, michael herndon <
> > > mherndon@michaelherndon.com
> > > > wrote:
> > >
> > > > I pulled down the code into a new folder just to ensure I didn’t
> have a
> > > > mismatch in files between local and remote.
> > > >
> > > > Then I created a test case for AtLeast which passes on my local
> > machine.
> > > >
> > > > Tested with:
> > > >
> > > >    -
> > > >
> > > >    Visual Studio 2013
> > > >     -
> > > >
> > > >    NUnit GUI
> > > >     - NUnit Visual Studio Test Adapter.
> > > >
> > > > Are there any differences in setup or how the tests are being
> executed?
> > > >
> > > > There is an AssertionException for ByteRefStore, but I did not get a
> > Null
> > > > Reference Exception.
> > > >
> > > > NUnit Results
> > > >
> > > >
> > >
> >
> https://onedrive.live.com/redir?resid=3B3E28D66F984FD1!8686&authkey=!AMvqg3UFWlXirgg&v=3&ithint=photo%2cjpg
> > > > ​
> > > >
> > > >
> > > > On Mon, Aug 4, 2014 at 8:32 PM, Itamar Syn-Hershko <
> itamar@code972.com
> > >
> > > > wrote:
> > > >
> > > > > Michael, can you please have a look at this?
> > > > >
> > > > > AtLeast() seem to have never worked due to an NRE in the randomized
> > > > context
> > > > > you recently ported
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/apache/lucene.net/commit/23d1c0ac8604157b5975db4a8b34ac388b67c982
> > > > >
> > > > > --
> > > > >
> > > > > Itamar Syn-Hershko
> > > > > http://code972.com | @synhershko <https://twitter.com/synhershko>
> > > > > Freelance Developer & Consultant
> > > > > Author of RavenDB in Action <http://manning.com/synhershko/>
> > > > >
> > > > >
> > > > > On Tue, Aug 5, 2014 at 3:29 AM, <sy...@apache.org> wrote:
> > > > >
> > > > > > Bypassing NRE in RandomizedContext
> > > > > >
> > > > > >
> > > > > > Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
> > > > > > Commit:
> > > > http://git-wip-us.apache.org/repos/asf/lucenenet/commit/27d435b5
> > > > > > Tree:
> > http://git-wip-us.apache.org/repos/asf/lucenenet/tree/27d435b5
> > > > > > Diff:
> > http://git-wip-us.apache.org/repos/asf/lucenenet/diff/27d435b5
> > > > > >
> > > > > > Branch: refs/heads/branch_4x
> > > > > > Commit: 27d435b561aa6ba50038d265e0ca4f2802336725
> > > > > > Parents: bd24ffc
> > > > > > Author: Itamar Syn-Hershko <it...@code972.com>
> > > > > > Authored: Tue Aug 5 03:25:53 2014 +0300
> > > > > > Committer: Itamar Syn-Hershko <it...@code972.com>
> > > > > > Committed: Tue Aug 5 03:25:53 2014 +0300
> > > > > >
> > > > > >
> > > ----------------------------------------------------------------------
> > > > > >  test/test-framework/LuceneTestCase.cs               | 3 ++-
> > > > > >  test/test-framework/Randomized/RandomizedContext.cs | 7 ++-----
> > > > > >  2 files changed, 4 insertions(+), 6 deletions(-)
> > > > > >
> > > ----------------------------------------------------------------------
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/LuceneTestCase.cs
> > > > > >
> > > ----------------------------------------------------------------------
> > > > > > diff --git a/test/test-framework/LuceneTestCase.cs
> > > > > > b/test/test-framework/LuceneTestCase.cs
> > > > > > index 8586c9c..0460700 100644
> > > > > > --- a/test/test-framework/LuceneTestCase.cs
> > > > > > +++ b/test/test-framework/LuceneTestCase.cs
> > > > > > @@ -557,7 +557,8 @@ namespace Lucene.Net
> > > > > >
> > > > > >          public static int AtLeast(int minimum)
> > > > > >          {
> > > > > > -            return AtLeast(RandomizedContext.Current.Random,
> > > minimum);
> > > > > > +            return AtLeast(new Random(), minimum);
> > > > > > +            //return AtLeast(RandomizedContext.Current.Random,
> > > > minimum);
> > > > > >          }
> > > > > >
> > > > > >          /// <summary>
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/Randomized/RandomizedContext.cs
> > > > > >
> > > ----------------------------------------------------------------------
> > > > > > diff --git a/test/test-framework/Randomized/RandomizedContext.cs
> > > > > > b/test/test-framework/Randomized/RandomizedContext.cs
> > > > > > index 69567be..9a8cad2 100644
> > > > > > --- a/test/test-framework/Randomized/RandomizedContext.cs
> > > > > > +++ b/test/test-framework/Randomized/RandomizedContext.cs
> > > > > > @@ -46,7 +46,7 @@ namespace Lucene.Net.Randomized
> > > > > >          private readonly ThreadGroup threadGroup;
> > > > > >          private Type suiteClass;
> > > > > >          private volatile Boolean isDisposed = false;
> > > > > > -        private RandomizedRunner runner;
> > > > > > +        private readonly RandomizedRunner runner;
> > > > > >
> > > > > >          public Type GetTargetType
> > > > > >          {
> > > > > > @@ -167,11 +167,8 @@ namespace Lucene.Net.Randomized
> > > > > >              }
> > > > > >          }
> > > > > >
> > > > > > -
> > > > > > -
> > > > > >          public void Dispose()
> > > > > > -        {
> > > > > > -            throw new NotImplementedException();
> > > > > > +        {
> > > > > >          }
> > > > > >      }
> > > > > >  }
> > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
>

Re: [3/4] git commit: Bypassing NRE in RandomizedContext

Posted by Itamar Syn-Hershko <it...@code972.com>.
Please see the latest codebase - I've moved the sln files to the root of
the repo to avoid those type of issues. Let's continue this path instead of
trying to bend nuget, as nuget can get kinda stiff

My point with the randomized code - it's obviously broken, so if you can
complete development on a feature branch and merge it when it's ready that
would be best, instead of putting it on the v4 master branch.

On that note, I'm looking into ways of running the carrotsearch testing
framework directly from .NET instead of porting it, I hope to have more
news soon

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Author of RavenDB in Action <http://manning.com/synhershko/>


On Tue, Aug 5, 2014 at 10:57 PM, michael herndon <
mherndon@michaelherndon.com> wrote:

> The package folder changes occur because of NuGet and the various Solution
> files found under root/build/vs[year].
>
> I've add a NuGet.config file in the root so that all the solutions files
> will use the same packages folder going forward.  There are some previous
> versions of NuGet that ignore this setting.
>
> The randomized code is not finished.  There is now a stop gap measure to
> use the RandomizeContext  instance for AtLeast.  Another possible short
> term workaround would be to use a ThreadLocal<Random>.
>
> -M
>
>
> On Tue, Aug 5, 2014 at 2:41 PM, Itamar Syn-Hershko <it...@code972.com>
> wrote:
>
> > The problem isn't with AtLeast, it's with the randomized context thing.
> It
> > just isn't initialized properly or something. Can you uncomment
> >
> >
> https://github.com/apache/lucene.net/commit/27d435b561aa6ba50038d265e0ca4f2802336725#diff-0
> > and try run the tests at TestArrayUtil.cs, you should see the failures.
> >
> > Also, can you revert this change please:
> >
> > -    <Reference Include="nunit.framework, Version=2.6.3.13283,
> > Culture=neutral, PublicKeyToken=96d09a1eb7f44a77,
> > processorArchitecture=MSIL">
> > -      <SpecificVersion>False</SpecificVersion>
> > -
> >  <HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
> > +    <Reference Include="nunit.framework">
> > +
> >
>  <HintPath>..\..\build\vs2013\test\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
> >      </Reference>
> >
> > (in Lucene.Net.Test.csproj)
> >
> > We should use Nuget for managing dependencies, and this is just adding
> > friction
> >
> > Thanks
> >
> > --
> >
> > Itamar Syn-Hershko
> > http://code972.com | @synhershko <https://twitter.com/synhershko>
> > Freelance Developer & Consultant
> > Author of RavenDB in Action <http://manning.com/synhershko/>
> >
> >
> > On Tue, Aug 5, 2014 at 9:30 PM, michael herndon <
> > mherndon@michaelherndon.com
> > > wrote:
> >
> > > I pulled down the code into a new folder just to ensure I didn’t have a
> > > mismatch in files between local and remote.
> > >
> > > Then I created a test case for AtLeast which passes on my local
> machine.
> > >
> > > Tested with:
> > >
> > >    -
> > >
> > >    Visual Studio 2013
> > >     -
> > >
> > >    NUnit GUI
> > >     - NUnit Visual Studio Test Adapter.
> > >
> > > Are there any differences in setup or how the tests are being executed?
> > >
> > > There is an AssertionException for ByteRefStore, but I did not get a
> Null
> > > Reference Exception.
> > >
> > > NUnit Results
> > >
> > >
> >
> https://onedrive.live.com/redir?resid=3B3E28D66F984FD1!8686&authkey=!AMvqg3UFWlXirgg&v=3&ithint=photo%2cjpg
> > > ​
> > >
> > >
> > > On Mon, Aug 4, 2014 at 8:32 PM, Itamar Syn-Hershko <itamar@code972.com
> >
> > > wrote:
> > >
> > > > Michael, can you please have a look at this?
> > > >
> > > > AtLeast() seem to have never worked due to an NRE in the randomized
> > > context
> > > > you recently ported
> > > >
> > > >
> > > >
> > >
> >
> https://github.com/apache/lucene.net/commit/23d1c0ac8604157b5975db4a8b34ac388b67c982
> > > >
> > > > --
> > > >
> > > > Itamar Syn-Hershko
> > > > http://code972.com | @synhershko <https://twitter.com/synhershko>
> > > > Freelance Developer & Consultant
> > > > Author of RavenDB in Action <http://manning.com/synhershko/>
> > > >
> > > >
> > > > On Tue, Aug 5, 2014 at 3:29 AM, <sy...@apache.org> wrote:
> > > >
> > > > > Bypassing NRE in RandomizedContext
> > > > >
> > > > >
> > > > > Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
> > > > > Commit:
> > > http://git-wip-us.apache.org/repos/asf/lucenenet/commit/27d435b5
> > > > > Tree:
> http://git-wip-us.apache.org/repos/asf/lucenenet/tree/27d435b5
> > > > > Diff:
> http://git-wip-us.apache.org/repos/asf/lucenenet/diff/27d435b5
> > > > >
> > > > > Branch: refs/heads/branch_4x
> > > > > Commit: 27d435b561aa6ba50038d265e0ca4f2802336725
> > > > > Parents: bd24ffc
> > > > > Author: Itamar Syn-Hershko <it...@code972.com>
> > > > > Authored: Tue Aug 5 03:25:53 2014 +0300
> > > > > Committer: Itamar Syn-Hershko <it...@code972.com>
> > > > > Committed: Tue Aug 5 03:25:53 2014 +0300
> > > > >
> > > > >
> > ----------------------------------------------------------------------
> > > > >  test/test-framework/LuceneTestCase.cs               | 3 ++-
> > > > >  test/test-framework/Randomized/RandomizedContext.cs | 7 ++-----
> > > > >  2 files changed, 4 insertions(+), 6 deletions(-)
> > > > >
> > ----------------------------------------------------------------------
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/LuceneTestCase.cs
> > > > >
> > ----------------------------------------------------------------------
> > > > > diff --git a/test/test-framework/LuceneTestCase.cs
> > > > > b/test/test-framework/LuceneTestCase.cs
> > > > > index 8586c9c..0460700 100644
> > > > > --- a/test/test-framework/LuceneTestCase.cs
> > > > > +++ b/test/test-framework/LuceneTestCase.cs
> > > > > @@ -557,7 +557,8 @@ namespace Lucene.Net
> > > > >
> > > > >          public static int AtLeast(int minimum)
> > > > >          {
> > > > > -            return AtLeast(RandomizedContext.Current.Random,
> > minimum);
> > > > > +            return AtLeast(new Random(), minimum);
> > > > > +            //return AtLeast(RandomizedContext.Current.Random,
> > > minimum);
> > > > >          }
> > > > >
> > > > >          /// <summary>
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/Randomized/RandomizedContext.cs
> > > > >
> > ----------------------------------------------------------------------
> > > > > diff --git a/test/test-framework/Randomized/RandomizedContext.cs
> > > > > b/test/test-framework/Randomized/RandomizedContext.cs
> > > > > index 69567be..9a8cad2 100644
> > > > > --- a/test/test-framework/Randomized/RandomizedContext.cs
> > > > > +++ b/test/test-framework/Randomized/RandomizedContext.cs
> > > > > @@ -46,7 +46,7 @@ namespace Lucene.Net.Randomized
> > > > >          private readonly ThreadGroup threadGroup;
> > > > >          private Type suiteClass;
> > > > >          private volatile Boolean isDisposed = false;
> > > > > -        private RandomizedRunner runner;
> > > > > +        private readonly RandomizedRunner runner;
> > > > >
> > > > >          public Type GetTargetType
> > > > >          {
> > > > > @@ -167,11 +167,8 @@ namespace Lucene.Net.Randomized
> > > > >              }
> > > > >          }
> > > > >
> > > > > -
> > > > > -
> > > > >          public void Dispose()
> > > > > -        {
> > > > > -            throw new NotImplementedException();
> > > > > +        {
> > > > >          }
> > > > >      }
> > > > >  }
> > > > >
> > > > >
> > > >
> > >
> >
>

Re: [3/4] git commit: Bypassing NRE in RandomizedContext

Posted by michael herndon <mh...@michaelherndon.com>.
The package folder changes occur because of NuGet and the various Solution
files found under root/build/vs[year].

I've add a NuGet.config file in the root so that all the solutions files
will use the same packages folder going forward.  There are some previous
versions of NuGet that ignore this setting.

The randomized code is not finished.  There is now a stop gap measure to
use the RandomizeContext  instance for AtLeast.  Another possible short
term workaround would be to use a ThreadLocal<Random>.

-M


On Tue, Aug 5, 2014 at 2:41 PM, Itamar Syn-Hershko <it...@code972.com>
wrote:

> The problem isn't with AtLeast, it's with the randomized context thing. It
> just isn't initialized properly or something. Can you uncomment
>
> https://github.com/apache/lucene.net/commit/27d435b561aa6ba50038d265e0ca4f2802336725#diff-0
> and try run the tests at TestArrayUtil.cs, you should see the failures.
>
> Also, can you revert this change please:
>
> -    <Reference Include="nunit.framework, Version=2.6.3.13283,
> Culture=neutral, PublicKeyToken=96d09a1eb7f44a77,
> processorArchitecture=MSIL">
> -      <SpecificVersion>False</SpecificVersion>
> -
>  <HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
> +    <Reference Include="nunit.framework">
> +
>  <HintPath>..\..\build\vs2013\test\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
>      </Reference>
>
> (in Lucene.Net.Test.csproj)
>
> We should use Nuget for managing dependencies, and this is just adding
> friction
>
> Thanks
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko>
> Freelance Developer & Consultant
> Author of RavenDB in Action <http://manning.com/synhershko/>
>
>
> On Tue, Aug 5, 2014 at 9:30 PM, michael herndon <
> mherndon@michaelherndon.com
> > wrote:
>
> > I pulled down the code into a new folder just to ensure I didn’t have a
> > mismatch in files between local and remote.
> >
> > Then I created a test case for AtLeast which passes on my local machine.
> >
> > Tested with:
> >
> >    -
> >
> >    Visual Studio 2013
> >     -
> >
> >    NUnit GUI
> >     - NUnit Visual Studio Test Adapter.
> >
> > Are there any differences in setup or how the tests are being executed?
> >
> > There is an AssertionException for ByteRefStore, but I did not get a Null
> > Reference Exception.
> >
> > NUnit Results
> >
> >
> https://onedrive.live.com/redir?resid=3B3E28D66F984FD1!8686&authkey=!AMvqg3UFWlXirgg&v=3&ithint=photo%2cjpg
> > ​
> >
> >
> > On Mon, Aug 4, 2014 at 8:32 PM, Itamar Syn-Hershko <it...@code972.com>
> > wrote:
> >
> > > Michael, can you please have a look at this?
> > >
> > > AtLeast() seem to have never worked due to an NRE in the randomized
> > context
> > > you recently ported
> > >
> > >
> > >
> >
> https://github.com/apache/lucene.net/commit/23d1c0ac8604157b5975db4a8b34ac388b67c982
> > >
> > > --
> > >
> > > Itamar Syn-Hershko
> > > http://code972.com | @synhershko <https://twitter.com/synhershko>
> > > Freelance Developer & Consultant
> > > Author of RavenDB in Action <http://manning.com/synhershko/>
> > >
> > >
> > > On Tue, Aug 5, 2014 at 3:29 AM, <sy...@apache.org> wrote:
> > >
> > > > Bypassing NRE in RandomizedContext
> > > >
> > > >
> > > > Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
> > > > Commit:
> > http://git-wip-us.apache.org/repos/asf/lucenenet/commit/27d435b5
> > > > Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/27d435b5
> > > > Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/27d435b5
> > > >
> > > > Branch: refs/heads/branch_4x
> > > > Commit: 27d435b561aa6ba50038d265e0ca4f2802336725
> > > > Parents: bd24ffc
> > > > Author: Itamar Syn-Hershko <it...@code972.com>
> > > > Authored: Tue Aug 5 03:25:53 2014 +0300
> > > > Committer: Itamar Syn-Hershko <it...@code972.com>
> > > > Committed: Tue Aug 5 03:25:53 2014 +0300
> > > >
> > > >
> ----------------------------------------------------------------------
> > > >  test/test-framework/LuceneTestCase.cs               | 3 ++-
> > > >  test/test-framework/Randomized/RandomizedContext.cs | 7 ++-----
> > > >  2 files changed, 4 insertions(+), 6 deletions(-)
> > > >
> ----------------------------------------------------------------------
> > > >
> > > >
> > > >
> > > >
> > >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/LuceneTestCase.cs
> > > >
> ----------------------------------------------------------------------
> > > > diff --git a/test/test-framework/LuceneTestCase.cs
> > > > b/test/test-framework/LuceneTestCase.cs
> > > > index 8586c9c..0460700 100644
> > > > --- a/test/test-framework/LuceneTestCase.cs
> > > > +++ b/test/test-framework/LuceneTestCase.cs
> > > > @@ -557,7 +557,8 @@ namespace Lucene.Net
> > > >
> > > >          public static int AtLeast(int minimum)
> > > >          {
> > > > -            return AtLeast(RandomizedContext.Current.Random,
> minimum);
> > > > +            return AtLeast(new Random(), minimum);
> > > > +            //return AtLeast(RandomizedContext.Current.Random,
> > minimum);
> > > >          }
> > > >
> > > >          /// <summary>
> > > >
> > > >
> > > >
> > >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/Randomized/RandomizedContext.cs
> > > >
> ----------------------------------------------------------------------
> > > > diff --git a/test/test-framework/Randomized/RandomizedContext.cs
> > > > b/test/test-framework/Randomized/RandomizedContext.cs
> > > > index 69567be..9a8cad2 100644
> > > > --- a/test/test-framework/Randomized/RandomizedContext.cs
> > > > +++ b/test/test-framework/Randomized/RandomizedContext.cs
> > > > @@ -46,7 +46,7 @@ namespace Lucene.Net.Randomized
> > > >          private readonly ThreadGroup threadGroup;
> > > >          private Type suiteClass;
> > > >          private volatile Boolean isDisposed = false;
> > > > -        private RandomizedRunner runner;
> > > > +        private readonly RandomizedRunner runner;
> > > >
> > > >          public Type GetTargetType
> > > >          {
> > > > @@ -167,11 +167,8 @@ namespace Lucene.Net.Randomized
> > > >              }
> > > >          }
> > > >
> > > > -
> > > > -
> > > >          public void Dispose()
> > > > -        {
> > > > -            throw new NotImplementedException();
> > > > +        {
> > > >          }
> > > >      }
> > > >  }
> > > >
> > > >
> > >
> >
>

Re: [3/4] git commit: Bypassing NRE in RandomizedContext

Posted by Itamar Syn-Hershko <it...@code972.com>.
The problem isn't with AtLeast, it's with the randomized context thing. It
just isn't initialized properly or something. Can you uncomment
https://github.com/apache/lucene.net/commit/27d435b561aa6ba50038d265e0ca4f2802336725#diff-0
and try run the tests at TestArrayUtil.cs, you should see the failures.

Also, can you revert this change please:

-    <Reference Include="nunit.framework, Version=2.6.3.13283,
Culture=neutral, PublicKeyToken=96d09a1eb7f44a77,
processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
+    <Reference Include="nunit.framework">
+      <HintPath>..\..\build\vs2013\test\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
     </Reference>

(in Lucene.Net.Test.csproj)

We should use Nuget for managing dependencies, and this is just adding
friction

Thanks

--

Itamar Syn-Hershko
http://code972.com | @synhershko <https://twitter.com/synhershko>
Freelance Developer & Consultant
Author of RavenDB in Action <http://manning.com/synhershko/>


On Tue, Aug 5, 2014 at 9:30 PM, michael herndon <mherndon@michaelherndon.com
> wrote:

> I pulled down the code into a new folder just to ensure I didn’t have a
> mismatch in files between local and remote.
>
> Then I created a test case for AtLeast which passes on my local machine.
>
> Tested with:
>
>    -
>
>    Visual Studio 2013
>     -
>
>    NUnit GUI
>     - NUnit Visual Studio Test Adapter.
>
> Are there any differences in setup or how the tests are being executed?
>
> There is an AssertionException for ByteRefStore, but I did not get a Null
> Reference Exception.
>
> NUnit Results
>
> https://onedrive.live.com/redir?resid=3B3E28D66F984FD1!8686&authkey=!AMvqg3UFWlXirgg&v=3&ithint=photo%2cjpg
> ​
>
>
> On Mon, Aug 4, 2014 at 8:32 PM, Itamar Syn-Hershko <it...@code972.com>
> wrote:
>
> > Michael, can you please have a look at this?
> >
> > AtLeast() seem to have never worked due to an NRE in the randomized
> context
> > you recently ported
> >
> >
> >
> https://github.com/apache/lucene.net/commit/23d1c0ac8604157b5975db4a8b34ac388b67c982
> >
> > --
> >
> > Itamar Syn-Hershko
> > http://code972.com | @synhershko <https://twitter.com/synhershko>
> > Freelance Developer & Consultant
> > Author of RavenDB in Action <http://manning.com/synhershko/>
> >
> >
> > On Tue, Aug 5, 2014 at 3:29 AM, <sy...@apache.org> wrote:
> >
> > > Bypassing NRE in RandomizedContext
> > >
> > >
> > > Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
> > > Commit:
> http://git-wip-us.apache.org/repos/asf/lucenenet/commit/27d435b5
> > > Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/27d435b5
> > > Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/27d435b5
> > >
> > > Branch: refs/heads/branch_4x
> > > Commit: 27d435b561aa6ba50038d265e0ca4f2802336725
> > > Parents: bd24ffc
> > > Author: Itamar Syn-Hershko <it...@code972.com>
> > > Authored: Tue Aug 5 03:25:53 2014 +0300
> > > Committer: Itamar Syn-Hershko <it...@code972.com>
> > > Committed: Tue Aug 5 03:25:53 2014 +0300
> > >
> > > ----------------------------------------------------------------------
> > >  test/test-framework/LuceneTestCase.cs               | 3 ++-
> > >  test/test-framework/Randomized/RandomizedContext.cs | 7 ++-----
> > >  2 files changed, 4 insertions(+), 6 deletions(-)
> > > ----------------------------------------------------------------------
> > >
> > >
> > >
> > >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/LuceneTestCase.cs
> > > ----------------------------------------------------------------------
> > > diff --git a/test/test-framework/LuceneTestCase.cs
> > > b/test/test-framework/LuceneTestCase.cs
> > > index 8586c9c..0460700 100644
> > > --- a/test/test-framework/LuceneTestCase.cs
> > > +++ b/test/test-framework/LuceneTestCase.cs
> > > @@ -557,7 +557,8 @@ namespace Lucene.Net
> > >
> > >          public static int AtLeast(int minimum)
> > >          {
> > > -            return AtLeast(RandomizedContext.Current.Random, minimum);
> > > +            return AtLeast(new Random(), minimum);
> > > +            //return AtLeast(RandomizedContext.Current.Random,
> minimum);
> > >          }
> > >
> > >          /// <summary>
> > >
> > >
> > >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/Randomized/RandomizedContext.cs
> > > ----------------------------------------------------------------------
> > > diff --git a/test/test-framework/Randomized/RandomizedContext.cs
> > > b/test/test-framework/Randomized/RandomizedContext.cs
> > > index 69567be..9a8cad2 100644
> > > --- a/test/test-framework/Randomized/RandomizedContext.cs
> > > +++ b/test/test-framework/Randomized/RandomizedContext.cs
> > > @@ -46,7 +46,7 @@ namespace Lucene.Net.Randomized
> > >          private readonly ThreadGroup threadGroup;
> > >          private Type suiteClass;
> > >          private volatile Boolean isDisposed = false;
> > > -        private RandomizedRunner runner;
> > > +        private readonly RandomizedRunner runner;
> > >
> > >          public Type GetTargetType
> > >          {
> > > @@ -167,11 +167,8 @@ namespace Lucene.Net.Randomized
> > >              }
> > >          }
> > >
> > > -
> > > -
> > >          public void Dispose()
> > > -        {
> > > -            throw new NotImplementedException();
> > > +        {
> > >          }
> > >      }
> > >  }
> > >
> > >
> >
>

Re: [3/4] git commit: Bypassing NRE in RandomizedContext

Posted by michael herndon <mh...@michaelherndon.com>.
I pulled down the code into a new folder just to ensure I didn’t have a
mismatch in files between local and remote.

Then I created a test case for AtLeast which passes on my local machine.

Tested with:

   -

   Visual Studio 2013
    -

   NUnit GUI
    - NUnit Visual Studio Test Adapter.

Are there any differences in setup or how the tests are being executed?

There is an AssertionException for ByteRefStore, but I did not get a Null
Reference Exception.

NUnit Results
https://onedrive.live.com/redir?resid=3B3E28D66F984FD1!8686&authkey=!AMvqg3UFWlXirgg&v=3&ithint=photo%2cjpg
​


On Mon, Aug 4, 2014 at 8:32 PM, Itamar Syn-Hershko <it...@code972.com>
wrote:

> Michael, can you please have a look at this?
>
> AtLeast() seem to have never worked due to an NRE in the randomized context
> you recently ported
>
>
> https://github.com/apache/lucene.net/commit/23d1c0ac8604157b5975db4a8b34ac388b67c982
>
> --
>
> Itamar Syn-Hershko
> http://code972.com | @synhershko <https://twitter.com/synhershko>
> Freelance Developer & Consultant
> Author of RavenDB in Action <http://manning.com/synhershko/>
>
>
> On Tue, Aug 5, 2014 at 3:29 AM, <sy...@apache.org> wrote:
>
> > Bypassing NRE in RandomizedContext
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/27d435b5
> > Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/27d435b5
> > Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/27d435b5
> >
> > Branch: refs/heads/branch_4x
> > Commit: 27d435b561aa6ba50038d265e0ca4f2802336725
> > Parents: bd24ffc
> > Author: Itamar Syn-Hershko <it...@code972.com>
> > Authored: Tue Aug 5 03:25:53 2014 +0300
> > Committer: Itamar Syn-Hershko <it...@code972.com>
> > Committed: Tue Aug 5 03:25:53 2014 +0300
> >
> > ----------------------------------------------------------------------
> >  test/test-framework/LuceneTestCase.cs               | 3 ++-
> >  test/test-framework/Randomized/RandomizedContext.cs | 7 ++-----
> >  2 files changed, 4 insertions(+), 6 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/LuceneTestCase.cs
> > ----------------------------------------------------------------------
> > diff --git a/test/test-framework/LuceneTestCase.cs
> > b/test/test-framework/LuceneTestCase.cs
> > index 8586c9c..0460700 100644
> > --- a/test/test-framework/LuceneTestCase.cs
> > +++ b/test/test-framework/LuceneTestCase.cs
> > @@ -557,7 +557,8 @@ namespace Lucene.Net
> >
> >          public static int AtLeast(int minimum)
> >          {
> > -            return AtLeast(RandomizedContext.Current.Random, minimum);
> > +            return AtLeast(new Random(), minimum);
> > +            //return AtLeast(RandomizedContext.Current.Random, minimum);
> >          }
> >
> >          /// <summary>
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/lucenenet/blob/27d435b5/test/test-framework/Randomized/RandomizedContext.cs
> > ----------------------------------------------------------------------
> > diff --git a/test/test-framework/Randomized/RandomizedContext.cs
> > b/test/test-framework/Randomized/RandomizedContext.cs
> > index 69567be..9a8cad2 100644
> > --- a/test/test-framework/Randomized/RandomizedContext.cs
> > +++ b/test/test-framework/Randomized/RandomizedContext.cs
> > @@ -46,7 +46,7 @@ namespace Lucene.Net.Randomized
> >          private readonly ThreadGroup threadGroup;
> >          private Type suiteClass;
> >          private volatile Boolean isDisposed = false;
> > -        private RandomizedRunner runner;
> > +        private readonly RandomizedRunner runner;
> >
> >          public Type GetTargetType
> >          {
> > @@ -167,11 +167,8 @@ namespace Lucene.Net.Randomized
> >              }
> >          }
> >
> > -
> > -
> >          public void Dispose()
> > -        {
> > -            throw new NotImplementedException();
> > +        {
> >          }
> >      }
> >  }
> >
> >
>