Beispiel #1
0
        public void MemoizationCacheDeterminismRoundTrip(int determinism)
        {
            MemoizationCacheDeterminism memoizationCacheDeterminism = m_memoizationDeterminism[determinism];
            MemoizationCacheDeterminism roundTrip = memoizationCacheDeterminism.FromMemoization().ToMemoization();

            AssertDeterminismEqualEnough(memoizationCacheDeterminism, roundTrip);
        }
Beispiel #2
0
        public void MemoizationCacheDeterminismFromMemoization(int determinism)
        {
            MemoizationCacheDeterminism memoizationCacheDeterminism = m_memoizationDeterminism[determinism];
            BuildXLCacheDeterminism     buildXLCacheDeterminism     = memoizationCacheDeterminism.FromMemoization();

            AssertDeterminismEqualEnough(buildXLCacheDeterminism, memoizationCacheDeterminism);
        }
Beispiel #3
0
        public void BuildXLCacheDeterminismToMemoization(int determinism)
        {
            BuildXLCacheDeterminism     buildXLCacheDeterminism     = m_buildXLDeterminism[determinism];
            MemoizationCacheDeterminism memoizationCacheDeterminism = buildXLCacheDeterminism.ToMemoization();

            AssertDeterminismEqualEnough(buildXLCacheDeterminism, memoizationCacheDeterminism);
        }
Beispiel #4
0
 private static void AssertDeterminismEqualEnough(MemoizationCacheDeterminism expected, MemoizationCacheDeterminism actual)
 {
     if (!expected.IsDeterministic)
     {
         Assert.Equal(expected.EffectiveGuid, actual.EffectiveGuid);
     }
     else
     {
         Assert.Equal(expected, actual);
     }
 }
Beispiel #5
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="ContentHashListWithDeterminism"/> struct from its binary
        ///     representation.
        /// </summary>
        public static ContentHashListWithDeterminism Deserialize(BuildXLReader reader)
        {
            Contract.Requires(reader != null);

            var writeContentHashList = reader.ReadBoolean();
            var contentHashList      = writeContentHashList ? ContentHashList.Deserialize(reader) : null;

            var length           = reader.ReadInt32();
            var determinismBytes = reader.ReadBytes(length);
            var determinism      = CacheDeterminism.Deserialize(determinismBytes);

            return(new ContentHashListWithDeterminism(contentHashList, determinism));
        }
Beispiel #6
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ContentHashListWithDeterminism"/> struct
 /// </summary>
 public ContentHashListWithDeterminism(ContentHashList contentHashList, CacheDeterminism determinism)
 {
     ContentHashList = contentHashList;
     Determinism     = determinism;
 }
Beispiel #7
0
 private static void AssertDeterminismEqualEnough(BuildXLCacheDeterminism buildXL, MemoizationCacheDeterminism memoization)
 {
     if (!buildXL.IsDeterministic)
     {
         Assert.Equal(buildXL.EffectiveGuid, memoization.EffectiveGuid);
     }
     else
     {
         Assert.Equal(buildXL.Guid, memoization.Guid);
         Assert.Equal(buildXL.ExpirationUtc, memoization.ExpirationUtc);
     }
 }