private static bool CanRunOnThisPlatform(TestPlatform excludedFrameworks) { if (excludedFrameworks == TestPlatform.None) { return true; } if (excludedFrameworks.HasFlag(TestPlatform.Windows) && TestPlatformHelper.IsWindows) { return false; } if (excludedFrameworks.HasFlag(TestPlatform.Linux) && TestPlatformHelper.IsLinux) { return false; } if (excludedFrameworks.HasFlag(TestPlatform.Mac) && TestPlatformHelper.IsMac) { return false; } return true; }
/// <summary> /// 初始化,并预热测试器 /// </summary> public static void Initialize(TestPlatform testplatform) { _testPlatform = testplatform; //将当前程序的CPU权限设置为最高 Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High; Thread.CurrentThread.Priority = ThreadPriority.Highest; //预热 Test(string.Empty, 1, () => { }); }
public TestAttribute(TestPlatform testPlatform, string scene, float timeout) { this.m_Timeout = 5f; this.m_TestPlatform = TestPlatform.All; this.m_TestPlatform = testPlatform; this.m_Timeout = timeout; if (!string.IsNullOrEmpty(scene)) { if (scene.EndsWith(".unity")) { scene = scene.Substring(0, scene.Length - ".unity".Length); } this.m_SceneName = scene; } }
internal static TestsConstraint GetTestsConstraint(TestPlatform testPlatform) { if (testPlatform != TestPlatform.EditMode) { if (testPlatform != TestPlatform.PlayMode) { throw new NotImplementedException(); } } else { return new EditModeTestsConstraints(); } return new PlayModeTestsConstraints(); }
public TestClient() { var testPlatform = new TestPlatform(); Fqdn = testPlatform.Fqdn; Hostname = testPlatform.Hostname; IsInteractive = testPlatform.IsInteractive; IsAdmin = testPlatform.IsAdmin; // EnvironmentVersion = Environment.Version.Major + "." + Environment.Version.MajorRevision + "." + Environment.Version.Minor + "." + Environment.Version.MinorRevision + "." + Environment.Version.Build; Language = testPlatform.Language; OsBits = testPlatform.OsBits; // OsEdition = ""; // OsName = ""; OsVersion = testPlatform.OsVersion; ProcessBits = testPlatform.ProcessBits; UptimeSeconds = testPlatform.UptimeSeconds; Username = testPlatform.Username; UserDomainName = testPlatform.UserDomainName; Status = TestClientStatuses.NoTasks; Id = Guid.NewGuid(); }
public void CreateDiscoveryRequestThrowsIfDiscoveryCriteriaIsNull() { TestPlatform tp = new TestPlatform(); Assert.ThrowsException <ArgumentNullException>(() => tp.CreateDiscoveryRequest(null, It.IsAny <ProtocolConfig>())); }
protected IWebDriver GetRemoteWebDriver(TestPlatform platform, BrowserType browser, String siteUrl) { DesiredCapabilities caps = DetermineCapabilities(platform, browser); return(Driver = new RemoteWebDriver(new Uri(siteUrl), caps)); }
public PlatformSkipConditionAttribute(TestPlatform excludedPlatforms) { _excludedPlatforms = excludedPlatforms; }
public static async Task RunVisualTestScore(Score score, string referenceFileName, Settings?settings = null, IList <double>?tracks = null, string?message = null) { if (settings == null) { settings = new Settings(); } if (tracks == null) { tracks = new List <double> { 0 }; } settings.Core.Engine = "skia"; settings.Core.EnableLazyLoading = false; settings.Core.UseWorkers = false; if (!referenceFileName.StartsWith("test-data/")) { referenceFileName = $"test-data/visual-tests/{referenceFileName}"; } var referenceFileData = await TestPlatform.LoadFile(referenceFileName); var result = new List <RenderFinishedEventArgs>(); var totalWidth = 0.0; var totalHeight = 0.0; var task = new TaskCompletionSource <object?>(); var renderer = new ScoreRenderer(settings); renderer.Width = 1300; renderer.PartialRenderFinished.On(e => { if (e != null) { result.Add(e); } }); renderer.RenderFinished.On(e => { totalWidth = e.TotalWidth; totalHeight = e.TotalHeight; result.Add(e); task.SetResult(null); }); renderer.Error.On((e) => { task.SetException(e); }); renderer.RenderScore(score, tracks); if (await Task.WhenAny(task.Task, Task.Delay(2000)) == task.Task) { CompareVisualResult( totalWidth, totalHeight, result, referenceFileName, referenceFileData, message ); } else { Assert.Fail("Rendering did not complete within timeout"); } }
internal byte[] Load(string name) { const string path = "TestFiles/"; return(TestPlatform.LoadFile(path + name)); }
public bool CanSymlinkTest(TestPlatform platform) => platform.CanSymlink();
public TestAttribute(TestPlatform testPlatform) : this(testPlatform, null, 5f) { }
public void Prld_v2() { var sExp = @"<?xml version=""1.0"" encoding=""utf-8""?> <project xmlns=""http://schemata.jklnet.org/Decompiler/v2""> <input> </input> </project>"; var ldr = mr.Stub<ILoader>(); var platform = new TestPlatform(sc); Given_Binary(ldr, platform); mr.ReplayAll(); var prld = new ProjectLoader(sc, ldr); var project = prld.LoadProject("/foo/bar", new MemoryStream(Encoding.UTF8.GetBytes(sExp))); Assert.AreEqual(1, project.Programs.Count); }
public void SudSave_UserGlobal_issue_201() { var platform = new TestPlatform { }; var program = new Program { Platform = platform, User = new UserData { Globals = { { Address.Ptr32(0x01234), new GlobalDataItem_v2 { DataType = PrimitiveType_v1.Real32(), Name = "pi" } } } } }; var sw = new StringWriter(); When_SaveToTextWriter(program, sw); var sExp = @"<?xml version=""1.0"" encoding=""utf-16""?> <project xmlns=""http://schemata.jklnet.org/Reko/v4""> <input> <user> <global> <Address>00001234</Address> <prim domain=""Real"" size=""4"" /> <Name>pi</Name> </global> <registerValues /> </user> </input> </project>"; if (sw.ToString() != sExp) Debug.Print("{0}", sw.ToString()); Assert.AreEqual(sExp, sw.ToString()); }
List<ITestPlatform> ImportTestPlatforms(IEnumerable<XElement> platformElements) { var importedTestPlatforms = new List<ITestPlatform>(); foreach (var platformElement in platformElements) { var addTestPlatform = false; var testPlatform = importedTestPlatforms.FirstOrDefault(tp => tp.Id == GetStringAttribute(platformElement, "id") && // ITestPlatform testPlatform = null; // try { // testPlatform = importedTestPlatforms.First(tp => tp.Id == getStringAttribute(platformElement, "id") && tp.Name == GetStringAttribute(platformElement, "name") && tp.UniqueId == GetGuidAttribute(platformElement, "uniqueId")); // } // catch (Exception ee) { //Console.WriteLine(ee.Message); // } if (null == testPlatform) { testPlatform = new TestPlatform { UniqueId = GetGuidAttribute(platformElement, "uniqueId"), Id = GetStringAttribute(platformElement, "id"), Name = GetStringAttribute(platformElement, "name"), Description = GetStringAttribute(platformElement, "description") }; addTestPlatform = true; } if (addTestPlatform) importedTestPlatforms.Add(testPlatform); } return importedTestPlatforms; }
public void SudSavePlatformOptions_Dictionary() { var platform = new TestPlatform { Test_Options = new Dictionary<string, object> { { "Names", new Dictionary<string, object> { { "Adam", "30" }, { "Bob", "10" }, { "Cecil", "120" } } }, { "Name2", "Sue" }, } }; var program = new Program { Platform = platform }; var sw = new StringWriter(); When_SaveToTextWriter(program, sw); var sExp = @"<?xml version=""1.0"" encoding=""utf-16""?> <project xmlns=""http://schemata.jklnet.org/Reko/v4""> <input> <user> <platform> <dict key=""Names""> <item key=""Adam"">30</item> <item key=""Bob"">10</item> <item key=""Cecil"">120</item> </dict> <item key=""Name2"">Sue</item> </platform> <registerValues /> </user> </input> </project>"; if (sw.ToString() != sExp) Debug.Print("{0}", sw.ToString()); Assert.AreEqual(sExp, sw.ToString()); }
static TestLauncherBase GetEditModeLauncherForProvidedAssemblies(Filter filter, TestPlatform testPlatform = TestPlatform.EditMode) { return(new EditModeLauncher(filter.ToTestRunnerFilter(), testPlatform)); }
public static ExecutionProcess Create(string[] testPlatformAssemblies, IHostProcessInfo hostProcess = null, TestPlatform testPlatform = TestPlatform.x86) { hostProcess = hostProcess.Embed(new PlatformProcessInfo(testPlatform)) as IHostProcessInfo; return(new ExecutionProcess(hostProcess, testPlatformAssemblies)); }
internal bool IncludeOnPlatform(TestPlatform testPlatform) { return ((this.m_TestPlatform & testPlatform) == testPlatform); }
public static bool IsFlagIncluded(TestPlatform flags, TestPlatform flag) { return ((flags & flag) == flag); }
public TestAttribute() { this.m_Timeout = 5f; this.m_TestPlatform = TestPlatform.All; }
public void TestGraceBeatGeneration() { var reader = new Gp7Importer(); var buffer = TestPlatform.LoadFile("TestFiles/Audio/GraceBeats.gp"); var settings = Settings.SongBook; reader.Init(ByteBuffer.FromBuffer(buffer), settings); var score = reader.ReadScore(); var handler = new FlatMidiEventGenerator(); var generator = new MidiFileGenerator(score, settings, handler); generator.Generate(); // on beat var tick = 0; var ticks = new FastList <int>(); Assert.AreEqual(tick, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].AbsolutePlaybackStart); Assert.AreEqual(3840, score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].PlaybackDuration); ticks.Add(tick); tick += score.Tracks[0].Staves[0].Bars[0].Voices[0].Beats[0].PlaybackDuration; Assert.AreEqual(tick, score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[0].AbsolutePlaybackStart); Assert.AreEqual(120, score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[0].PlaybackDuration); ticks.Add(tick); tick += score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[0].PlaybackDuration; Assert.AreEqual(tick, score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[1].AbsolutePlaybackStart); Assert.AreEqual(3720, score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[1].PlaybackDuration); ticks.Add(tick); tick += score.Tracks[0].Staves[0].Bars[1].Voices[0].Beats[1].PlaybackDuration; // before beat Assert.AreEqual(tick, score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[0].AbsolutePlaybackStart); Assert.AreEqual(3720, score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[0].PlaybackDuration); ticks.Add(tick); tick += score.Tracks[0].Staves[0].Bars[2].Voices[0].Beats[0].PlaybackDuration; Assert.AreEqual(tick, score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[0].AbsolutePlaybackStart); Assert.AreEqual(120, score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[0].PlaybackDuration); ticks.Add(tick); tick += score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[0].PlaybackDuration; Assert.AreEqual(tick, score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[1].AbsolutePlaybackStart); Assert.AreEqual(3840, score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[1].PlaybackDuration); ticks.Add(tick); tick += score.Tracks[0].Staves[0].Bars[3].Voices[0].Beats[1].PlaybackDuration; // bend Assert.AreEqual(GraceType.BendGrace, score.Tracks[0].Staves[0].Bars[4].Voices[0].Beats[0].GraceType); Assert.AreEqual(tick, score.Tracks[0].Staves[0].Bars[4].Voices[0].Beats[0].AbsolutePlaybackStart); Assert.AreEqual(1920, score.Tracks[0].Staves[0].Bars[4].Voices[0].Beats[0].PlaybackDuration); ticks.Add(tick); tick += score.Tracks[0].Staves[0].Bars[4].Voices[0].Beats[0].PlaybackDuration; Assert.AreEqual(tick, score.Tracks[0].Staves[0].Bars[4].Voices[0].Beats[1].AbsolutePlaybackStart); Assert.AreEqual(1920, score.Tracks[0].Staves[0].Bars[4].Voices[0].Beats[1].PlaybackDuration); ticks.Add(tick); tick += score.Tracks[0].Staves[0].Bars[4].Voices[0].Beats[1].PlaybackDuration; var info = score.Tracks[0].PlaybackInfo; var expectedEvents = new FlatMidiEventGenerator.MidiEvent[] { // channel init new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.PrimaryChannel, Controller = (byte)ControllerType.VolumeCoarse, Value = 120 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.PrimaryChannel, Controller = (byte)ControllerType.PanCoarse, Value = 64 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.PrimaryChannel, Controller = (byte)ControllerType.ExpressionControllerCoarse, Value = 127 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.PrimaryChannel, Controller = (byte)ControllerType.RegisteredParameterFine, Value = 0 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.PrimaryChannel, Controller = (byte)ControllerType.RegisteredParameterCourse, Value = 0 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.PrimaryChannel, Controller = (byte)ControllerType.DataEntryFine, Value = 0 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.PrimaryChannel, Controller = (byte)ControllerType.DataEntryCoarse, Value = 12 }, new FlatMidiEventGenerator.ProgramChangeEvent { Tick = 0, Track = 0, Channel = info.PrimaryChannel, Program = (byte)info.Program }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.SecondaryChannel, Controller = (byte)ControllerType.VolumeCoarse, Value = 120 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.SecondaryChannel, Controller = (byte)ControllerType.PanCoarse, Value = 64 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.SecondaryChannel, Controller = (byte)ControllerType.ExpressionControllerCoarse, Value = 127 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.SecondaryChannel, Controller = (byte)ControllerType.RegisteredParameterFine, Value = 0 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.SecondaryChannel, Controller = (byte)ControllerType.RegisteredParameterCourse, Value = 0 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.SecondaryChannel, Controller = (byte)ControllerType.DataEntryFine, Value = 0 }, new FlatMidiEventGenerator.ControlChangeEvent { Tick = 0, Track = 0, Channel = info.SecondaryChannel, Controller = (byte)ControllerType.DataEntryCoarse, Value = 12 }, new FlatMidiEventGenerator.ProgramChangeEvent { Tick = 0, Track = 0, Channel = info.SecondaryChannel, Program = (byte)info.Program }, new FlatMidiEventGenerator.TimeSignatureEvent { Tick = 0, Numerator = 4, Denominator = 4 }, new FlatMidiEventGenerator.TempoEvent { Tick = 0, Tempo = 120 }, // on beat new FlatMidiEventGenerator.BendEvent { Tick = ticks[0], Track = 0, Channel = info.PrimaryChannel, Value = 64 }, new FlatMidiEventGenerator.NoteEvent { Tick = ticks[0], Track = 0, Channel = info.PrimaryChannel, DynamicValue = DynamicValue.F, Key = (byte)67, Length = 3840 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[1], Track = 0, Channel = info.PrimaryChannel, Value = 64 }, new FlatMidiEventGenerator.NoteEvent { Tick = ticks[1], Track = 0, Channel = info.PrimaryChannel, DynamicValue = DynamicValue.F, Key = (byte)67, Length = 120 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[2], Track = 0, Channel = info.PrimaryChannel, Value = 64 }, new FlatMidiEventGenerator.NoteEvent { Tick = ticks[2], Track = 0, Channel = info.PrimaryChannel, DynamicValue = DynamicValue.F, Key = (byte)67, Length = 3720 }, // before beat new FlatMidiEventGenerator.BendEvent { Tick = ticks[3], Track = 0, Channel = info.PrimaryChannel, Value = 64 }, new FlatMidiEventGenerator.NoteEvent { Tick = ticks[3], Track = 0, Channel = info.PrimaryChannel, DynamicValue = DynamicValue.F, Key = (byte)67, Length = 3720 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[4], Track = 0, Channel = info.PrimaryChannel, Value = 64 }, new FlatMidiEventGenerator.NoteEvent { Tick = ticks[4], Track = 0, Channel = info.PrimaryChannel, DynamicValue = DynamicValue.F, Key = (byte)67, Length = 120 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[5], Track = 0, Channel = info.PrimaryChannel, Value = 64 }, new FlatMidiEventGenerator.NoteEvent { Tick = ticks[5], Track = 0, Channel = info.PrimaryChannel, DynamicValue = DynamicValue.F, Key = (byte)67, Length = 3840 }, // bend beat new FlatMidiEventGenerator.BendEvent { Tick = ticks[6], Track = 0, Channel = info.SecondaryChannel, Value = 64 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 0, Track = 0, Channel = info.SecondaryChannel, Value = 64 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 1, Track = 0, Channel = info.SecondaryChannel, Value = 65 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 2, Track = 0, Channel = info.SecondaryChannel, Value = 66 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 3, Track = 0, Channel = info.SecondaryChannel, Value = 67 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 4, Track = 0, Channel = info.SecondaryChannel, Value = 68 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 5, Track = 0, Channel = info.SecondaryChannel, Value = 69 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 6, Track = 0, Channel = info.SecondaryChannel, Value = 70 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 7, Track = 0, Channel = info.SecondaryChannel, Value = 71 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 8, Track = 0, Channel = info.SecondaryChannel, Value = 72 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 9, Track = 0, Channel = info.SecondaryChannel, Value = 73 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 10, Track = 0, Channel = info.SecondaryChannel, Value = 74 }, new FlatMidiEventGenerator.BendEvent { Tick = ticks[6] + 13 * 11 + 1, Track = 0, Channel = info.SecondaryChannel, Value = 75 }, new FlatMidiEventGenerator.NoteEvent { Tick = ticks[6], Track = 0, Channel = info.SecondaryChannel, Length = 3840, Key = 67, DynamicValue = DynamicValue.F }, // end of track new FlatMidiEventGenerator.TrackEndEvent { Tick = 19200, Track = 0 } // 3840 = end of bar }; for (int i = 0; i < handler.MidiEvents.Count; i++) { Logger.Info("Test", $"i[{i}] {handler.MidiEvents[i]}"); if (i < expectedEvents.Length) { Assert.AreEqual(expectedEvents[i], handler.MidiEvents[i]); } } Assert.AreEqual(expectedEvents.Length, handler.MidiEvents.Count); }
public BuildTool(IProcessManager processManager, TestPlatform platform) : this(processManager) { Platform = platform; }
/// <summary> /// Get the name of the base image to compare the generated images to. /// </summary> /// <param name="platform">The platform the test is performed on.</param> /// <param name="deviceName">The name of the device.</param> /// <returns>The name of the file.</returns> public string GenerateBaseFileNameFromVersion(TestPlatform platform, string deviceName) { return this.GetType().Name + @"_" + PlatformPermutator.GetPlatformName(platform) + @"_" + deviceName + @"_v" + BaseVersionNumber + @".png"; }
public void Setup() { _platform = new TestPlatform(); _session = new Session(_platform, "/"); _collectionFile = _session["indexables"]; }
public bool IsMacTest(TestPlatform platform) => platform.IsMac();
public void ToTestPlatformTest(MacFlavors flavor, TestPlatform expected) => Assert.AreEqual(flavor.ToTestPlatform(), expected);
public PlatformProcessInfo(TestPlatform platform) { _platform = platform; }
public void Prld_PlatformOptions_Scalar() { var sExp = @"<?xml version=""1.0"" encoding=""utf-8""?> <project xmlns=""http://schemata.jklnet.org/Reko/v3""> <input> <user> <platform> <item key=""Name"">Bob</item> <item key=""Name2"">Sue</item> </platform> </user> </input> </project>"; var ldr = mr.Stub<ILoader>(); var platform = new TestPlatform(); Given_Binary(ldr, platform); mr.ReplayAll(); var prld = new ProjectLoader(sc, ldr); prld.LoadProject("/foo/bar", new MemoryStream(Encoding.UTF8.GetBytes(sExp))); Assert.AreEqual(2, platform.Test_Options.Count); Assert.AreEqual("Bob", platform.Test_Options["Name"]); Assert.AreEqual("Sue", platform.Test_Options["Name2"]); }
public EditModeLauncher(TestRunnerFilter filter, TestPlatform platform) { m_EditModeRunner = ScriptableObject.CreateInstance <EditModeRunner>(); m_EditModeRunner.UnityTestAssemblyRunnerFactory = new UnityTestAssemblyRunnerFactory(); m_EditModeRunner.Init(filter, platform); }
public void Prld_PlatformOptions_List() { var sExp = @"<?xml version=""1.0"" encoding=""utf-8""?> <project xmlns=""http://schemata.jklnet.org/Reko/v3""> <input> <user> <platform> <list key=""Names""> <item>Adam</item> <item>Bob</item> <item>Cecil</item> </list> <item key=""Name2"">Sue</item> </platform> </user> </input> </project>"; var ldr = mr.Stub<ILoader>(); var platform = new TestPlatform(); Given_Binary(ldr, platform); mr.ReplayAll(); var prld = new ProjectLoader(sc, ldr); prld.LoadProject("/ff/b/foo.proj", new MemoryStream(Encoding.UTF8.GetBytes(sExp))); var list = (IList)platform.Test_Options["Names"]; Assert.AreEqual(3, list.Count); }
public void CreateTestRunRequestThrowsIfTestRunCriteriaIsNull() { var tp = new TestPlatform(); Assert.ThrowsException <ArgumentNullException>(() => tp.CreateTestRunRequest(this.mockRequestData.Object, null, new TestPlatformOptions())); }
public void Prld_PlatformOptions_Dictionary() { var sproject = @"<?xml version=""1.0"" encoding=""utf-8""?> <project xmlns=""http://schemata.jklnet.org/Reko/v3""> <input> <user> <platform> <dict key=""Names""> <item key=""Adam"">30</item> <item key=""Bob"">10</item> <item key=""Cecil"">120</item> </dict> <item key=""Name2"">Sue</item> </platform> </user> </input> </project>"; var ldr = mr.Stub<ILoader>(); var platform = new TestPlatform(); Given_Binary(ldr, platform); mr.ReplayAll(); var prld = new ProjectLoader(sc, ldr); prld.LoadProject("c:\\foo\\bar.proj", new MemoryStream(Encoding.UTF8.GetBytes(sproject))); var list = (IDictionary)platform.Test_Options["Names"]; Assert.AreEqual(3, list.Count); }
public IUnityTestAssemblyRunner Create(TestPlatform testPlatform, WorkItemFactory factory) { return(new UnityTestAssemblyRunner(new UnityTestAssemblyBuilder(), factory)); }
/// <summary> /// Get the name of the base image to compare the generated images to. /// </summary> /// <param name="platform">The platform the test is performed on.</param> /// <param name="deviceName">The name of the device.</param> /// <returns>The name of the file.</returns> public string GenerateBaseFileNameFromVersion(TestPlatform platform, string deviceName) { return(this.GetType().Name + @"_" + PlatformPermutator.GetPlatformName(platform) + @"_" + deviceName + @"_v" + BaseVersionNumber + @".png"); }
public void CreateTestRunRequestThrowsIfTestRunCriteriaIsNull() { var tp = new TestPlatform(); Assert.ThrowsException <ArgumentNullException>(() => tp.CreateTestRunRequest(null, It.IsAny <ProtocolConfig>())); }
public IEnumerator <List <IAssemblyWrapper> > GetAssembliesGroupedByTypeAsync(TestPlatform mode) { IAssemblyWrapper[] loadedAssemblies = m_EditorAssembliesProxy.loadedAssemblies; IDictionary <TestPlatform, List <IAssemblyWrapper> > result = new Dictionary <TestPlatform, List <IAssemblyWrapper> >() { { TestPlatform.EditMode, new List <IAssemblyWrapper>() }, { TestPlatform.PlayMode, new List <IAssemblyWrapper>() } }; foreach (var loadedAssembly in loadedAssemblies) { if (loadedAssembly.GetReferencedAssemblies().Any(x => x.Name == k_NunitAssemblyName || x.Name == k_TestRunnerAssemblyName || x.Name == k_PerformanceTestingAssemblyName)) { var assemblyName = new FileInfo(loadedAssembly.Location).Name; var scriptAssemblies = m_AllEditorScriptAssemblies.Where(x => x.Filename == assemblyName).ToList(); var precompiledAssemblies = m_AllPrecompiledAssemblies.Where(x => new FileInfo(x.Path).Name == assemblyName).ToList(); if (scriptAssemblies.Count < 1 && precompiledAssemblies.Count < 1) { continue; } var assemblyFlags = scriptAssemblies.Any() ? scriptAssemblies.Single().Flags : precompiledAssemblies.Single().Flags; var assemblyType = (assemblyFlags & AssemblyFlags.EditorOnly) == AssemblyFlags.EditorOnly ? TestPlatform.EditMode : TestPlatform.PlayMode; result[assemblyType].Add(loadedAssembly); yield return(null); } } yield return(result[mode]); }
public void Setup() { _platform = new TestPlatform(); }
public void CreateDiscoveryRequestThrowsIfDiscoveryCriteriaIsNull() { TestPlatform tp = new TestPlatform(); Assert.ThrowsException <ArgumentNullException>(() => tp.CreateDiscoveryRequest(this.mockRequestData.Object, null)); }
public async Task <IEnumerable <ITestTask> > CreateAsync(Jenkins jenkins, IProcessManager processManager, TestVariationsFactory testVariationsFactory) { var runSimulatorTasks = new List <RunSimulatorTask> (); foreach (var project in jenkins.Harness.IOSTestProjects) { if (!project.IsExecutableProject) { continue; } bool ignored = !jenkins.IncludeSimulator; if (!jenkins.IsIncluded(project)) { ignored = true; } var ps = new List <Tuple <TestProject, TestPlatform, bool> > (); if (!project.SkipiOSVariation) { ps.Add(new Tuple <TestProject, TestPlatform, bool> (project, TestPlatform.iOS_Unified, ignored || !jenkins.IncludeiOS64)); } if (project.MonoNativeInfo != null) { ps.Add(new Tuple <TestProject, TestPlatform, bool> (project, TestPlatform.iOS_TodayExtension64, ignored || !jenkins.IncludeiOS64)); } if (!project.SkiptvOSVariation) { ps.Add(new Tuple <TestProject, TestPlatform, bool> (project.AsTvOSProject(), TestPlatform.tvOS, ignored || !jenkins.IncludetvOS)); } if (!project.SkipwatchOSVariation) { ps.Add(new Tuple <TestProject, TestPlatform, bool> (project.AsWatchOSProject(), TestPlatform.watchOS, ignored || !jenkins.IncludewatchOS)); } var configurations = project.Configurations; if (configurations == null) { configurations = new string [] { "Debug" } } ; foreach (var config in configurations) { foreach (var pair in ps) { MSBuildTask derived; if (project.IsDotNetProject) { derived = new DotNetBuildTask(jenkins: jenkins, testProject: project, processManager: processManager); } else { derived = new MSBuildTask(jenkins: jenkins, testProject: project, processManager: processManager); } derived.ProjectConfiguration = config; derived.ProjectPlatform = "iPhoneSimulator"; derived.Platform = pair.Item2; derived.Ignored = pair.Item3; derived.TestName = project.Name; derived.Dependency = project.Dependency; derived.CloneTestProject(jenkins.MainLog, processManager, pair.Item1); var simTasks = CreateAsync(jenkins, processManager, derived); runSimulatorTasks.AddRange(simTasks); foreach (var task in simTasks) { if (configurations.Length > 1) { task.Variation = config; } task.TimeoutMultiplier = project.TimeoutMultiplier; } } } } var testVariations = testVariationsFactory.CreateTestVariations(runSimulatorTasks, (buildTask, test, candidates) => new RunSimulatorTask( jenkins: jenkins, simulators: jenkins.Simulators, buildTask: buildTask, processManager: processManager, tunnelBore: jenkins.TunnelBore, candidates: candidates?.Cast <SimulatorDevice> () ?? test.Candidates)).ToList(); foreach (var tv in testVariations) { if (!tv.Ignored) { await tv.FindSimulatorAsync(); } } var rv = new List <AggregatedRunSimulatorTask> (); foreach (var taskGroup in testVariations.GroupBy((RunSimulatorTask task) => task.Device?.UDID ?? task.Candidates.ToString())) { rv.Add(new AggregatedRunSimulatorTask(jenkins: jenkins, tasks: taskGroup) { TestName = $"Tests for {taskGroup.Key}", }); } return(rv); } IEnumerable <RunSimulatorTask> CreateAsync(Jenkins jenkins, IProcessManager processManager, MSBuildTask buildTask) { var runtasks = new List <RunSimulatorTask> (); TestTarget [] targets = buildTask.Platform.GetAppRunnerTargets(); TestPlatform [] platforms; bool [] ignored; switch (buildTask.Platform) { case TestPlatform.tvOS: platforms = new TestPlatform [] { TestPlatform.tvOS }; ignored = new [] { false }; break; case TestPlatform.watchOS: platforms = new TestPlatform [] { TestPlatform.watchOS_32 }; ignored = new [] { false }; break; case TestPlatform.iOS_Unified: var iOSProject = (iOSTestProject)buildTask.TestProject; if (iOSProject.SkipiOS32Variation && iOSProject.SkipiOS64Variation) { return(runtasks); } else if (iOSProject.SkipiOS32Variation) { targets = new TestTarget [] { TestTarget.Simulator_iOS64 }; platforms = new TestPlatform [] { TestPlatform.iOS_Unified64 }; ignored = new [] { false }; } else if (iOSProject.SkipiOS64Variation) { targets = new TestTarget [] { TestTarget.Simulator_iOS32 }; platforms = new TestPlatform [] { TestPlatform.iOS_Unified32 }; ignored = new [] { !jenkins.IncludeiOS32 }; } else { platforms = new TestPlatform [] { TestPlatform.iOS_Unified32, TestPlatform.iOS_Unified64 }; ignored = new [] { !jenkins.IncludeiOS32, false }; } break; case TestPlatform.iOS_TodayExtension64: targets = new TestTarget [] { TestTarget.Simulator_iOS64 }; platforms = new TestPlatform [] { TestPlatform.iOS_TodayExtension64 }; ignored = new [] { false }; break; default: throw new NotImplementedException(); } for (int i = 0; i < targets.Length; i++) { var sims = jenkins.Simulators.SelectDevices(targets [i], jenkins.SimulatorLoadLog, false); runtasks.Add(new RunSimulatorTask( jenkins: jenkins, simulators: jenkins.Simulators, buildTask: buildTask, processManager: processManager, tunnelBore: jenkins.TunnelBore, candidates: sims) { Platform = platforms [i], Ignored = ignored [i] || buildTask.Ignored }); } return(runtasks); } }
protected override bool IsTestMethod(MethodInfo method) { string name = method.Name; return(StartsWithIgnoreCase(name, ConcurrencyConventions.TestPrefix()) && TestPlatform .IsPublic(method) && !TestPlatform.IsStatic(method) && HasValidParameter(method)); }
public static string GetPlatformName(TestPlatform platform) { switch (platform) { case TestPlatform.WindowsDx: return "Windows_Direct3D11"; case TestPlatform.WindowsOgl: return "Windows_OpenGL"; case TestPlatform.WindowsOgles: return "Windows_OpenGLES"; case TestPlatform.Android: return "Android"; case TestPlatform.Ios: return "IOS"; case TestPlatform.WindowsPhone: return "Windows_Phone"; case TestPlatform.WindowsStore: return "Windows_Store"; default: throw new ArgumentOutOfRangeException(); } }
public TestListJob(CachingTestListProvider testListProvider, TestPlatform platform, Action <ITestAdaptor> callback) { m_TestListProvider = testListProvider; m_Platform = platform; m_Callback = callback; }
public void SudSavePlatformOptions_Scalar() { var platform = new TestPlatform { Test_Options = new Dictionary<string, object> { { "Name", "Bob" }, { "Name2", "Sue" }, } }; var program = new Program { Platform = platform }; var sw = new StringWriter(); When_SaveToTextWriter(program, sw); var sExp = @"<?xml version=""1.0"" encoding=""utf-16""?> <project xmlns=""http://schemata.jklnet.org/Reko/v3""> <input> <user> <platform> <item key=""Name"">Bob</item> <item key=""Name2"">Sue</item> </platform> </user> </input> </project>"; if (sw.ToString() != sExp) Debug.Print("{0}", sw.ToString()); Assert.AreEqual(sExp, sw.ToString()); }
static TestLauncherBase GetEditModeLauncherForProvidedAssemblies(Filter[] filters, TestPlatform testPlatform = TestPlatform.EditMode) { return(new EditModeLauncher(filters, testPlatform)); }
private IEnumerable <MethodInfo> GetTestMethodList(TestPlatform testPlatform, Type type) {
public EditModeLauncher(Filter[] filters, TestPlatform platform, bool runSynchronously) { m_EditModeRunner = ScriptableObject.CreateInstance <EditModeRunner>(); m_EditModeRunner.UnityTestAssemblyRunnerFactory = new UnityTestAssemblyRunnerFactory(); m_EditModeRunner.Init(filters, platform, runSynchronously); }
public void Prld_issue_299() { var sExp = @"<?xml version=""1.0"" encoding=""utf-8""?> <project xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns=""http://schemata.jklnet.org/Reko/v3""> <input> <filename>switch.dll</filename> <disassembly>switch.asm</disassembly> <intermediate-code>switch.dis</intermediate-code> <output>switch.c</output> <types-file>switch.h</types-file> <global-vars>switch.globals.c</global-vars> <user> <procedure name=""get""> <address>10071000</address> <CSignature>char * get(unsigned int n)</CSignature> </procedure> <heuristic name=""shingle"" /> </user> </input> </project> "; var ldr = mr.Stub<ILoader>(); var platform = new TestPlatform(sc); Given_TestArch(); Given_TestOS(); Given_Binary(ldr, platform); Given_TypeLibraryLoaderService(); oe.Stub(o => o.TypeLibraries).Return(new List<ITypeLibraryElement>()); oe.Stub(o => o.CharacteristicsLibraries).Return(new List<ITypeLibraryElement>()); mr.ReplayAll(); var prld = new ProjectLoader(sc, ldr); var project = prld.LoadProject("/foo/bar", new MemoryStream(Encoding.UTF8.GetBytes(sExp))); Assert.AreEqual(1, project.Programs.Count); }
public string GetSimulatorMinVersionTest(TestPlatform platform) => platform.GetSimulatorMinVersion();
/// <summary> /// Run the test on Windows through a bat file. /// </summary> private void RunWindowsTest(string serial, TestPlatform platform) { try { var command = new StringBuilder(); var parameters = new StringBuilder(); command.Append(@"..\..\Bin\"); switch (platform) { case TestPlatform.WindowsDx: command.Append(@"Windows-AnyCPU-Direct3D\"); break; case TestPlatform.WindowsOgl: command.Append(@"Windows-AnyCPU-OpenGL\"); break; case TestPlatform.WindowsOgles: command.Append(@"Windows-AnyCPU-OpenGLES\"); break; default: throw new ArgumentOutOfRangeException("platform"); } command.Append(@"SiliconStudio.Xenko.Graphics.Regression.exe"); parameters.Append(serverAddresses); parameters.Append(" "); parameters.Append(serverPort); parameters.Append(" "); parameters.Append(buildNumber); parameters.Append(" "); parameters.Append(serial); parameters.Append(" "); parameters.Append(this.GetType().Name); parameters.Append(" "); parameters.Append(this.GetType().Assembly.ManifestModule.Name); Console.WriteLine(@"Running: " + command.ToString() + @" " + parameters.ToString()); var outputs = ShellHelper.RunProcessAndGetOutput(command.ToString(), parameters.ToString()); foreach (var output in outputs.OutputLines) Console.WriteLine(output); foreach (var output in outputs.OutputErrors) Console.WriteLine(output); } catch (Exception e) { Console.WriteLine(@"An error was thrown when running the test on Windows."); dataReceivedEvent.Set(); } }