Beispiel #1
0
        private readonly IEnumerable <string> _appArguments; // Arguments that will be passed to the iOS application

        public AppRunner(
            IMlaunchProcessManager processManager,
            IHardwareDeviceLoader hardwareDeviceLoader,
            ISimulatorLoader simulatorLoader,
            ICrashSnapshotReporterFactory snapshotReporterFactory,
            ICaptureLogFactory captureLogFactory,
            IDeviceLogCapturerFactory deviceLogCapturerFactory,
            IExitCodeDetector exitCodeDetector,
            IFileBackedLog mainLog,
            ILogs logs,
            IHelpers helpers,
            IEnumerable <string> appArguments,
            Action <string>?logCallback = null)
            : base(hardwareDeviceLoader, mainLog, logCallback)
        {
            _processManager           = processManager ?? throw new ArgumentNullException(nameof(processManager));
            _simulatorLoader          = simulatorLoader ?? throw new ArgumentNullException(nameof(simulatorLoader));
            _snapshotReporterFactory  = snapshotReporterFactory ?? throw new ArgumentNullException(nameof(snapshotReporterFactory));
            _captureLogFactory        = captureLogFactory ?? throw new ArgumentNullException(nameof(captureLogFactory));
            _deviceLogCapturerFactory = deviceLogCapturerFactory ?? throw new ArgumentNullException(nameof(deviceLogCapturerFactory));
            _exitCodeDetector         = exitCodeDetector ?? throw new ArgumentNullException(nameof(exitCodeDetector));
            _logs         = logs ?? throw new ArgumentNullException(nameof(logs));
            _helpers      = helpers ?? throw new ArgumentNullException(nameof(helpers));
            _appArguments = appArguments;
        }
    public CrashSnapshotReporter(IMlaunchProcessManager processManager,
                                 ILog log,
                                 ILogs logs,
                                 bool isDevice,
                                 string deviceName,
                                 Func <string> tempFileProvider = null)
    {
        _processManager   = processManager ?? throw new ArgumentNullException(nameof(processManager));
        _log              = log ?? throw new ArgumentNullException(nameof(log));
        _logs             = logs ?? throw new ArgumentNullException(nameof(logs));
        _isDevice         = isDevice;
        _deviceName       = deviceName;
        _tempFileProvider = tempFileProvider ?? Path.GetTempFileName;

        _symbolicateCrashPath = Path.Combine(processManager.XcodeRoot, "Contents", "SharedFrameworks", "DTDeviceKitBase.framework", "Versions", "A", "Resources", "symbolicatecrash");
        if (!File.Exists(_symbolicateCrashPath))
        {
            _symbolicateCrashPath = Path.Combine(processManager.XcodeRoot, "Contents", "SharedFrameworks", "DVTFoundation.framework", "Versions", "A", "Resources", "symbolicatecrash");
        }

        if (!File.Exists(_symbolicateCrashPath))
        {
            _symbolicateCrashPath = null;
        }
    }
Beispiel #3
0
 public AppInstaller(IMlaunchProcessManager processManager, IHardwareDeviceLoader deviceLoader, ILog mainLog, int verbosity)
 {
     _processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
     _deviceLoader   = deviceLoader ?? throw new ArgumentNullException(nameof(deviceLoader));
     _mainLog        = mainLog ?? throw new ArgumentNullException(nameof(mainLog));
     _verbosity      = verbosity;
 }
Beispiel #4
0
 public MacTestTasksEnumerable(Jenkins jenkins,
                               IMlaunchProcessManager processManager,
                               ICrashSnapshotReporterFactory crashReportSnapshotFactory,
                               ITestVariationsFactory testVariationsFactory)
 {
     this.jenkins                    = jenkins ?? throw new ArgumentNullException(nameof(jenkins));
     this.processManager             = processManager ?? throw new ArgumentNullException(nameof(processManager));
     this.crashReportSnapshotFactory = crashReportSnapshotFactory ?? throw new ArgumentNullException(nameof(crashReportSnapshotFactory));
     this.testVariationsFactory      = testVariationsFactory ?? throw new ArgumentNullException(nameof(testVariationsFactory));
 }
