public void ThreadyHashIncludeFiles() { using (var ic = FileCacheStore.Load("testincs")) { var ht = new HashUtil(ic); var hashes = ht.ThreadyDigestFiles(Directory.GetFiles(IncludeDir), true); Assert.IsTrue(hashes.Count > 0); } }
public CompilerCacheBase(string cacheFolder) : this() { Logging.Emit("setting up file stores"); if (string.IsNullOrEmpty(cacheFolder)) throw new ArgumentNullException("cacheFolder"); outputCache = FileCacheStore.Load(Path.Combine(cacheFolder, "outputs")); includeCache = FileCacheStore.Load(Path.Combine(cacheFolder, "includes")); Logging.Emit("setup cache info"); stats = new CacheInfo(outputCache); Logging.Emit("setup hasher"); hasher = new HashUtil(includeCache); }
public CompilerCacheBase(string cacheFolder) : this() { Logging.Emit("setting up file stores"); if (string.IsNullOrEmpty(cacheFolder)) { throw new ArgumentNullException("cacheFolder"); } outputCache = FileCacheStore.Load(Path.Combine(cacheFolder, "outputs")); includeCache = FileCacheStore.Load(Path.Combine(cacheFolder, "includes")); Logging.Emit("setup cache info"); stats = new CacheInfo(outputCache); Logging.Emit("setup hasher"); hasher = new HashUtil(includeCache); }
public void HashIncludeFiles(int threads) { using (var ic = FileCacheStore.Load("testincs")) { var ht = new HashUtil(ic); ht.HashingThreadCount = threads; var files = Directory.GetFiles(IncludeDir); foreach (var f in files) { var hr = ht.DigestSourceFile(f); Assert.IsNotNull(hr.Hash); } } }
public void ThreadyHashIncludeFilesCacheTest() { using (var ic = FileCacheStore.Load("testincs")) { var ht = new HashUtil(ic); var hashes = ht.DigestFiles(Directory.GetFiles(IncludeDir)); Assert.IsTrue(hashes.Count > 0); System.Threading.Thread.Sleep(500); var hashes2 = ht.DigestFiles(Directory.GetFiles(IncludeDir)); foreach (var h in hashes2) { if (hashes.ContainsKey(h.Key)) { Assert.IsTrue(h.Value.Cached); } } } }
public void HashesMatch() { var files = Directory.GetFiles(IncludeDir); using (var ic = FileCacheStore.Load("testincs")) { var ht = new HashUtil(ic); var hashes = ht.ThreadyDigestFiles(files, true); foreach (var f in files) { var hash = ht.DigestSourceFile(f); if (hash.Result == DataHashResult.Ok) { Assert.AreEqual(hash.Hash, hashes[f.ToLower()].Hash); } } Assert.AreEqual(files.Length, hashes.Count); } }