-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
C#: Dotnet test tracer improvements. #13387
Conversation
9a98e98
to
2ab5f41
Compare
1210544
to
3eb3178
Compare
Co-authored-by: Michael B. Gale <[email protected]>
@@ -48,6 +49,14 @@ function RegisterExtractorPack(id) | |||
dotnetRunNeedsSeparator = true | |||
dotnetRunInjectionIndex = i + 1 | |||
end | |||
if arg == 'test' then | |||
testMatch = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about
- adding
match = true
here, - remove
and not testMatch
on line 38, - replace
testMatch = false
on line 58 withmatch = false; break
, and - replace
match or testMatch
on line 74 withmatch
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we can also do that if we accept that the change also applies to dotnet run
. It appears that dotnet run
can also be invoked with a dll
or exe
file, but in this case we don't get a failure if the -p:UseSharedCompilation=false
is provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So dotnet run
when provided a dll or exe will not do any compilation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I was maybe not clear: I intended to keep the testMatch
variable, so specifically on this line it would say
testMatch = true
match = true
and then keep the check if testMatch and (arg:match('%.exe$') or arg:match('%.dll'))
instead of just if arg:match('%.exe$') or arg:match('%.dll')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So
dotnet run
when provided a dll or exe will not do any compilation?
By closer inspection, that part is actually unclear as it is not documented as a part of dotnet run
.
We will make sure to narrow the fix such that it only applies to dotnet test
(which was a misunderstanding between @hvitved and me)
c7ddf46
to
f9c890b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some high-level suggestions.
csharp/tools/tracing-config.lua
Outdated
match = true | ||
end | ||
-- for `dotnet test`, we should not append `-p:UseSharedCompilation=false` to the command line | ||
-- if a library or executable is being provided as an argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good comment. It would be useful to include why: the arguments get passed in this case to vstest
rather than msbuild
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense - I will extended the description and state that when an exe or dll is provided the call is forwarded to vstest
. Thank you!
check_diagnostics() | ||
|
||
# Explicitly build and then run tests. | ||
run_codeql_database_create(['dotnet clean', 'rm -rf test-db', 'dotnet build -o myout', 'dotnet test myout/dotnet_test.dll'], test_db="test2-db", lang="csharp") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it feasible to have a similar test with .exe
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will make another test.
@@ -48,6 +49,14 @@ function RegisterExtractorPack(id) | |||
dotnetRunNeedsSeparator = true | |||
dotnetRunInjectionIndex = i + 1 | |||
end | |||
if arg == 'test' then | |||
testMatch = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So dotnet run
when provided a dll or exe will not do any compilation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do a DCA run before merging.
Yes. I also want to add another test - working on it right now. |
… get the UseSharedCompilation=false flag forwarded.
7c15302
to
2fece9d
Compare
Yes, I will start it now. |
--- | ||
category: minorAnalysis | ||
--- | ||
* C#: Analysis of the `dotnet test` command supplied with a `dll` or `exe` file as argument no longer fails due to the addition of an erroneous `-p:SharedCompilation=false` argument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be -p:UseSharedCompilation
not -p:SharedCompilation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, thank you!!!
Will be fixed here: #13440
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The release process has already been started, so we can't update the change note (since it is only a minor inaccuracy we don't want to stop the release to incorporate the change note modification).
Closing the related PR.
Which release this fix will be in? We are still seeing issue in our pipelines. |
This should be in release 2.13.4. Is that the one you are using? |
@michaelnebel - Thank you. I will check the version we are using and figure out upgrade path. |
It turns out that the the tracer (unconditionally) injects the property
-p:UseSharedCompilation=false
whendotnet test
is executed.However, if the
dotnet test
is applied to a library or executable it results in adotnet
error, when the property is set is added as it is not valid in this context.In this PR we update the LUA tracer code, such that
-p:UseSharedCompilation=false
is not injected whendotnet test
is applied to a library or executable.