Beispiel #5
0
 public AppRunnerFactory(
     IMlaunchProcessManager processManager,
     ICrashSnapshotReporterFactory snapshotReporterFactory,
     ICaptureLogFactory captureLogFactory,
     IDeviceLogCapturerFactory deviceLogCapturerFactory,
     IHelpers helpers)
 {
     _processManager           = processManager ?? throw new ArgumentNullException(nameof(processManager));
     _snapshotReporterFactory  = snapshotReporterFactory ?? throw new ArgumentNullException(nameof(snapshotReporterFactory));
     _captureLogFactory        = captureLogFactory ?? throw new ArgumentNullException(nameof(captureLogFactory));
     _deviceLogCapturerFactory = deviceLogCapturerFactory ?? throw new ArgumentNullException(nameof(deviceLogCapturerFactory));
     _helpers = helpers ?? throw new ArgumentNullException(nameof(helpers));
 }
Beispiel #6
0
 public RunTest(IRunTestTask testTask,
                IBuildToolTask buildTask,
                IMlaunchProcessManager processManager,
                IEnvManager envManager,
                ILog mainLog,
                bool generateXmlFailures,
                XmlResultJargon xmlResultJargon, bool dryRun)
 {
     this.testTask            = testTask ?? throw new ArgumentNullException(nameof(testTask));
     this.BuildTask           = buildTask ?? throw new ArgumentNullException(nameof(buildTask));
     this.ProcessManager      = processManager ?? throw new ArgumentNullException(nameof(processManager));
     this.envManager          = envManager ?? throw new ArgumentNullException(nameof(envManager));
     this.mainLog             = mainLog ?? throw new ArgumentNullException(nameof(mainLog));
     this.generateXmlFailures = generateXmlFailures;
     this.dryRun          = dryRun;
     this.xmlResultJargon = xmlResultJargon;
 }
Beispiel #7
0
        public TestReporter(IMlaunchProcessManager processManager,
                            IFileBackedLog mainLog,
                            IReadableLog runLog,
                            ILogs logs,
                            ICrashSnapshotReporter crashReporter,
                            ISimpleListener simpleListener,
                            IResultParser parser,
                            AppBundleInformation appInformation,
                            RunMode runMode,
                            XmlResultJargon xmlJargon,
                            string?device,
                            TimeSpan timeout,
                            string?additionalLogsDirectory  = null,
                            ExceptionLogger?exceptionLogger = null,
                            bool generateHtml = false)
        {
            _processManager          = processManager ?? throw new ArgumentNullException(nameof(processManager));
            _deviceName              = device; // can be null on simulators
            _listener                = simpleListener ?? throw new ArgumentNullException(nameof(simpleListener));
            _mainLog                 = mainLog ?? throw new ArgumentNullException(nameof(mainLog));
            _runLog                  = runLog ?? throw new ArgumentNullException(nameof(runLog));
            _logs                    = logs ?? throw new ArgumentNullException(nameof(logs));
            _crashReporter           = crashReporter ?? throw new ArgumentNullException(nameof(crashReporter));
            _crashLogs               = new Logs(logs.Directory);
            _resultParser            = parser ?? throw new ArgumentNullException(nameof(parser));
            _appInfo                 = appInformation ?? throw new ArgumentNullException(nameof(appInformation));
            _runMode                 = runMode;
            _xmlJargon               = xmlJargon;
            _timeout                 = timeout;
            _additionalLogsDirectory = additionalLogsDirectory;
            _exceptionLogger         = exceptionLogger;
            _timeoutWatch            = Stopwatch.StartNew();
            _generateHtml            = generateHtml;

            CallbackLog = new CallbackLog(line =>
            {
                // MT1111: Application launched successfully, but it's not possible to wait for the app to exit as
                // requested because it's not possible to detect app termination when launching using gdbserver
                _waitedForExit &= line?.Contains("MT1111: ") != true;
                if (line?.Contains("error MT1007") == true)
                {
                    _launchFailure = true;
                }
            });
        }
