public AOTCompiler(AOTOptions options, AOTCompilerType compilerType, bool isModern, bool isRelease) { this.options = options; this.compilerType = compilerType; this.IsModern = isModern; this.IsRelease = isRelease; }
List<string> GetFiledAOTed (AOTCompilerType compilerType = AOTCompilerType.Bundled64, AOTKind kind = AOTKind.Standard, bool isModern = false, bool expectStripping = false, bool expectSymbolDeletion = false) { List<string> filesAOTed = new List<string> (); foreach (var command in commandsRun) { if (expectStripping && command.Item1 == AOTCompiler.StripCommand) continue; if (expectSymbolDeletion && command.Item1 == AOTCompiler.DeleteDebugSymbolCommand) continue; Assert.IsTrue (command.Item1.EndsWith (GetExpectedMonoCommand (compilerType)), "Unexpected command: " + command.Item1); var argParts = command.Item2; if (kind == AOTKind.Hybrid) Assert.AreEqual (argParts[0], "--aot=hybrid", "First arg should be --aot=hybrid"); else Assert.AreEqual (argParts[0], "--aot", "First arg should be --aot"); if (isModern) Assert.AreEqual (argParts[1], "--runtime=mobile", "Second arg should be --runtime=mobile"); else Assert.AreNotEqual (argParts[1], "--runtime=mobile", "Second arg should not be --runtime=mobile"); var fileName = command.Item2 [1]; if (isModern) fileName = command.Item2 [2]; filesAOTed.Add (fileName); } return filesAOTed; }
public AOTCompiler(AOTOptions options, IEnumerable <Abi> abis, AOTCompilerType compilerType, bool isModern, bool isRelease) { this.options = options; this.abis = abis.ToArray(); this.compilerType = compilerType; this.IsModern = isModern; this.IsRelease = isRelease; }
void AssertFilesAOTed (IEnumerable <string> expectedFiles, AOTCompilerType compilerType = AOTCompilerType.Bundled64, AOTKind kind = AOTKind.Standard, bool isModern = false, bool expectStripping = false, bool expectSymbolDeletion = false) { List<string> filesAOTed = GetFiledAOTed (compilerType, kind, isModern: isModern, expectStripping: expectStripping, expectSymbolDeletion : expectSymbolDeletion); Func<string> getErrorDetails = () => $"\n {FormatDebugList (filesAOTed)} \nvs\n {FormatDebugList (expectedFiles)}\n{AllCommandsRun}"; Assert.AreEqual (filesAOTed.Count, expectedFiles.Count (), "Different number of files AOT than expected: " + getErrorDetails ()); Assert.IsTrue (filesAOTed.All (x => expectedFiles.Contains (x)), "Different files AOT than expected: " + getErrorDetails ()); }
void AssertFilesAOTed(IEnumerable <string> expectedFiles, AOTCompilerType compilerType = AOTCompilerType.Bundled64, AOTKind kind = AOTKind.Standard) { List <string> filesAOTed = GetFiledAOTed(compilerType, kind); Func <string> getErrorDetails = () => $"\n {String.Join (" ", filesAOTed)} \nvs\n {String.Join (" ", expectedFiles)}"; Assert.AreEqual(filesAOTed.Count, expectedFiles.Count(), "Different number of files AOT than expected: " + getErrorDetails()); Assert.IsTrue(filesAOTed.All(x => expectedFiles.Contains(x)), "Different files AOT than expected: " + getErrorDetails()); }
string GetExpectedMonoCommand (AOTCompilerType compilerType) { switch (compilerType) { case AOTCompilerType.Bundled64: return "mono-sgen"; case AOTCompilerType.System64: return "mono64"; default: Assert.Fail ("GetMonoPath with invalid option"); return ""; } }
List <string> GetFiledAOTed(AOTCompilerType compilerType = AOTCompilerType.Bundled64, AOTKind kind = AOTKind.Standard, bool isModern = false, bool expectStripping = false, bool expectSymbolDeletion = false) { List <string> filesAOTed = new List <string> (); foreach (var command in commandsRun) { if (expectStripping && command.Item1 == AOTCompiler.StripCommand) { continue; } var argParts = command.Item2; const string aotArg = "--aot="; const string tripleArg = "mtriple="; Assert.IsTrue(argParts [0].StartsWith(aotArg), $"First arg should be {aotArg}"); var aotParts = argParts [0].Substring(aotArg.Length).Split(new char [] { ',' }); Assert.IsTrue(aotParts [0].StartsWith(tripleArg), $"Aot first argument should be {tripleArg}triple"); var triple = aotParts [0].Substring(tripleArg.Length); Assert.IsTrue(Enum.TryParse(triple, true, out Abi currAbi), "Triple does not represent a valid abi"); Assert.IsTrue(command.Item1.EndsWith(GetExpectedMonoCommand(compilerType, currAbi)), "Unexpected command: " + command.Item1); if (kind == AOTKind.Hybrid) { Assert.AreEqual(aotParts [1], "hybrid", "Aot arg should contain hybrid"); } else if (aotParts.Length > 1) { Assert.AreNotEqual(aotParts [1], "hybrid", "Aot arg should not contain hybrid"); } if (isModern) { Assert.AreEqual(argParts[1], "--runtime=mobile", "Second arg should be --runtime=mobile"); } else { Assert.AreNotEqual(argParts[1], "--runtime=mobile", "Second arg should not be --runtime=mobile"); } var fileName = command.Item2 [1]; if (isModern) { fileName = command.Item2 [2]; } filesAOTed.Add(fileName); } return(filesAOTed); }
void Compile(AOTOptions options, TestFileEnumerator files, AOTCompilerType compilerType = AOTCompilerType.Bundled64, RunCommandDelegate onRunDelegate = null) { AOTCompiler compiler = new AOTCompiler(options, compilerType) { RunCommand = onRunDelegate != null ? onRunDelegate : OnRunCommand, ParallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = 1 }, XamarinMacPrefix = Driver.WalkUpDirHierarchyLookingForLocalBuild(), // HACK - AOT test shouldn't need this from driver.cs }; compiler.Compile(files); }
void Compile (AOTOptions options, TestFileEnumerator files, AOTCompilerType compilerType = AOTCompilerType.Bundled64, RunCommandDelegate onRunDelegate = null, bool isRelease = false, bool isModern = false) { AOTCompiler compiler = new AOTCompiler (options, compilerType, isModern, isRelease) { RunCommand = onRunDelegate != null ? onRunDelegate : OnRunCommand, ParallelOptions = new ParallelOptions () { MaxDegreeOfParallelism = 1 }, XamarinMacPrefix = Xamarin.Tests.Configuration.SdkRootXM, }; try { Profile.Current = new XamarinMacProfile (); compiler.Compile (files); } finally { Profile.Current = null; } }
string GetExpectedMonoCommand(AOTCompilerType compilerType) { switch (compilerType) { case AOTCompilerType.Bundled64: return("bmac-mobile-mono"); case AOTCompilerType.System64: return("mono64"); default: Assert.Fail("GetMonoPath with invalid option"); return(""); } }
List <string> GetFiledAOTed(AOTCompilerType compilerType = AOTCompilerType.Bundled64, AOTKind kind = AOTKind.Standard, bool isModern = false, bool expectStripping = false, bool expectSymbolDeletion = false) { List <string> filesAOTed = new List <string> (); foreach (var command in commandsRun) { if (expectStripping && command.Item1 == AOTCompiler.StripCommand) { continue; } if (expectSymbolDeletion && command.Item1 == AOTCompiler.DeleteDebugSymbolCommand) { continue; } Assert.IsTrue(command.Item1.EndsWith(GetExpectedMonoCommand(compilerType)), "Unexpected command: " + command.Item1); string [] argParts = command.Item2.Split(' '); if (kind == AOTKind.Hybrid) { Assert.AreEqual(argParts[0], "--aot=hybrid", "First arg should be --aot=hybrid"); } else { Assert.AreEqual(argParts[0], "--aot", "First arg should be --aot"); } if (isModern) { Assert.AreEqual(argParts[1], "--runtime=mobile", "Second arg should be --runtime=mobile"); } else { Assert.AreNotEqual(argParts[1], "--runtime=mobile", "Second arg should not be --runtime=mobile"); } int fileNameBeginningIndex = command.Item2.IndexOf(' ') + 1; if (isModern) { fileNameBeginningIndex = command.Item2.IndexOf(' ', fileNameBeginningIndex) + 1; } string fileName = command.Item2.Substring(fileNameBeginningIndex).Replace("\'", ""); filesAOTed.Add(fileName); } return(filesAOTed); }
IEnumerable <mmp::Xamarin.Abi> GetValidAbis(AOTCompilerType compilerType) { if (compilerType == AOTCompilerType.Bundled64) { yield return(mmp::Xamarin.Abi.x86_64); yield return(mmp::Xamarin.Abi.ARM64); } else if (compilerType == AOTCompilerType.System64) { yield return(mmp::Xamarin.Abi.x86_64); } else { Assert.Fail("Improper compiler type"); } }
void Compile(AOTOptions options, TestFileEnumerator files, AOTCompilerType compilerType = AOTCompilerType.Bundled64, RunCommandDelegate onRunDelegate = null, bool isRelease = false, bool isModern = false) { AOTCompiler compiler = new AOTCompiler(options, compilerType, isModern, isRelease) { RunCommand = onRunDelegate != null ? onRunDelegate : OnRunCommand, ParallelOptions = new ParallelOptions() { MaxDegreeOfParallelism = 1 }, XamarinMacPrefix = Driver.WalkUpDirHierarchyLookingForLocalBuild(), // HACK - AOT test shouldn't need this from driver.cs }; try { Profile.Current = new XamarinMacProfile(); compiler.Compile(files); } finally { Profile.Current = null; } }
string GetExpectedMonoCommand(AOTCompilerType compilerType, Abi currAbi) { if (compilerType == AOTCompilerType.Bundled64) { if (currAbi == Abi.x86_64) { return("mono-sgen"); } else if (currAbi == Abi.ARM64) { return("aarch64-darwin-mono-sgen"); } } else if (compilerType == AOTCompilerType.System64 && currAbi == Abi.x86_64) { return("mono64"); } Assert.Fail("GetMonoPath with invalid option"); return(""); }
List <string> GetFiledAOTed(AOTCompilerType compilerType = AOTCompilerType.Bundled64, AOTKind kind = AOTKind.Standard) { List <string> filesAOTed = new List <string> (); foreach (var command in commandsRun) { Assert.IsTrue(command.Item1.EndsWith(GetExpectedMonoCommand(compilerType)), "Unexpected command: " + command.Item1); if (kind == AOTKind.Hybrid) { Assert.AreEqual(command.Item2.Split(' ')[0], "--aot=hybrid", "First arg should be --aot=hybrid"); } else { Assert.AreEqual(command.Item2.Split(' ')[0], "--aot", "First arg should be --aot"); } string fileName = command.Item2.Substring(command.Item2.IndexOf(' ') + 1).Replace("\"", ""); filesAOTed.Add(fileName); } return(filesAOTed); }
public AOTCompiler(AOTOptions options, AOTCompilerType compilerType) { this.options = options; this.compilerType = compilerType; }