-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow toolset that tests run against to be controlled by command-line options #1674
Conversation
@tannergooding please review this change and validate that it does not break onboarding repotoolset. |
build/Targets/Test.targets
Outdated
@@ -9,7 +9,7 @@ | |||
</PropertyGroup> | |||
|
|||
<ItemGroup Condition="'$(OutputType)' == 'Exe' "> | |||
<Compile Include="$(MSBuildThisFileDirectory)TestProgram.cs" /> | |||
<Compile Include="$(MSBuildThisFileDirectory)TestProgram.cs" Visible="false" /> |
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.
I don't think this should be 'Visible=false'
It is nice to be able to view this file and open it from within VS.
|
||
class Program | ||
{ | ||
public static int Main(string[] args) | ||
{ | ||
var newArgs = args.ToList(); | ||
newArgs.Insert(0, typeof(Program).Assembly.Location); | ||
var newArgs = TestCommandLine.HandleCommandLine(args, out bool showHelp); |
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.
I think Environment.GetCommandLineArgs()
achieves the same thing and would work here.
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.
LGTM. I was about to do something similar to finish resolving the hard coded dependency that the tests had.
There will be some minimal conflicts, but they should be easy for me to resolve.
…not using repo version
c22ab54
to
259a032
Compare
|
||
namespace Microsoft.NET.TestFramework | ||
{ | ||
public class TestCommandLine |
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 name the file TestCommandLine.Default.cs instead of NOPCommandLine.cs
get | ||
{ | ||
return Path.Combine(TestContext.Current.TestExecutionDirectory, | ||
TestDirectoriesNamePrefix + NuGetSharedDirectoryNamePostfix); |
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.
It's unfortunately pervasive in CLI/SDK code to do stuff like this in property getters, but we shouldn't produce fresh strings on every property access. If I review calling code that calls this more than once, I'm not going to imagine that to be problematic, because it looks like field access. Now, this is test code, so my care factor is not high, but it's something that I'm going to be pushing back on in product code.
throw new InvalidOperationException("Path to nuget.exe not set"); | ||
} | ||
|
||
SdkCommandSpec ret = new SdkCommandSpec() |
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.
nit: var since type is obvious
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.
Also, can we name this spec
instead of ret
.
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.
You have ret
all over the place. I won't comment on all of them, but I'd prefer readable names.
|
||
public string WorkingDirectory { get; set; } | ||
|
||
string EscapeArgs() |
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.
private static
|
||
public ProcessStartInfo ToProcessStartInfo() | ||
{ | ||
ProcessStartInfo ret = new ProcessStartInfo(); |
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.
var info
public ICommand ToCommand() | ||
{ | ||
var commandSpec = new CommandSpec(FileName, EscapeArgs(), CommandResolutionStrategy.Path); | ||
ICommand ret = Command.Create(commandSpec); |
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.
command
} | ||
} | ||
|
||
|
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.
extra whitespace
Is this currently blocked on anything? I need this to go in to finish up the repo-toolset changes. |
…727.15 (#1674) [main] Update dependencies from dotnet/arcade
bin\Debug\Tests
) and theTestAssets
folder to another machine and run the tests there.