Bug 1354599

Summary: RFE activate the tests during the package build
Product: [Fedora] Fedora Reporter: Timotheus Pokorra <pokorra.mailinglists>
Component: newtonsoft-jsonAssignee: Timotheus Pokorra <mailinglists>
Status: ASSIGNED --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: rawhideCC: mailinglists, projects.rg
Target Milestone: ---Keywords: FutureFeature, Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-09-02 20:52:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1366713    
Bug Blocks:    
Attachments:
Description Flags
adding reference to NUnit
none
log of the failing unit tests none

Description Timotheus Pokorra 2016-07-11 16:28:59 UTC
Created attachment 1178482 [details]
adding reference to NUnit

first to say: I don't know if it is necessary to build the tests.

Related to comment in spec file: FIXME tests need xunit (not packaged yet)

I just tried that it works with nunit (see attached patch), and xunit is not really needed as far as I can see.

There are still other errors though...

DemoTests.cs(28,14): error CS0234: The type or namespace name `Buffers' does not exist in the namespace `System'. Are you missing an assembly reference?
Utilities/DateTimeUtilsTests.cs(56,24): error CS0122: `Newtonsoft.Json.Utilities.StringReference' is inaccessible due to its protection level

Comment 1 Raphael Groner 2016-08-30 22:53:44 UTC
Do we need nunit (currently version 3.4) or the nunit2 compatibility package?

Comment 2 Timotheus Pokorra 2016-09-01 21:35:19 UTC
I found one solution, to build not the Newtonsoft.Json.Tests.csproj but Newtonsoft.Json.Tests.Net40.csproj instead. This resolves already a number of issues.

But then there is still that error "is inaccessible due to its protection level".
I can replace all internal with public, but that is quite strange. 
I wonder if that ever can compile on .Net 4.x. By definition, if a struct or class is internal, it can only be accessed within the assembly (https://msdn.microsoft.com/library/7c5ka91b.aspx). I will ask upstream.

Comment 4 Timotheus Pokorra 2016-09-02 06:45:50 UTC
ok, the NewtonSoft.Json.Tests.dll now compiles, and I get the result of the tests:

Tests run: 2314, Errors: 10, Failures: 7, Inconclusive: 0, Time: 12.1892758 seconds
  Not run: 1, Invalid: 0, Ignored: 1, Skipped: 0

I therefore have not enabled the tests yet, but committed the fixes for the tests dll to build.

Comment 5 Timotheus Pokorra 2016-09-02 06:47:03 UTC
Created attachment 1197053 [details]
log of the failing unit tests

Comment 6 Timotheus Pokorra 2016-09-02 20:52:27 UTC
Thanks Raphael for the link on IRC to http://pkgs.fedoraproject.org/cgit/rpms/sharpziplib.git/tree/sharpziplib.spec#n89

I have now disabled the 17 tests that failed or had an error.

I also switched from NUnit2 to NUnit3.

Comment 7 Timotheus Pokorra 2016-09-02 21:08:51 UTC
actually, when I run the tests with nunit3-console, I get:

1) Invalid : /root/rpmbuild/BUILD/Newtonsoft.Json-9.0.1/Src/Newtonsoft.Json.Tests/bin/Release/Net40/Newtonsoft.Json.Tests.dll
No suitable tests found in '/root/rpmbuild/BUILD/Newtonsoft.Json-9.0.1/Src/Newtonsoft.Json.Tests/bin/Release/Net40/Newtonsoft.Json.Tests.dll'.
Either assembly contains no tests or proper test driver has not been found.

I need to look at this another day. I wonder if this is a packaging bug in the nunit package.

Comment 8 Raphael Groner 2016-09-03 07:51:42 UTC
Maybe some API thingy. IMHO, we should keep going with nunit2 for now.