Exemple #1
0
        void AutoConfigureMac()
        {
            var test_suites = new [] { new { ProjectFile = "apitest", Name = "apitest" }, new { ProjectFile = "dontlink-mac", Name = "dont link" } };

            foreach (var p in test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.ProjectFile + "/" + p.ProjectFile + ".sln")))
                {
                    Name = p.Name
                });
            }

            MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern)
            {
                Name = "introspection"
            });

            var hard_coded_test_suites = new [] {
                new { ProjectFile = "mmptest", Name = "mmptest", IsNUnit = true, Configurations = (string[])null },
                new { ProjectFile = "msbuild-mac", Name = "MSBuild tests", IsNUnit = false, Configurations = (string[])null },
                new { ProjectFile = "xammac_tests", Name = "xammac tests", IsNUnit = false, Configurations = new string [] { "Debug", "Release" } },
            };

            foreach (var p in hard_coded_test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.ProjectFile + "/" + p.ProjectFile + ".csproj")), generateVariations: false)
                {
                    Name           = p.Name,
                    IsNUnitProject = p.IsNUnit,
                    SolutionPath   = Path.GetFullPath(Path.Combine(RootDirectory, "tests-mac.sln")),
                    Configurations = p.Configurations,
                });
            }

            var bcl_suites = new string[] { "mscorlib", "System", "System.Core", "System.Data", "System.Net.Http", "System.Numerics", "System.Runtime.Serialization", "System.Transactions", "System.Web.Services", "System.Xml", "System.Xml.Linq", "Mono.Security", "System.ComponentModel.DataAnnotations", "System.Json", "System.ServiceModel.Web", "Mono.Data.Sqlite" };

            foreach (var p in bcl_suites)
            {
                foreach (var flavor in new MacFlavors [] { MacFlavors.Full, MacFlavors.Modern })
                {
                    var bclTestInfo    = new MacBCLTestInfo(this, p, flavor);
                    var bclTestProject = new MacTestProject(bclTestInfo.ProjectPath, targetFrameworkFlavor: flavor, generateVariations: false)
                    {
                        Name    = p,
                        BCLInfo = bclTestInfo
                    };

                    MacTestProjects.Add(bclTestProject);
                }
            }
        }
Exemple #2
0
        void AutoConfigureMac()
        {
            var test_suites = new [] {
                new { Directory = "apitest", ProjectFile = "apitest", Name = "apitest", GenerateSystem = false },
                new { Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link", GenerateSystem = true },
            };

            foreach (var p in test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.Directory + "/" + p.ProjectFile + ".sln")))
                {
                    Name = p.Name,
                    TargetFrameworkFlavor = p.GenerateSystem ? MacFlavors.All : MacFlavors.NonSystem,
                });
            }

            MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern)
            {
                Name = "introspection"
            });

            var hard_coded_test_suites = new [] {
                new { Directory = "mmptest", ProjectFile = "mmptest", Name = "mmptest", IsNUnit = true, Configurations = (string[])null, Platform = "x86", },
                new { Directory = "msbuild-mac", ProjectFile = "msbuild-mac", Name = "MSBuild tests", IsNUnit = true, Configurations = (string[])null, Platform = "x86" },
                new { Directory = "xammac_tests", ProjectFile = "xammac_tests", Name = "xammac tests", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "AnyCPU" },
                new { Directory = "linker/mac/link all", ProjectFile = "link all-mac", Name = "link all", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", },
                new { Directory = "linker/mac/link sdk", ProjectFile = "link sdk-mac", Name = "link sdk", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", },
            };

            foreach (var p in hard_coded_test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.Directory + "/" + p.ProjectFile + ".csproj")), generateVariations: false)
                {
                    Name           = p.Name,
                    IsNUnitProject = p.IsNUnit,
                    SolutionPath   = Path.GetFullPath(Path.Combine(RootDirectory, "tests-mac.sln")),
                    Configurations = p.Configurations,
                    Platform       = p.Platform,
                });
            }

            var bcl_suites = new string[] {
                "mscorlib",
                "System",
                "System.Core",
                "System.Data",
                "System.Net.Http",
                "System.Numerics",
                "System.Runtime.Serialization",
                "System.Transactions", "System.Web.Services",
                "System.Xml",
                "System.Xml.Linq",
                "Mono.Security",
                "System.ComponentModel.DataAnnotations",
                "System.Json",
                "System.ServiceModel.Web",
                "Mono.Data.Sqlite",
                "Mono.Data.Tds",
                "System.IO.Compression",
                "System.IO.Compression.FileSystem",
                "Mono.CSharp",
                "System.Security",
                "System.ServiceModel",
                "System.IdentityModel",
            };

            foreach (var p in bcl_suites)
            {
                foreach (var flavor in new MacFlavors [] { MacFlavors.Full, MacFlavors.Modern })
                {
                    var bclTestInfo    = new MacBCLTestInfo(this, p, flavor);
                    var bclTestProject = new MacTestProject(bclTestInfo.ProjectPath, targetFrameworkFlavor: flavor, generateVariations: false)
                    {
                        Name     = p,
                        BCLInfo  = bclTestInfo,
                        Platform = "AnyCPU",
                    };

                    MacTestProjects.Add(bclTestProject);
                }
            }
            var monoImportTestFactory = new BCLTestImportTargetFactory(this);

            MacTestProjects.AddRange(monoImportTestFactory.GetMacBclTargets());
        }