Beispiel #8
0
 public Jenkins(IHarness harness, IMlaunchProcessManager processManager, IResultParser resultParser, ITunnelBore tunnelBore)
 {
     this.processManager            = processManager ?? throw new ArgumentNullException(nameof(processManager));
     this.TunnelBore                = tunnelBore ?? throw new ArgumentNullException(nameof(tunnelBore));
     Harness                        = harness ?? throw new ArgumentNullException(nameof(harness));
     Simulators                     = new SimulatorLoader(processManager);
     Devices                        = new HardwareDeviceLoader(processManager);
     testSelector                   = new TestSelector(this, processManager, new GitHub(harness, processManager));
     testVariationsFactory          = new TestVariationsFactory(this, processManager);
     DeviceLoader                   = new JenkinsDeviceLoader(Simulators, Devices, Logs);
     resourceManager                = new ResourceManager();
     xamarinStorageHtmlReportWriter = new HtmlReportWriter(jenkins: this, resourceManager: resourceManager, resultParser: resultParser);
     // we only care about the vsdrops writer if we are in the CI, locally makes no sense
     if (harness.InCI && !string.IsNullOrEmpty(Harness.VSDropsUri))
     {
         vsdropsHtmlReportWriter = new HtmlReportWriter(this, resourceManager, resultParser, linksPrefix: Harness.VSDropsUri, embeddedResources: true);
     }
     markdownReportWriter = new MarkdownReportWriter();
 }
Beispiel #9
0
    protected AppRunnerBase(
        IMlaunchProcessManager processManager,
        ICaptureLogFactory captureLogFactory,
        ILogs logs,
        IFileBackedLog mainLog,
        IHelpers helpers,
        Action <string>?logCallback = null)
    {
        _processManager    = processManager ?? throw new ArgumentNullException(nameof(processManager));
        _captureLogFactory = captureLogFactory ?? throw new ArgumentNullException(nameof(captureLogFactory));
        _logs    = logs ?? throw new ArgumentNullException(nameof(logs));
        _helpers = helpers ?? throw new ArgumentNullException(nameof(helpers));

        if (logCallback == null)
        {
            _mainLog = mainLog ?? throw new ArgumentNullException(nameof(mainLog));
        }
        else
        {
            // create using the main as the default log
            _mainLog = Log.CreateReadableAggregatedLog(mainLog, new CallbackLog(logCallback));
        }
    }
 public SimulatorLoaderFactory(IMlaunchProcessManager processManager)
 {
     this.processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
 }
