Beispiel #1
0
        public async Task <bool> BuildAsync()
        {
            if (testTask.Finished)
            {
                return(true);
            }

            await testTask.VerifyBuildAsync();

            if (testTask.Finished)
            {
                return(BuildTask.Succeeded);
            }

            testTask.ExecutionResult = TestExecutingResult.Building;
            await BuildTask.RunAsync();

            if (!BuildTask.Succeeded)
            {
                if (BuildTask.TimedOut)
                {
                    testTask.ExecutionResult = TestExecutingResult.TimedOut;
                }
                else
                {
                    testTask.ExecutionResult = TestExecutingResult.BuildFailure;
                }
                testTask.FailureMessage = BuildTask.FailureMessage;
                if (BuildTask.KnownFailure.HasValue)
                {
                    testTask.KnownFailure = BuildTask.KnownFailure;
                }
                if (generateXmlFailures && BuildTask.BuildLog != null && File.Exists(BuildTask.BuildLog.FullPath))
                {
                    try {
                        var logReader = BuildTask.BuildLog.GetReader();
                        ResultParser.GenerateFailure(
                            logs: testTask.Logs,
                            source: "build",
                            appName: testTask.TestName,
                            variation: testTask.Variation,
                            title: $"App Build {testTask.TestName} {testTask.Variation}",
                            message: $"App could not be built {testTask.FailureMessage}.",
                            stderrReader: logReader,
                            jargon: xmlResultJargon);
                    } catch (Exception e) {
                        testTask.FailureMessage += $" (failed to parse the logs: {e.Message})";
                    }
                }
            }
            else
            {
                testTask.ExecutionResult = TestExecutingResult.Built;
            }
            return(BuildTask.Succeeded);
        }
Beispiel #2
0
        public async Task <bool> BuildAsync()
        {
            if (testTask.Finished)
            {
                return(true);
            }

            await testTask.VerifyBuildAsync();

            if (testTask.Finished)
            {
                return(BuildTask.Succeeded);
            }

            testTask.ExecutionResult = TestExecutingResult.Building;
            await BuildTask.RunAsync();

            if (!BuildTask.Succeeded)
            {
                if (BuildTask.TimedOut)
                {
                    testTask.ExecutionResult = TestExecutingResult.TimedOut;
                }
                else
                {
                    testTask.ExecutionResult = TestExecutingResult.BuildFailure;
                }
                testTask.FailureMessage = BuildTask.FailureMessage;
                if (!string.IsNullOrEmpty(BuildTask.KnownFailure))
                {
                    testTask.KnownFailure = BuildTask.KnownFailure;
                }
                if (generateXmlFailures)
                {
                    var logReader = BuildTask.BuildLog.GetReader();
                    ResultParser.GenerateFailure(
                        logs: testTask.Logs,
                        source: "build",
                        appName: testTask.TestName,
                        variation: testTask.Variation,
                        title: $"App Build {testTask.TestName} {testTask.Variation}",
                        message: $"App could not be built {testTask.FailureMessage}.",
                        stderrReader: logReader,
                        jargon: xmlResultJargon);
                }
            }
            else
            {
                testTask.ExecutionResult = TestExecutingResult.Built;
            }
            return(BuildTask.Succeeded);
        }