Exemple #3
0
        void AutoConfigureMac()
        {
            var test_suites = new [] {
                new { Directory = "apitest", ProjectFile = "apitest", Name = "apitest", GenerateSystem = false },
                new { Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link", GenerateSystem = true },
            };

            foreach (var p in test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.Directory + "/" + p.ProjectFile + ".sln")))
                {
                    Name = p.Name,
                    TargetFrameworkFlavor = p.GenerateSystem ? MacFlavors.All : MacFlavors.NonSystem,
                });
            }

            MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern)
            {
                Name = "introspection"
            });

            var hard_coded_test_suites = new [] {
                new { Directory = "mmptest", ProjectFile = "mmptest", Name = "mmptest", IsNUnit = true, Configurations = (string[])null, Platform = "x86", },
                new { Directory = "msbuild-mac", ProjectFile = "msbuild-mac", Name = "MSBuild tests", IsNUnit = true, Configurations = (string[])null, Platform = "x86" },
                new { Directory = "xammac_tests", ProjectFile = "xammac_tests", Name = "xammac tests", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "AnyCPU" },
                new { Directory = "linker/mac/link all", ProjectFile = "link all-mac", Name = "link all", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", },
                new { Directory = "linker/mac/link sdk", ProjectFile = "link sdk-mac", Name = "link sdk", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", },
            };

            foreach (var p in hard_coded_test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.Directory + "/" + p.ProjectFile + ".csproj")), generateVariations: false)
                {
                    Name           = p.Name,
                    IsNUnitProject = p.IsNUnit,
                    SolutionPath   = Path.GetFullPath(Path.Combine(RootDirectory, "tests-mac.sln")),
                    Configurations = p.Configurations,
                    Platform       = p.Platform,
                });
            }

            var bcl_suites = new string[] {
                "mscorlib",
            };

            foreach (var p in bcl_suites)
            {
                foreach (var flavor in new MacFlavors [] { MacFlavors.Full, MacFlavors.Modern })
                {
                    var bclTestInfo    = new MacBCLTestInfo(this, p, flavor);
                    var bclTestProject = new MacTestProject(bclTestInfo.ProjectPath, targetFrameworkFlavor: flavor, generateVariations: false)
                    {
                        Name     = p,
                        BCLInfo  = bclTestInfo,
                        Platform = "AnyCPU",
                    };

                    MacTestProjects.Add(bclTestProject);
                }
            }

            foreach (var flavor in new MonoNativeFlavor[] { MonoNativeFlavor.Compat, MonoNativeFlavor.Unified })
            {
                foreach (var macFlavor in new MacFlavors[] { MacFlavors.Full, MacFlavors.Modern })
                {
                    var monoNativeInfo = new MacMonoNativeInfo(this, flavor, macFlavor);
                    var macTestProject = new MacTestProject(monoNativeInfo.ProjectPath, targetFrameworkFlavor: macFlavor, generateVariations: true)
                    {
                        MonoNativeInfo = monoNativeInfo,
                        Name           = monoNativeInfo.ProjectName,
                        Platform       = "AnyCPU"
                    };

                    MacTestProjects.Add(macTestProject);
                }
            }

            var monoImportTestFactory = new BCLTestImportTargetFactory(this);

            MacTestProjects.AddRange(monoImportTestFactory.GetMacBclTargets());
        }
