-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
THRIFT-5794: Add tests #2999
THRIFT-5794: Add tests #2999
Conversation
…ound and continue search Windows copmmand "where" errors when thrift-binary is not found in PATH. This will cause MSBuild to abort instead of searching in alternative paths. So just ignore potential erros and make it go on. Adapt this also for Unix "which", so we don't need to suppress the returncode.
It will not be found without this and causes na error and abort.
When using these changes it turns out that the netstd-test failing after removing the "net8" option from calling the compiler I can see this when runnig localy and a also in GithubActions (using #2998)
I'm not that deep in C# and test-code at all, to debug this/fix. Maybe this fail should become a new Issue (to be treated by anyone with the power/access to Jira). |
…g Net8/C#12 for PublicInterfaces.Compile.Tests
680f210
to
d6ca283
Compare
Add a project which is a copy of the PublicInterfaces.Compile.Tests, but use the "net8" compiler option to generate code that uses C#12-features. Use the thrift-files from the existing test, to avoid code-duplication. This is effectively the tests that are run till v0.20.0.
d6ca283
to
cbefe2e
Compare
The idea was not to rewrite the whole thing. The net8 option is very deliberately placed there. |
I occasionally think about making the last release the default (currently net8) and putting older versions under a suffix instead. But especially for netstd 2 this would be sort of awkward. |
I initially started with a separate thrift-file for that case (f7cda29, 4f252f4), but realized that the Thrift-5794 also applies to the existing sourcefiles. For that reason I came up with that "large change" version. Idea behind it was to use default compiler option in favor of specific ones. And use explicit options only where needed (like the net8/C#12 tests-folder). I'm aware, that this solution adds more files that need to be maintained, slightly increases complexity but also gives some better test-coverage. As both version for the test are around for review and @Jens-G prefers the "separate tests-file" version for the project, I'm fine. For that reason I made small commits to allow cherry-picking. I hope you was able to make use of it for PR #3000.
Is that the reason, which causes the "Test_Complex_DeepCopy" to fail with non net8/net6?
C#12 by default would break our (legacy) project and we would need to have a "legacy" option when compiling. |
Both net6 and net8 are not simply some arbitrary compiler options. These directly affect some important settings and assumptions, e.g. how to treat nullable references to name just one. You cannot simply switch those options blindly and hope all will be fine. The options should match the target environment or you will indeed "find errors" that don't exist.
I'd propose to compare the generated code for each option and/or looking at the code generator.
I'm fine with adding tests. I'm not fine with "improving" working tests to the point where there are broken. We encourage to contribute patches, but everybody should be aware that - like in any other FOSS project - patches will be reviewed, change-requested, modified and occasionally this involves many hours of back and forth until it gets finally accepted (or rejected). Some patches get accepted, some debated, some rejected. That's how it works. As a rule of thumb, smaller and more concise patches generally have a better chance of getting through - simply because review is easier.
Exactly what I meant by "awkward". |
I'm aware of the principle of code-changes for open projects. There is a change-idea, that gets written down and discussed by project members.
From this comment I see, that it's not surprising that the "Test_Complex_DeepCopy" will fail when not using net8. As @Jens-G is more deep in the project and code, I'm fine with this and consider this seen test-fail as "Works as designed". |
But look like Github PR #3008 / THRIFT-5798 is picking up the idea of this PR with some more large changes, that I tries to avoid initially. |
Based on Thrift5794 I worked on improving CI-testing for netstd. As sideeffect I found, that the thrift-exe is not found on windows, which is fixed by commit
To address Thrift5794 this PR switches to use default C# languagelevel for the
Thrift.PublicInterfaces.Compile.Tests
(dropping "net8" option from calling the compiler). To keep testing with "net8 / C#12" a 2nd projectThrift.PublicInterfaces.Compile-C#12.Tests
is added, which keeps using the "net8" option.The Thrift-files are shared between both projects, to reduce amount of duplicated code.
Alternative ways I tried/had in mind: