예제 #1
0
        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);
            }
        }
예제 #2
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);
 }
예제 #3
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);
 }
예제 #4
0
 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);
         }
     }
 }
예제 #5
0
        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);
                    }
                }
            }
        }
예제 #6
0
        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);
            }
        }