Exemple #4
0
        int AutoConfigureMac(bool generate_projects)
        {
            int rv = 0;

            var test_suites = new [] {
                new { Directory = "apitest", ProjectFile = "apitest", Name = "apitest", Flavors = MacFlavors.Full | MacFlavors.Modern },
                new { Directory = "linker/mac/dont link", ProjectFile = "dont link-mac", Name = "dont link", Flavors = MacFlavors.Modern | MacFlavors.Full | MacFlavors.System },
            };

            foreach (var p in test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.Directory, p.ProjectFile + ".csproj")))
                {
                    Name = p.Name,
                    TargetFrameworkFlavors = p.Flavors,
                });
            }

            MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, "introspection", "Mac", "introspection-mac.csproj")), targetFrameworkFlavor: MacFlavors.Modern)
            {
                Name = "introspection"
            });

            var hard_coded_test_suites = new [] {
                new { Directory = "mmptest", ProjectFile = "mmptest", Name = "mmptest", IsNUnit = true, Configurations = (string[])null, Platform = "x86", Flavors = MacFlavors.Console, },
                new { Directory = "msbuild-mac", ProjectFile = "msbuild-mac", Name = "MSBuild tests", IsNUnit = true, Configurations = (string[])null, Platform = "x86", Flavors = MacFlavors.Console, },
                new { Directory = "xammac_tests", ProjectFile = "xammac_tests", Name = "xammac tests", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "AnyCPU", Flavors = MacFlavors.Modern, },
                new { Directory = "linker/mac/link all", ProjectFile = "link all-mac", Name = "link all", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, },
                new { Directory = "linker/mac/link sdk", ProjectFile = "link sdk-mac", Name = "link sdk", IsNUnit = false, Configurations = new string [] { "Debug", "Release" }, Platform = "x86", Flavors = MacFlavors.Modern, },
            };

            foreach (var p in hard_coded_test_suites)
            {
                MacTestProjects.Add(new MacTestProject(Path.GetFullPath(Path.Combine(RootDirectory, p.Directory, p.ProjectFile + ".csproj")), targetFrameworkFlavor: p.Flavors)
                {
                    Name           = p.Name,
                    IsNUnitProject = p.IsNUnit,
                    SolutionPath   = Path.GetFullPath(Path.Combine(RootDirectory, "tests-mac.sln")),
                    Configurations = p.Configurations,
                    Platform       = p.Platform,
                });
            }

            var bcl_suites = new string[] {
            };

            foreach (var p in bcl_suites)
            {
                var bclTestInfo    = new MacBCLTestInfo(this, p);
                var bclTestProject = new MacTestProject(bclTestInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full)
                {
                    Name     = p,
                    BCLInfo  = bclTestInfo,
                    Platform = "AnyCPU",
                };

                MacTestProjects.Add(bclTestProject);
            }

            foreach (var flavor in new MonoNativeFlavor [] { MonoNativeFlavor.Compat, MonoNativeFlavor.Unified })
            {
                var monoNativeInfo = new MacMonoNativeInfo(this, flavor);
                var macTestProject = new MacTestProject(monoNativeInfo.ProjectPath, targetFrameworkFlavor: MacFlavors.Modern | MacFlavors.Full)
                {
                    MonoNativeInfo = monoNativeInfo,
                    Name           = monoNativeInfo.ProjectName,
                    Platform       = "AnyCPU",
                };

                MacTestProjects.Add(macTestProject);
            }

            var monoImportTestFactory = new BCLTestImportTargetFactory(this);

            MacTestProjects.AddRange(monoImportTestFactory.GetMacBclTargets());

            // Generate test projects from templates (bcl/mono-native templates)
            if (generate_projects)
            {
                foreach (var bclTestInfo in MacTestProjects.Where(x => x.BCLInfo != null).Select(x => x.BCLInfo))
                {
                    bclTestInfo.Convert();
                }

                foreach (var mtp in MacTestProjects.Where(x => x.MonoNativeInfo != null).Select(x => x.MonoNativeInfo))
                {
                    mtp.Convert();
                }
            }

            // All test projects should be either Modern projects or NUnit/console executables at this point.
            // If we need to generate Full/System variations, we do that here.
            var unified_targets = new List <MacTarget> ();

            Action <MacTarget, string, bool, bool> configureTarget = (MacTarget target, string file, bool isNUnitProject, bool skip_generation) => {
                target.TemplateProjectPath = file;
                target.Harness             = this;
                target.IsNUnitProject      = isNUnitProject;
                if (!generate_projects || skip_generation)
                {
                    target.ShouldSkipProjectGeneration = true;
                }
                target.Execute();
            };

            foreach (var proj in MacTestProjects)
            {
                var target = new MacTarget(MacFlavors.Modern);
                target.MonoNativeInfo = proj.MonoNativeInfo;
                configureTarget(target, proj.Path, proj.IsNUnitProject, true);
                unified_targets.Add(target);
            }

            foreach (var proj in MacTestProjects.Where((v) => v.GenerateVariations).ToArray())
            {
                var file = proj.Path;
                if (!File.Exists(file))
                {
                    Console.WriteLine($"Can't find the project file {file}.");
                    rv = 1;
                    continue;
                }

                // Generate variations if requested
                if (proj.GenerateFull)
                {
                    var target = new MacTarget(MacFlavors.Full);
                    target.MonoNativeInfo = proj.MonoNativeInfo;
                    configureTarget(target, file, proj.IsNUnitProject, false);
                    unified_targets.Add(target);

                    var cloned_project = (MacTestProject)proj.Clone();
                    cloned_project.TargetFrameworkFlavors = MacFlavors.Full;
                    cloned_project.Path = target.ProjectPath;
                    MacTestProjects.Add(cloned_project);
                }

                if (proj.GenerateSystem)
                {
                    var target = new MacTarget(MacFlavors.System);
                    target.MonoNativeInfo = proj.MonoNativeInfo;
                    configureTarget(target, file, proj.IsNUnitProject, false);
                    unified_targets.Add(target);

                    var cloned_project = (MacTestProject)proj.Clone();
                    cloned_project.TargetFrameworkFlavors = MacFlavors.System;
                    cloned_project.Path = target.ProjectPath;
                    MacTestProjects.Add(cloned_project);
                }

                // We're done generating now
                // Re-use the existing TestProject instance instead of creating a new one.
                proj.TargetFrameworkFlavors = MacFlavors.Modern;                 // the default/template flavor is 'Modern'
            }

            if (generate_projects)
            {
                MakefileGenerator.CreateMacMakefile(this, unified_targets);
            }

            return(rv);
        }