예제 #1
0
        public void TestHasResultsForTarget()
        {
            BuildRequest request = CreateNewBuildRequest(1, new string[0]);
            BuildResult result = new BuildResult(request);
            result.AddResultsForTarget("foo", TestUtilities.GetEmptySucceedingTargetResult());

            Assert.IsTrue(result.HasResultsForTarget("foo"));
            Assert.IsFalse(result.HasResultsForTarget("bar"));
        }
예제 #2
0
        static private bool AreResultsIdenticalForTarget(BuildResult a, BuildResult b, string target)
        {
            if (!a.HasResultsForTarget(target) || !b.HasResultsForTarget(target))
            {
                return false;
            }

            if (a[target].ResultCode != b[target].ResultCode)
            {
                return false;
            }

            if (!AreItemsIdentical(a[target].Items, b[target].Items))
            {
                return false;
            }

            return true;
        }
예제 #3
0
        /// <summary>
        /// Looks for results for the specified targets.
        /// </summary>
        /// <param name="result">The result to examine</param>
        /// <param name="targets">The targets to search for</param>
        /// <param name="targetClass">The class of targets</param>
        /// <param name="targetsMissingResults">An optional list to be populated with missing targets</param>
        /// <param name="skippedResultsAreOK">If true, a status of "skipped" counts as having valid results 
        /// for that target.  Otherwise, a skipped target is treated as equivalent to a missing target.</param>
        /// <returns>False if there were missing results, true otherwise.</returns>
        private bool CheckResults(BuildResult result, List<string> targets, TargetClass targetClass, HashSet<string> targetsMissingResults, bool skippedResultsAreOK)
        {
            bool returnValue = true;
            foreach (string target in targets)
            {
                if (!result.HasResultsForTarget(target) || (result[target].ResultCode == TargetResultCode.Skipped && !skippedResultsAreOK))
                {
                    if (null != targetsMissingResults)
                    {
                        targetsMissingResults.Add(target);
                        returnValue = false;
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    // If the result was a failure and we have not seen any skipped targets up to this point, then we conclude we do 
                    // have results for this request, and they indicate failure.
                    if (result[target].ResultCode == TargetResultCode.Failure && (targetsMissingResults == null || targetsMissingResults.Count == 0))
                    {
                        return true;
                    }
                }
            }

            return returnValue;
        }