public void MemoizationCacheDeterminismRoundTrip(int determinism) { MemoizationCacheDeterminism memoizationCacheDeterminism = m_memoizationDeterminism[determinism]; MemoizationCacheDeterminism roundTrip = memoizationCacheDeterminism.FromMemoization().ToMemoization(); AssertDeterminismEqualEnough(memoizationCacheDeterminism, roundTrip); }
public void MemoizationCacheDeterminismFromMemoization(int determinism) { MemoizationCacheDeterminism memoizationCacheDeterminism = m_memoizationDeterminism[determinism]; BuildXLCacheDeterminism buildXLCacheDeterminism = memoizationCacheDeterminism.FromMemoization(); AssertDeterminismEqualEnough(buildXLCacheDeterminism, memoizationCacheDeterminism); }
public void BuildXLCacheDeterminismToMemoization(int determinism) { BuildXLCacheDeterminism buildXLCacheDeterminism = m_buildXLDeterminism[determinism]; MemoizationCacheDeterminism memoizationCacheDeterminism = buildXLCacheDeterminism.ToMemoization(); AssertDeterminismEqualEnough(buildXLCacheDeterminism, memoizationCacheDeterminism); }
private static void AssertDeterminismEqualEnough(MemoizationCacheDeterminism expected, MemoizationCacheDeterminism actual) { if (!expected.IsDeterministic) { Assert.Equal(expected.EffectiveGuid, actual.EffectiveGuid); } else { Assert.Equal(expected, actual); } }
/// <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)); }
/// <summary> /// Initializes a new instance of the <see cref="ContentHashListWithDeterminism"/> struct /// </summary> public ContentHashListWithDeterminism(ContentHashList contentHashList, CacheDeterminism determinism) { ContentHashList = contentHashList; Determinism = determinism; }
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); } }