public void DeviceDebug() { var sln = Path.Combine(Configuration.SourceRoot, "tests", "sampletester", "BaselineTest", "BaselineTest.sln"); GitHub.CleanRepository(Path.GetDirectoryName(sln)); ProcessHelper.BuildSolution(sln, "iPhone", "Debug", SampleTester.GetEnvironmentVariables(TestPlatform.iOS), SampleTester.DefaultTimeout); }
public void DeviceDebug() { var sln = Path.Combine(Configuration.SourceRoot, "tests", "sampletester", "BaselineTest", "BaselineTest.sln"); GitHub.CleanRepository(Path.GetDirectoryName(sln)); ProcessHelper.BuildSolution(sln, "iPhone", "Debug", new Dictionary <string, string> (), SampleTester.DefaultTimeout); }
public void BuildSample([ValueSource("GetSampleData")] SampleTestData sampleTestData) { try { var data = sampleTestData.SampleTest; if (!string.IsNullOrEmpty(data.KnownFailure)) { Assert.Ignore(data.KnownFailure); } var environment_variables = new Dictionary <string, string> (); environment_variables ["MD_APPLE_SDK_ROOT"] = Path.GetDirectoryName(Path.GetDirectoryName(Configuration.XcodeLocation)); switch (data.Project.Platform) { case TestPlatform.iOS: case TestPlatform.tvOS: case TestPlatform.watchOS: environment_variables ["MD_MTOUCH_SDK_ROOT"] = Path.Combine(Configuration.IOS_DESTDIR, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current"); environment_variables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine(Configuration.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); environment_variables ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine(Configuration.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); break; case TestPlatform.macOS: environment_variables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine(Configuration.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); environment_variables ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine(Configuration.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); environment_variables ["XamarinMacFrameworkRoot"] = Path.Combine(Configuration.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); environment_variables ["XAMMAC_FRAMEWORK_PATH"] = Path.Combine(Configuration.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); break; default: throw new NotImplementedException(sampleTestData.Platform.ToString()); } var file_to_build = sampleTestData.SampleTest.Project.RelativePath; var target = string.Empty; if (data.BuildSolution) { file_to_build = data.Solution; target = Path.GetFileNameWithoutExtension(data.Project.RelativePath).Replace('.', '_'); } file_to_build = Path.Combine(CloneRepo(), file_to_build); ProcessHelper.BuildSolution(file_to_build, sampleTestData.Platform, sampleTestData.Configuration, environment_variables, target); Console.WriteLine("✅ {0} succeeded.", TestContext.CurrentContext.Test.FullName); } catch (Exception e) { Console.WriteLine("❌ {0} failed: {1}", TestContext.CurrentContext.Test.FullName, e.Message); throw; } }
public void BuildSample([ValueSource("GetSampleData")] SampleTestData sampleTestData) { try { var data = sampleTestData.SampleTest; if (!string.IsNullOrEmpty(data.KnownFailure)) { Assert.Ignore(data.KnownFailure); } switch (data.Project.Platform) { case TestPlatform.iOS: if (!Configuration.include_ios) { Assert.Ignore("iOS support has been disabled."); } break; case TestPlatform.tvOS: if (!Configuration.include_tvos) { Assert.Ignore("tvOS support has been disabled"); } break; case TestPlatform.watchOS: if (!Configuration.include_watchos) { Assert.Ignore("watchOS support has been disabled"); } break; case TestPlatform.macOS: if (!Configuration.include_mac) { Assert.Ignore("macOS support has been disabled"); } break; default: throw new NotImplementedException(sampleTestData.Platform.ToString()); } var file_to_build = sampleTestData.SampleTest.Project.RelativePath; var target = string.Empty; if (data.BuildSolution) { file_to_build = data.Solution; target = Path.GetFileNameWithoutExtension(data.Project.RelativePath).Replace('.', '_'); } var repo = CloneRepo(); file_to_build = Path.Combine(repo, file_to_build); if (data.RemoveProjects != null) { if (String.IsNullOrEmpty(data.Solution)) { Assert.Fail("'RemoveProjects' used without a 'Solution' path!"); } var sln_path = Path.Combine(repo, data.Solution); var filtered_sln = new List <string> (File.ReadAllLines(sln_path)); foreach (var p in data.RemoveProjects) { for (int i = 0; i < filtered_sln.Count; i++) { var line = filtered_sln [i]; if (line.StartsWith("Project(", StringComparison.Ordinal)) { if (line.Contains($") = \"{p}\", \"")) { filtered_sln.RemoveAt(i); filtered_sln.RemoveAt(i); // EndProject (same `i` as things moved up) break; } } } } File.WriteAllLines(sln_path, filtered_sln); } ProcessHelper.BuildSolution(file_to_build, sampleTestData.Platform, sampleTestData.Configuration, GetEnvironmentVariables(data.Project.Platform), sampleTestData.Timeout, target, data.CodesignKey); Console.WriteLine("✅ {0} succeeded.", TestContext.CurrentContext.Test.FullName); } catch (Exception e) { Console.WriteLine("❌ {0} failed: {1}", TestContext.CurrentContext.Test.FullName, e.Message); throw; } }
public void BuildSample([ValueSource("GetSampleData")] SampleTestData sampleTestData) { try { var data = sampleTestData.SampleTest; if (!string.IsNullOrEmpty(data.KnownFailure)) { Assert.Ignore(data.KnownFailure); } var environment_variables = new Dictionary <string, string> (); environment_variables ["MD_APPLE_SDK_ROOT"] = Path.GetDirectoryName(Path.GetDirectoryName(Configuration.XcodeLocation)); switch (data.Project.Platform) { case TestPlatform.iOS: case TestPlatform.tvOS: case TestPlatform.watchOS: environment_variables ["MD_MTOUCH_SDK_ROOT"] = Path.Combine(Configuration.IOS_DESTDIR, "Library", "Frameworks", "Xamarin.iOS.framework", "Versions", "Current"); environment_variables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine(Configuration.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); environment_variables ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine(Configuration.IOS_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); break; case TestPlatform.macOS: environment_variables ["TargetFrameworkFallbackSearchPaths"] = Path.Combine(Configuration.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild-frameworks"); environment_variables ["MSBuildExtensionsPathFallbackPathsOverride"] = Path.Combine(Configuration.MAC_DESTDIR, "Library", "Frameworks", "Mono.framework", "External", "xbuild"); environment_variables ["XamarinMacFrameworkRoot"] = Path.Combine(Configuration.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); environment_variables ["XAMMAC_FRAMEWORK_PATH"] = Path.Combine(Configuration.MAC_DESTDIR, "Library", "Frameworks", "Xamarin.Mac.framework", "Versions", "Current"); break; default: throw new NotImplementedException(sampleTestData.Platform.ToString()); } var file_to_build = sampleTestData.SampleTest.Project.RelativePath; var target = string.Empty; if (data.BuildSolution) { file_to_build = data.Solution; target = Path.GetFileNameWithoutExtension(data.Project.RelativePath).Replace('.', '_'); } var repo = CloneRepo(); file_to_build = Path.Combine(repo, file_to_build); if (data.RemoveProjects != null) { if (String.IsNullOrEmpty(data.Solution)) { Assert.Fail("'RemoveProjects' used without a 'Solution' path!"); } var sln_path = Path.Combine(repo, data.Solution); var filtered_sln = new List <string> (File.ReadAllLines(sln_path)); foreach (var p in data.RemoveProjects) { for (int i = 0; i < filtered_sln.Count; i++) { var line = filtered_sln [i]; if (line.StartsWith("Project(", StringComparison.Ordinal)) { if (line.Contains($") = \"{p}\", \"")) { filtered_sln.RemoveAt(i); filtered_sln.RemoveAt(i); // EndProject (same `i` as things moved up) break; } } } } File.WriteAllLines(sln_path, filtered_sln); } ProcessHelper.BuildSolution(file_to_build, sampleTestData.Platform, sampleTestData.Configuration, environment_variables, sampleTestData.Timeout, target, data.CodesignKey); Console.WriteLine("✅ {0} succeeded.", TestContext.CurrentContext.Test.FullName); } catch (Exception e) { Console.WriteLine("❌ {0} failed: {1}", TestContext.CurrentContext.Test.FullName, e.Message); throw; } }