Beispiel #11
0
        public Task <IEnumerable <ITestTask> > CreateAsync(Jenkins jenkins, IMlaunchProcessManager processManager, TestVariationsFactory testVariationsFactory)
        {
            var rv           = new List <RunDeviceTask> ();
            var projectTasks = new List <RunDeviceTask> ();

            foreach (var project in jenkins.Harness.IOSTestProjects)
            {
                if (!project.IsExecutableProject)
                {
                    continue;
                }

                if (project.SkipDeviceVariations)
                {
                    continue;
                }

                bool ignored = project.Ignore ?? !jenkins.IncludeDevice;
                if (!jenkins.IsIncluded(project))
                {
                    ignored = true;
                }
                if (project.IsDotNetProject)
                {
                    ignored = true;
                }

                projectTasks.Clear();

                bool createiOS;
                bool createTodayExtension;
                bool createtvOS;
                bool createwatchOS;

                if (project.GenerateVariations)
                {
                    createiOS            = !project.SkipiOSVariation;
                    createTodayExtension = !project.SkipTodayExtensionVariation;
                    createtvOS           = !project.SkiptvOSVariation;
                    createwatchOS        = !project.SkipwatchOSVariation;
                }
                else
                {
                    createiOS            = project.TestPlatform == TestPlatform.iOS_Unified;
                    createTodayExtension = project.TestPlatform == TestPlatform.iOS_TodayExtension64;
                    createtvOS           = project.TestPlatform == TestPlatform.tvOS;
                    createwatchOS        = project.TestPlatform == TestPlatform.watchOS;
                }

                if (createiOS)
                {
                    var build64 = new MSBuildTask(jenkins: jenkins, testProject: project, processManager: processManager)
                    {
                        ProjectConfiguration = "Debug64",
                        ProjectPlatform      = "iPhone",
                        Platform             = TestPlatform.iOS_Unified64,
                        TestName             = project.Name,
                    };
                    build64.CloneTestProject(jenkins.MainLog, processManager, project, HarnessConfiguration.RootDirectory);
                    projectTasks.Add(new RunDeviceTask(
                                         jenkins: jenkins,
                                         devices: jenkins.Devices,
                                         buildTask: build64,
                                         processManager: processManager,
                                         tunnelBore: jenkins.TunnelBore,
                                         errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
                                         useTcpTunnel: jenkins.Harness.UseTcpTunnel,
                                         candidates: jenkins.Devices.Connected64BitIOS.Where(d => project.IsSupported(d.DevicePlatform, d.ProductVersion)))
                    {
                        Ignored = !jenkins.IncludeiOS64
                    });

                    var build32 = new MSBuildTask(jenkins: jenkins, testProject: project, processManager: processManager)
                    {
                        ProjectConfiguration = project.Name != "dont link" ? "Debug32" : "Release32",
                        ProjectPlatform      = "iPhone",
                        Platform             = TestPlatform.iOS_Unified32,
                        TestName             = project.Name,
                    };
                    build32.CloneTestProject(jenkins.MainLog, processManager, project, HarnessConfiguration.RootDirectory);
                    projectTasks.Add(new RunDeviceTask(
                                         jenkins: jenkins,
                                         devices: jenkins.Devices,
                                         buildTask: build32,
                                         processManager: processManager,
                                         tunnelBore: jenkins.TunnelBore,
                                         errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
                                         useTcpTunnel: jenkins.Harness.UseTcpTunnel,
                                         candidates: jenkins.Devices.Connected32BitIOS.Where(d => project.IsSupported(d.DevicePlatform, d.ProductVersion)))
                    {
                        Ignored = !jenkins.IncludeiOS32
                    });

                    if (createTodayExtension)
                    {
                        var todayProject = project.GenerateVariations ? project.AsTodayExtensionProject() : project;
                        var buildToday   = new MSBuildTask(jenkins: jenkins, testProject: todayProject, processManager: processManager)
                        {
                            ProjectConfiguration = "Debug64",
                            ProjectPlatform      = "iPhone",
                            Platform             = TestPlatform.iOS_TodayExtension64,
                            TestName             = project.Name,
                        };
                        buildToday.CloneTestProject(jenkins.MainLog, processManager, todayProject, HarnessConfiguration.RootDirectory);
                        projectTasks.Add(new RunDeviceTask(
                                             jenkins: jenkins,
                                             devices: jenkins.Devices,
                                             buildTask: buildToday,
                                             processManager: processManager,
                                             tunnelBore: jenkins.TunnelBore,
                                             errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
                                             useTcpTunnel: jenkins.Harness.UseTcpTunnel,
                                             candidates: jenkins.Devices.Connected64BitIOS.Where(d => project.IsSupported(d.DevicePlatform, d.ProductVersion)))
                        {
                            Ignored = !jenkins.IncludeiOSExtensions, BuildOnly = jenkins.ForceExtensionBuildOnly
                        });
                    }
                }

                if (createtvOS)
                {
                    var tvOSProject = project.GenerateVariations ? project.AsTvOSProject() : project;
                    var buildTV     = new MSBuildTask(jenkins: jenkins, testProject: tvOSProject, processManager: processManager)
                    {
                        ProjectConfiguration = "Debug",
                        ProjectPlatform      = "iPhone",
                        Platform             = TestPlatform.tvOS,
                        TestName             = project.Name,
                    };
                    buildTV.CloneTestProject(jenkins.MainLog, processManager, tvOSProject, HarnessConfiguration.RootDirectory);
                    projectTasks.Add(new RunDeviceTask(
                                         jenkins: jenkins,
                                         devices: jenkins.Devices,
                                         buildTask: buildTV,
                                         processManager: processManager,
                                         tunnelBore: jenkins.TunnelBore,
                                         errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
                                         useTcpTunnel: jenkins.Harness.UseTcpTunnel,
                                         candidates: jenkins.Devices.ConnectedTV.Where(d => project.IsSupported(d.DevicePlatform, d.ProductVersion)))
                    {
                        Ignored = !jenkins.IncludetvOS
                    });
                }

                if (createwatchOS)
                {
                    var watchOSProject = project.GenerateVariations ? project.AsWatchOSProject() : project;
                    if (!project.SkipwatchOS32Variation)
                    {
                        var buildWatch32 = new MSBuildTask(jenkins: jenkins, testProject: watchOSProject, processManager: processManager)
                        {
                            ProjectConfiguration = "Debug32",
                            ProjectPlatform      = "iPhone",
                            Platform             = TestPlatform.watchOS_32,
                            TestName             = project.Name,
                        };
                        buildWatch32.CloneTestProject(jenkins.MainLog, processManager, watchOSProject, HarnessConfiguration.RootDirectory);
                        projectTasks.Add(new RunDeviceTask(
                                             jenkins: jenkins,
                                             devices: jenkins.Devices,
                                             buildTask: buildWatch32,
                                             processManager: processManager,
                                             tunnelBore: jenkins.TunnelBore,
                                             errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
                                             useTcpTunnel: jenkins.Harness.UseTcpTunnel,
                                             candidates: jenkins.Devices.ConnectedWatch)
                        {
                            Ignored = !jenkins.IncludewatchOS
                        });
                    }

                    if (!project.SkipwatchOSARM64_32Variation)
                    {
                        var buildWatch64_32 = new MSBuildTask(jenkins: jenkins, testProject: watchOSProject, processManager: processManager)
                        {
                            ProjectConfiguration = "Release64_32",                             // We don't support Debug for ARM64_32 yet.
                            ProjectPlatform      = "iPhone",
                            Platform             = TestPlatform.watchOS_64_32,
                            TestName             = project.Name,
                        };
                        buildWatch64_32.CloneTestProject(jenkins.MainLog, processManager, watchOSProject, HarnessConfiguration.RootDirectory);
                        projectTasks.Add(new RunDeviceTask(
                                             jenkins: jenkins,
                                             devices: jenkins.Devices,
                                             buildTask: buildWatch64_32,
                                             processManager: processManager,
                                             tunnelBore: jenkins.TunnelBore,
                                             errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
                                             useTcpTunnel: jenkins.Harness.UseTcpTunnel,
                                             candidates: jenkins.Devices.ConnectedWatch32_64.Where(d => project.IsSupported(d.DevicePlatform, d.ProductVersion)))
                        {
                            Ignored = !jenkins.IncludewatchOS
                        });
                    }
                }
                foreach (var task in projectTasks)
                {
                    task.TimeoutMultiplier = project.TimeoutMultiplier;
                    task.BuildOnly        |= project.BuildOnly;
                    task.Ignored          |= ignored;
                }
                rv.AddRange(projectTasks);
            }

            return(Task.FromResult <IEnumerable <ITestTask> > (testVariationsFactory.CreateTestVariations(rv, (buildTask, test, candidates)
                                                                                                          => new RunDeviceTask(
                                                                                                              jenkins: jenkins,
                                                                                                              devices: jenkins.Devices,
                                                                                                              buildTask: buildTask,
                                                                                                              processManager: processManager,
                                                                                                              tunnelBore: jenkins.TunnelBore,
                                                                                                              errorKnowledgeBase: jenkins.ErrorKnowledgeBase,
                                                                                                              useTcpTunnel: jenkins.Harness.UseTcpTunnel,
                                                                                                              candidates: candidates?.Cast <IHardwareDevice> () ?? test.Candidates))));
        }
