Ejemplo n.º 1
0
 public AOTCompiler(AOTOptions options, AOTCompilerType compilerType, bool isModern, bool isRelease)
 {
     this.options      = options;
     this.compilerType = compilerType;
     this.IsModern     = isModern;
     this.IsRelease    = isRelease;
 }
Ejemplo n.º 2
0
		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;
		}
Ejemplo n.º 3
0
 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;
 }
Ejemplo n.º 4
0
		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 ());
		}
Ejemplo n.º 5
0
        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());
        }
Ejemplo n.º 6
0
		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 "";
			}
		}
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
		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;
			}
		}
Ejemplo n.º 10
0
        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("");
            }
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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");
            }
        }
Ejemplo n.º 13
0
        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;
            }
        }
Ejemplo n.º 14
0
 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("");
 }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
 public AOTCompiler(AOTOptions options, AOTCompilerType compilerType)
 {
     this.options      = options;
     this.compilerType = compilerType;
 }