コード例 #1
0
        public async Task GivenDataSourceWithFailedVerifyPackage_ShouldParseGroupItemsAndCodeParse()
        {
            var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_5.txt"));
            await logParser.Parse((notification) => { });

            Assert.True(logParser.StageGroups.Count == 1);

            Assert.True(logParser.StageGroups[0].GroupStageNo == 2);
            Assert.True(logParser.StageGroups[0].IsStageFailure);
            Assert.False(logParser.StageGroups[0].IsStageSuccess);
            Assert.True(logParser.StageGroups[0].IsStageCompleted);
            Assert.True(logParser.StageGroups[0].StageGroupType == StageGroupType.VerifyPackages);

            var(success, message) = logParser.GetStatement();
            Assert.True(message == "1 error entries(s) found in stage - Verify Packages");
            Assert.False(success);

            var results = logParser.VerifyPackageResults;

            Assert.NotNull(results);
            Assert.True(results.GetErrors().Count == 1);
            Assert.True(results.GetErrors()[0].Item1 == 2);
            Assert.True(results.GetErrors()[0].Item2 == " MSB4057: the target");

            var timeTaken = logParser.GetStageTimeTaken(StageGroupType.VerifyPackages);

            Assert.True(timeTaken?.Hours == 1);
        }
コード例 #2
0
        public async Task GivenDataSourceForGroups_ShouldParseAllGroupItems()
        {
            var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_2.txt"));
            await logParser.Parse((notification) => { });

            Assert.True(logParser.StageGroups.Count == 3);

            Assert.True(logParser.StageGroups[0].GroupStageNo == 1);
            Assert.False(logParser.StageGroups[0].IsStageFailure);
            Assert.True(logParser.StageGroups[0].IsStageSuccess);
            Assert.True(logParser.StageGroups[0].IsStageCompleted);
            Assert.True(logParser.StageGroups[0].StageLineRange.Item1 == 1);
            Assert.True(logParser.StageGroups[0].StageLineRange.Item2 == 2);
            Assert.True(logParser.StageGroups[0].StageGroupType == StageGroupType.SvnUpdate);

            Assert.True(logParser.StageGroups[1].GroupStageNo == 2);
            Assert.False(logParser.StageGroups[1].IsStageFailure);
            Assert.True(logParser.StageGroups[1].IsStageSuccess);
            Assert.True(logParser.StageGroups[1].IsStageCompleted);
            Assert.True(logParser.StageGroups[1].StageLineRange.Item1 == 3);
            Assert.True(logParser.StageGroups[1].StageLineRange.Item2 == 4);
            Assert.True(logParser.StageGroups[1].StageGroupType == StageGroupType.VerifyPackages);

            Assert.True(logParser.StageGroups[2].GroupStageNo == 3);
            Assert.False(logParser.StageGroups[2].IsStageFailure);
            Assert.True(logParser.StageGroups[2].IsStageSuccess);
            Assert.True(logParser.StageGroups[2].IsStageCompleted);
            Assert.True(logParser.StageGroups[2].StageLineRange.Item1 == 5);
            Assert.True(logParser.StageGroups[2].StageLineRange.Item2 == 6);
            Assert.True(logParser.StageGroups[2].StageGroupType == StageGroupType.CodeBuild);

            var(success, message) = logParser.GetStatement();
            Assert.True(message == "Solution build failed: 0 failed project(s), 0 error instance(s)");
            Assert.False(success);
        }
コード例 #3
0
        public async Task GivenBlankPayload_ShouldGiveCorrectBuildStatement()
        {
            var logParser = new BuildLogParser("nonsense");
            await logParser.Parse((notification) => { });

            Assert.True(logParser.StageGroups.Count == 0);
            var(success, message) = logParser.GetStatement();
            Assert.True(message == "No known build stages found in log");
            Assert.False(success);
        }
コード例 #4
0
        public void Should_parse_missing_file_error()
        {
            var logParser = new BuildLogParser();
            var quickfix  = logParser.Parse(
                @"     CSC : error CS2001: Source file 'Bootstrapper.cs' could not be found [C:\_src\OmniSharp\server\OmniSharp\OmniSharp.csproj]");

            quickfix.Text.ShouldEqual(
                @"Source file ''Bootstrapper.cs'' could not be found [C:\_src\OmniSharp\server\OmniSharp\OmniSharp.csproj]");
            quickfix.FileName.ShouldEqual("Bootstrapper.cs");
        }
コード例 #5
0
        public void Should_parse_syntax_error()
        {
            var logParser = new BuildLogParser();
            var quickfix  = logParser.Parse(
                @"         c:\_src\OmniSharp\server\OmniSharp\Program.cs(12,34): error CS1002: ; expected [C:\_src\OmniSharp\server\OmniSharp\OmniSharp.csproj]");

            quickfix.FileName.ShouldEqual(@"c:\_src\OmniSharp\server\OmniSharp\Program.cs");
            quickfix.Line.ShouldEqual(12);
            quickfix.Column.ShouldEqual(34);
            quickfix.Text.ShouldEqual(
                @"[error] ; expected");
        }
コード例 #6
0
        public async Task Run(string payload, Action <string> progress)
        {
            var sync = new object();

            buildLogParser = new BuildLogParser(payload);
            await buildLogParser.Parse((update) =>
            {
                lock (sync)
                {
                    progress?.Invoke(update);
                }
            });
        }
コード例 #7
0
        public async Task GivenBuildCodePayload_ShouldParseCorrectly()
        {
            var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_7.txt"));
            await logParser.Parse((notification) => { });

            Assert.True(logParser.StageGroups.Count == 1);
            var(success, message) = logParser.GetStatement();
            Assert.True(message == "Solution build failed: 3 failed project(s), 13 error instance(s)");
            Assert.False(success);

            var codeResults = logParser.CodeResults;

            Assert.True(codeResults.GetFailedProjectList().Count() == 3);
        }
コード例 #8
0
        public async Task GivenDataSourceForGroupsWithOneFailure_ShouldParseFailedGroupItems()
        {
            var logParser = new BuildLogParser(TestUtils.GetTestFileContents("test_3.txt"));
            await logParser.Parse((notification) => { });

            Assert.True(logParser.StageGroups.Count == 1);

            Assert.True(logParser.StageGroups[0].GroupStageNo == 1);
            Assert.True(logParser.StageGroups[0].IsStageFailure);
            Assert.False(logParser.StageGroups[0].IsStageSuccess);
            Assert.True(logParser.StageGroups[0].IsStageCompleted);
            Assert.True(logParser.StageGroups[0].StageLineRange.Item1 == 1);
            Assert.True(logParser.StageGroups[0].StageLineRange.Item2 == 2);

            var(success, message) = logParser.GetStatement();
            Assert.True(message == "0 error entries(s) found in stage - SVN Update");
            Assert.False(success);
        }