Beispiel #12
0
 public RunXITask(Jenkins jenkins, BuildToolTask build_task, IMlaunchProcessManager processManager, IEnumerable <TDevice> candidates)
     : base(jenkins, build_task, processManager)
 {
     this.Candidates = candidates;
 }
Beispiel #13
0
 public AppInstaller(IMlaunchProcessManager processManager, ILog mainLog)
 {
     _processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
     _mainLog        = mainLog ?? throw new ArgumentNullException(nameof(mainLog));
 }
 public NUnitExecuteTask(Jenkins jenkins, BuildToolTask build_task, IMlaunchProcessManager processManager)
     : base(jenkins, build_task, processManager)
 {
 }
Beispiel #15
0
 public RunXtroTask(Jenkins jenkins, BuildToolTask build_task, IMlaunchProcessManager processManager, ICrashSnapshotReporterFactory crashReportSnapshotFactory)
     : base(jenkins, build_task, processManager, crashReportSnapshotFactory)
 {
 }
        public async Task <IEnumerable <ITestTask> > CreateAsync(Jenkins jenkins, IMlaunchProcessManager processManager, TestVariationsFactory testVariationsFactory)
        {
            var runSimulatorTasks = new List <RunSimulatorTask> ();

            foreach (var project in jenkins.Harness.IOSTestProjects)
            {
                if (!project.IsExecutableProject)
                {
                    continue;
                }

                bool ignored = project.Ignore ?? !jenkins.IncludeSimulator;
                if (!jenkins.IsIncluded(project))
                {
                    ignored = true;
                }

                var ps = new List <Tuple <TestProject, TestPlatform, bool> > ();
                if (!project.GenerateVariations)
                {
                    ps.Add(new Tuple <TestProject, TestPlatform, bool> (project, project.TestPlatform, ignored));
                }
                else
                {
                    if (!project.SkipiOSVariation)
                    {
                        ps.Add(new Tuple <TestProject, TestPlatform, bool> (project, TestPlatform.iOS_Unified, ignored));
                    }
                    if (project.MonoNativeInfo != null)
                    {
                        ps.Add(new Tuple <TestProject, TestPlatform, bool> (project, TestPlatform.iOS_TodayExtension64, ignored));
                    }
                    if (!project.SkiptvOSVariation)
                    {
                        ps.Add(new Tuple <TestProject, TestPlatform, bool> (project.AsTvOSProject(), TestPlatform.tvOS, ignored));
                    }
                    if (!project.SkipwatchOSVariation)
                    {
                        ps.Add(new Tuple <TestProject, TestPlatform, bool> (project.AsWatchOSProject(), TestPlatform.watchOS, ignored));
                    }
                }

                var configurations = project.Configurations;
                if (configurations == null)
                {
                    configurations = new string [] { "Debug" }
                }
                ;
                foreach (var config in configurations)
                {
                    foreach (var pair in ps)
                    {
                        var configIgnored = pair.Item3;
                        var testPlatform  = pair.Item2;
                        switch (testPlatform)
                        {
                        case TestPlatform.iOS_Unified:
                        case TestPlatform.iOS_TodayExtension64:
                            configIgnored |= !jenkins.IncludeiOS64;
                            break;

                        case TestPlatform.tvOS:
                            configIgnored |= !jenkins.IncludetvOS;
                            break;

                        case TestPlatform.watchOS:
                            configIgnored |= !jenkins.IncludewatchOS;
                            break;

                        default:
                            Console.WriteLine("Unknown test platform for ignore check: {0}", testPlatform);
                            break;
                        }

                        configIgnored |= project.IsDotNetProject && !jenkins.IncludeDotNet;

                        var derived = new MSBuildTask(jenkins: jenkins, testProject: project, processManager: processManager);
                        derived.ProjectConfiguration = config;
                        derived.ProjectPlatform      = "iPhoneSimulator";
                        derived.Platform             = testPlatform;
                        derived.Ignored    = configIgnored;
                        derived.TestName   = project.Name;
                        derived.Dependency = project.Dependency;
                        derived.CloneTestProject(jenkins.MainLog, processManager, pair.Item1, HarnessConfiguration.RootDirectory);
                        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,
                                                                                candidates: candidates?.Cast <SimulatorDevice> () ?? test.Candidates)).ToList();

            if (jenkins.IsServerMode)
            {
                return(testVariations);
            }

            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, IMlaunchProcessManager 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:
                platforms = new TestPlatform [] { TestPlatform.iOS_Unified64 };
                ignored   = new [] { false };
                break;

            case TestPlatform.iOS_TodayExtension64:
                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,
                                 candidates: sims)
                {
                    Platform = platforms [i],
                    Ignored  = ignored [i] || buildTask.Ignored
                });
            }

            return(runtasks);
        }
    }
