void GitCloneAndBuild(ExplorationTestDescription testDescription) { if (Framework != null && !testDescription.IsFrameworkSupported(Framework)) { throw new InvalidOperationException($"The framework '{Framework}' is not listed in the project's target frameworks of {testDescription.Name}"); } var depth = testDescription.IsGitShallowCloneSupported ? "--depth 1" : ""; var submodules = testDescription.IsGitSubmodulesRequired ? "--recurse-submodules" : ""; var source = ExplorationTestCloneLatest ? testDescription.GitRepositoryUrl : $"-b {testDescription.GitRepositoryTag} {testDescription.GitRepositoryUrl}"; var target = $"{ExplorationTestsDirectory}/{testDescription.Name}"; var cloneCommand = $"clone -q -c advice.detachedHead=false {depth} {submodules} {source} {target}"; GitTasks.Git(cloneCommand); var projectPath = $"{ExplorationTestsDirectory}/{testDescription.Name}/{testDescription.PathToUnitTestProject}"; if (!Directory.Exists(projectPath)) { throw new DirectoryNotFoundException($"Test path '{projectPath}' doesn't exist."); } DotNetBuild( x => x .SetProjectFile(projectPath) .SetConfiguration(BuildConfiguration) .SetProcessArgumentConfigurator(arguments => arguments.Add("-consoleLoggerParameters:ErrorsOnly")) .When(Framework != null, settings => settings.SetFramework(Framework)) ); }
void RunUnitTest(ExplorationTestDescription testDescription, Dictionary <string, string> envVariables) { Logger.Info($"Running exploration test {testDescription.Name}."); if (Framework != null && !testDescription.IsFrameworkSupported(Framework)) { throw new InvalidOperationException($"The framework '{Framework}' is not listed in the project's target frameworks of {testDescription.Name}"); } DotNetTest( x => { x = x .SetProjectFile(testDescription.GetTestTargetPath(ExplorationTestsDirectory, Framework, BuildConfiguration)) .EnableNoRestore() .EnableNoBuild() .SetConfiguration(BuildConfiguration) .When(Framework != null, settings => settings.SetFramework(Framework)) .SetProcessEnvironmentVariables(envVariables) .SetIgnoreFilter(testDescription.TestsToIgnore) .WithMemoryDumpAfter(1) ; return(x); }); }
void GitCloneBuild() { if (ExplorationTestName.HasValue) { Logger.Info($"Provided exploration test name is {ExplorationTestName}."); var testDescription = ExplorationTestDescription.GetExplorationTestDescription(ExplorationTestName.Value); GitCloneAndBuild(testDescription); } else { Logger.Info($"Exploration test name is not provided. Running all of them."); foreach (var testDescription in ExplorationTestDescription.GetAllExplorationTestDescriptions()) { GitCloneAndBuild(testDescription); } } }
void RunExplorationTestsGitUnitTest(Dictionary <string, string> envVariables) { if (ExplorationTestName.HasValue) { Logger.Info($"Provided exploration test name is {ExplorationTestName}."); var testDescription = ExplorationTestDescription.GetExplorationTestDescription(ExplorationTestName.Value); RunUnitTest(testDescription, envVariables); } else { Logger.Info($"Exploration test name is not provided. Running all."); foreach (var testDescription in ExplorationTestDescription.GetAllExplorationTestDescriptions()) { RunUnitTest(testDescription, envVariables); } } }