Exemplo n.º 1
0
        public void ParsingNone_DoesNoAOT()
        {
            var options = new AOTOptions("none");

            Assert.IsFalse(options.IsAOT, "Parsing none should not be IsAOT");
            AssertThrowErrorWithCode(() => Compile(options, new TestFileEnumerator(FullAppFileList)), 99);
        }
Exemplo n.º 2
0
        public void WhenAOTFails_ShouldReturnError()
        {
            RunCommandDelegate runThatErrors = (path, args, env, output, suppressPrintOnErrors) => 42;
            var options = new AOTOptions("all");

            AssertThrowErrorWithCode(() => Compile(options, new TestFileEnumerator(FullAppFileList), onRunDelegate: runThatErrors), 3001);
        }
Exemplo n.º 3
0
        public void ExplicitPositiveFileWithNonExistantFiles_ThrowError()
        {
            var options = new AOTOptions("core,+NonExistant.dll");

            Assert.IsTrue(options.IsAOT, "Should be IsAOT");

            AssertThrowErrorWithCode(() => Compile(options, new TestFileEnumerator(FullAppFileList)), 3009);
        }
Exemplo n.º 4
0
		public void ExplicitNegativeWithNoAssemblies_ShouldNoOp()
		{
			var options = new AOTOptions ("-System.dll");
			Assert.IsTrue (options.IsAOT, "Should be IsAOT");

			Compile (options, new TestFileEnumerator (FullAppFileList));
			AssertFilesAOTed (new string [] {});
		}
Exemplo n.º 5
0
		public void WhenAssemblyStrippingFails_ShouldThrowError ()
		{
			RunCommandDelegate runThatErrors = (path, args, env, output, suppressPrintOnErrors) => path.Contains ("mono-cil-strip") ? 42 : 0;

			var options = new AOTOptions ("all|hybrid");

			AssertThrowErrorWithCode (() => Compile (options, new TestFileEnumerator (FullAppFileList), onRunDelegate : runThatErrors, isRelease : true), 3001);
		}
Exemplo n.º 6
0
		public void Core_ParsingJustCoreFiles()
		{
			var options = new AOTOptions ("core");
			Assert.IsTrue (options.IsAOT, "Should be IsAOT");

			Compile (options, new TestFileEnumerator (FullAppFileList));

			AssertFilesAOTed (CoreXMFileList);
		}
Exemplo n.º 7
0
		public void ExplicitAssembly_JustAOTExplicitFile ()
		{
			var options = new AOTOptions ("+System.dll");
			Assert.IsTrue (options.IsAOT, "Should be IsAOT");

			Compile (options, new TestFileEnumerator (FullAppFileList));

			AssertFilesAOTed (new string [] { "System.dll" });
		}
Exemplo n.º 8
0
		public void CoreWithFullPath_GivesFullPathCommands ()
		{
			var options = new AOTOptions ("core,-Xamarin.Mac.dll");
			Assert.IsTrue (options.IsAOT, "Should be IsAOT");

			Compile (options, new TestFileEnumerator (FullAppFileList.Select (x => TestRootDir + x)));

			AssertFilesAOTed (new string [] { TestRootDir + "mscorlib.dll", TestRootDir + "System.dll" });
		}
Exemplo n.º 9
0
		public void SDK_ParsingJustSDKFiles()
		{
			var options = new AOTOptions ("sdk");
			Assert.IsTrue (options.IsAOT, "Should be IsAOT");

			Compile (options, new TestFileEnumerator (FullAppFileList));

			AssertFilesAOTed (SDKFileList);
		}
Exemplo n.º 10
0
        public void AssemblyWithSpaces_ShouldAOTWithQuotes()
        {
            var options = new AOTOptions("+Foo Bar.dll");

            Assert.IsTrue(options.IsAOT, "Should be IsAOT");

            Compile(options, new TestFileEnumerator(new string [] { "Foo Bar.dll", "Xamarin.Mac.dll" }));
            AssertFilesAOTed(new string [] { "Foo Bar.dll" });
            Assert.IsTrue(commandsRun.Where(x => x.Item2.Contains("Foo Bar.dll")).All(x => x.Item2.EndsWith("\'Foo Bar.dll\'", StringComparison.InvariantCulture)), "Should end with quoted filename");
        }
Exemplo n.º 11
0
		public void All_AOTAllFiles_Modern ()
		{
			var options = new AOTOptions ("all");
			Assert.IsTrue (options.IsAOT, "Should be IsAOT");

			Compile (options, new TestFileEnumerator (FullAppFileList), isModern : true);

			var expectedFiles = FullAppFileList.Where (x => x.EndsWith (".exe") || x.EndsWith (".dll"));
			AssertFilesAOTed (expectedFiles, isModern : true);
		}
Exemplo n.º 12
0
        public void AssemblyWithSpaces_ShouldStripWithQuotes()
        {
            var options = new AOTOptions("all|hybrid,+Foo Bar.dll");

            var files = new string [] { "Foo Bar.dll", "Xamarin.Mac.dll" };

            Compile(options, new TestFileEnumerator(files), isRelease: true);
            AssertFilesStripped(files);
            Assert.IsTrue(commandsRun.Where(x => x.Item2.Contains("Foo Bar.dll")).All(x => x.Item2.EndsWith("\'Foo Bar.dll\'", StringComparison.InvariantCulture)), "Should end with quoted filename");
        }