Beispiel #17
0
 public TcpTunnel(IMlaunchProcessManager processManager)
 {
     _processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
 }
 public DotNetTestTask(Jenkins jenkins, MSBuildTask build_task, IMlaunchProcessManager processManager)
     : base(jenkins, build_task, processManager)
 {
     MSBuildTask.SetDotNetEnvironmentVariables(Environment);
 }
Beispiel #19
0
 public DeviceLogCapturerFactory(IMlaunchProcessManager processManager)
 {
     this.processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
 }
Beispiel #20
0
 public CrashSnapshotReporterFactory(IMlaunchProcessManager processManager)
 {
     _processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
 }
Beispiel #21
0
 public RunSimulatorTask(Jenkins jenkins, ISimulatorLoader simulators, MSBuildTask buildTask, IMlaunchProcessManager processManager, IEnumerable <ISimulatorDevice> candidates = null)
     : base(jenkins, buildTask, processManager, candidates) => runSimulator = new RunSimulator(
Beispiel #22
0
 public RunDeviceTask(Jenkins jenkins, IHardwareDeviceLoader devices, MSBuildTask buildTask, IMlaunchProcessManager processManager, ITunnelBore tunnelBore, IErrorKnowledgeBase errorKnowledgeBase, bool useTcpTunnel, IEnumerable <IHardwareDevice> candidates)
     : base(jenkins, buildTask, processManager, candidates.OrderBy((v) => v.DebugSpeed))
 {
     TunnelBore = tunnelBore;
     runDevice  = new RunDevice(
         testTask: this,
         devices: devices,
         resourceManager: ResourceManager,
         mainLog: Jenkins.MainLog,
         deviceLoadLog: Jenkins.DeviceLoadLog,
         errorKnowledgeBase: errorKnowledgeBase,
         defaultLogDirectory: Jenkins.Harness.LogDirectory,
         uninstallTestApp: Jenkins.UninstallTestApp,
         cleanSuccessfulTestRuns: Jenkins.CleanSuccessfulTestRuns,
         generateXmlFailures: Jenkins.Harness.InCI,
         inCI: Jenkins.Harness.InCI,
         useTcpTunnel: useTcpTunnel,
         xmlResultJargon: Jenkins.Harness.XmlJargon
         );
 }
Beispiel #23
0
 public TCCDatabase(IMlaunchProcessManager processManager)
 {
     _processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
 }
Beispiel #24
0
 public HardwareDeviceLoader(IMlaunchProcessManager processManager)
 {
     _processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
 }
Beispiel #25
0
 public MacExecuteTask(Jenkins jenkins, BuildToolTask build_task, IMlaunchProcessManager processManager, ICrashSnapshotReporterFactory crashReportSnapshotFactory)
     : base(jenkins, build_task, processManager)
 {
     this.CrashReportSnapshotFactory = crashReportSnapshotFactory ?? throw new ArgumentNullException(nameof(crashReportSnapshotFactory));
 }
 public NUnitTestTasksEnumerable(Jenkins jenkins, IMlaunchProcessManager processManager)
 {
     this.jenkins        = jenkins ?? throw new ArgumentNullException(nameof(jenkins));
     this.processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
 }
Beispiel #27
0
 public AppUninstaller(IMlaunchProcessManager processManager, ILog mainLog, int verbosity)
 {
     _processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
     _mainLog        = mainLog ?? throw new ArgumentNullException(nameof(mainLog));
     _verbosity      = verbosity;
 }
Beispiel #28
0
 public SimulatorDevice(IMlaunchProcessManager processManager, ITCCDatabase tccDatabase)
 {
     _processManager = processManager ?? throw new ArgumentNullException(nameof(processManager));
     _tCCDatabase    = tccDatabase ?? throw new ArgumentNullException(nameof(tccDatabase));
 }