示例#1
0
        protected void AddAllowlistEntry(FileArtifact allowlistFile, bool cacheableAllowlist = false, bool testCompatibility = false)
        {
            var entry = new Configuration.Mutable.FileAccessAllowlistEntry()
            {
                Value        = "testValue",
                PathFragment = ArtifactToString(allowlistFile),
            };

            if (testCompatibility)
            {
                if (cacheableAllowlist)
                {
                    Configuration.CacheableFileAccessWhitelist.Add(entry);
                }
                else
                {
                    Configuration.FileAccessWhiteList.Add(entry);
                }
            }
            else
            {
                if (cacheableAllowlist)
                {
                    Configuration.CacheableFileAccessAllowlist.Add(entry);
                }
                else
                {
                    Configuration.FileAccessAllowList.Add(entry);
                }
            }
        }
        public void NonCacheableAllowlistPipMiss()
        {
            FileArtifact allowlistFile = CreateSourceFile();
            var          entry         = new BuildXLConfiguration.Mutable.FileAccessAllowlistEntry()
            {
                Value        = "testValue",
                PathFragment = ArtifactToString(allowlistFile),
            };

            Configuration.FileAccessAllowList.Add(entry);

            Process pip = CreateAndSchedulePipBuilder(new Operation[]
            {
                Operation.ReadFile(allowlistFile, doNotInfer: true),
                Operation.WriteFile(CreateOutputFileArtifact())
            }).Process;

            ScheduleRunResult buildA = RunScheduler().AssertCacheMiss(pip.PipId);

            ScheduleRunResult buildB = RunScheduler().AssertCacheMiss(pip.PipId);
            var messages             = new string[] { "disallowed file accesses", PipCacheMissType.MissForDescriptorsDueToWeakFingerprints.ToString() };

            RunAnalyzer(buildA, buildB).AssertPipMiss(
                pip,
                PipCacheMissType.MissForDescriptorsDueToWeakFingerprints,
                messages);
        }