Exemplo n.º 13
0
        public void HybridOption_ShouldInvokeHybridCompiler()
        {
            var options = new AOTOptions("sdk|hybrid");

            Assert.IsTrue(options.IsAOT, "Should be IsAOT");
            Assert.IsTrue(options.IsHybridAOT, "Should be IsHybridAOT");

            Compile(options, new TestFileEnumerator(FullAppFileList));

            AssertFilesAOTed(SDKFileList, kind: AOTKind.Hybrid);
        }
Exemplo n.º 14
0
		public void AllReleaseNonHybrid_ShouldNotStripButDelete ()
		{
			var options = new AOTOptions ("all");

			Compile (options, new TestFileEnumerator (FullAppFileList), isRelease : true);

			var expectedFiles = FullAppFileList.Where (x => x.EndsWith (".exe") || x.EndsWith (".dll"));
			AssertFilesAOTed (expectedFiles, expectStripping : false, expectSymbolDeletion : true);
			AssertFilesStripped (new string [] {});
			AssertSymbolsDeleted (expectedFiles);
		}
Exemplo n.º 15
0
		public void AllReleaseHybrid_AOTStripAndDelete ()
		{
			var options = new AOTOptions ("all|hybrid");

			Compile (options, new TestFileEnumerator (FullAppFileList), isRelease : true);

			var expectedFiles = FullAppFileList.Where (x => x.EndsWith (".exe") || x.EndsWith (".dll"));
			AssertFilesAOTed (expectedFiles, kind : AOTKind.Hybrid, expectStripping : true, expectSymbolDeletion : true);
			AssertFilesStripped (expectedFiles);
			AssertSymbolsDeleted (expectedFiles);
		}
Exemplo n.º 16
0
		public void HybridOption_ShouldInvokeHybridCompiler ()
		{
			var options = new AOTOptions ("all|hybrid");
			Assert.IsTrue (options.IsAOT, "Should be IsAOT");
			Assert.IsTrue (options.IsHybridAOT, "Should be IsHybridAOT");

			Compile (options, new TestFileEnumerator (FullAppFileList));

			var expectedFiles = FullAppFileList.Where (x => x.EndsWith (".exe") || x.EndsWith (".dll"));
			AssertFilesAOTed (expectedFiles, kind : AOTKind.Hybrid);
		}
Exemplo n.º 17
0
		public void CoreWithInclusionAndSubtraction ()
		{
			var options = new AOTOptions ("core,+Foo.dll,-Xamarin.Mac.dll");
			Assert.IsTrue (options.IsAOT, "Should be IsAOT");
		
			string [] testFiles = { 
				"Foo.dll", "Foo Bar.exe", "libMonoPosixHelper.dylib", "mscorlib.dll", "Xamarin.Mac.dll", "System.dll"
			};
			Compile (options, new TestFileEnumerator (testFiles));

			AssertFilesAOTed (new string [] { "Foo.dll", "mscorlib.dll", "System.dll" });
		}
Exemplo n.º 18
0
		public void PipeFileName_ShouldNotHybridCompiler ()
		{
			foreach (var testCase in new string [] { "+|hybrid.dll", "core,+|hybrid.dll,-Xamarin.Mac.dll" }){
				ClearCommandsRun ();
				var options = new AOTOptions (testCase);
				Assert.IsTrue (options.IsAOT, "Should be IsAOT");
				Assert.IsFalse (options.IsHybridAOT, "Should not be IsHybridAOT");

				Compile (options, new TestFileEnumerator (new string [] { "|hybrid.dll", "Xamarin.Mac.dll" }));
				AssertFilesAOTed (new string [] {"|hybrid.dll"});
			}
		}
Exemplo n.º 19
0
        public void AssemblyWithSpaces_ShouldStripWithQuotes()
        {
            var options = new AOTOptions("all|hybrid,+Foo Bar.dll");

            var files = new string [] { "Foo Bar.dll", "Xamarin.Mac.dll" };

            Compile(options, new TestFileEnumerator(files), isRelease: true);
            AssertFilesStripped(files);
            AssertSymbolsDeleted(files);
            // We don't check end quote here, since we might have .dylib.dSYM suffix
            Assert.IsTrue(commandsRun.Where(x => x.Item2.Contains("Foo Bar.dll")).All(x => x.Item2.Contains("\'Foo Bar.dll")), "Should contain quoted filename");
        }
Exemplo n.º 20
0
		public void DifferentMonoTypes_ShouldInvokeCorrectMono ()
		{
			foreach (var compilerType in new List<AOTCompilerType> () { AOTCompilerType.Bundled64, AOTCompilerType.System64 })
			{
				ClearCommandsRun ();
				var options = new AOTOptions ("sdk");
				Assert.IsTrue (options.IsAOT, "Should be IsAOT");

				Compile (options, new TestFileEnumerator (FullAppFileList), compilerType);

				AssertFilesAOTed (SDKFileList, compilerType);
			}
		}
Exemplo n.º 21
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);
        }
Exemplo n.º 22
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;
			}
		}
Exemplo n.º 23
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;
            }
        }
Exemplo n.º 24
0
		public void HybridOption_MustAlsoHaveAll_ThrowsIfNot ()
		{
			AssertThrowErrorWithCode (() => new AOTOptions ("core|hybrid"), 114);
			AssertThrowErrorWithCode (() => new AOTOptions ("sdk|hybrid"), 114);
			var options = new AOTOptions ("all|hybrid");
		}