Ejemplo n.º 1
0
        public void PipIdWithPrefixFilter()
        {
            RootFilter expected = new RootFilter(
                new PipIdFilter(-8826251658372796143));

            RunPositiveFilterParserTest("id=\'Pip8582DAE1547CB111'", expected);
        }
Ejemplo n.º 2
0
        public void CompoundFilterPrecedence()
        {
            // And has greater precedence than or.
            RootFilter expected = new RootFilter(
                new BinaryFilter(
                    new BinaryFilter(
                        new TagFilter(StringId.Create(StringTable, "Test")),
                        FilterOperator.And,
                        new TagFilter(StringId.Create(StringTable, "csc.exe"))),
                    FilterOperator.Or,
                    new TagFilter(StringId.Create(StringTable, "Test2"))));

            RunPositiveFilterParserTest("tag=\'Test\'andtag=\'csc.exe\'ortag=\'Test2\'", expected);

            RootFilter expected2 = new RootFilter(
                new BinaryFilter(
                    new TagFilter(StringId.Create(StringTable, "Test2")),
                    FilterOperator.Or,
                    new BinaryFilter(
                        new TagFilter(StringId.Create(StringTable, "Test")),
                        FilterOperator.And,
                        new TagFilter(StringId.Create(StringTable, "csc.exe")))));

            RunPositiveFilterParserTest("tag=\'Test2\'ortag=\'csc.exe\'andtag=\'Test\'", expected2);
        }
Ejemplo n.º 3
0
        public void NestedDependencyBinaryFilter()
        {
            RootFilter expected = new RootFilter(
                new BinaryFilter(
                    new DependenciesFilter(
                        new BinaryFilter(
                            new TagFilter(StringId.Create(StringTable, "Test1")),
                            FilterOperator.And,
                            new TagFilter(StringId.Create(StringTable, "Test2")))),
                    FilterOperator.And,
                    new TagFilter(StringId.Create(StringTable, "Test3"))));

            RunPositiveFilterParserTest(" (  dpc( tag = \'Test1\' and tag = \'Test2\' ) and tag = \'Test3\' )", expected);

            expected = new RootFilter(
                new BinaryFilter(
                    new TagFilter(StringId.Create(StringTable, "Test1")),
                    FilterOperator.And,
                    new DependenciesFilter(
                        new BinaryFilter(
                            new TagFilter(StringId.Create(StringTable, "Test2")),
                            FilterOperator.And,
                            new TagFilter(StringId.Create(StringTable, "Test3"))))));

            RunPositiveFilterParserTest(" (  tag = \'Test1\' and dpc( tag = \'Test2\' and tag = \'Test3\' ) )", expected);
        }
Ejemplo n.º 4
0
        public void SingleFilterCopyDependents()
        {
            RootFilter expected = new RootFilter(
                new CopyDependentsFilter(new TagFilter(StringId.Create(StringTable, "Test"))));

            RunPositiveFilterParserTest("copydpt(tag=\'Test\')", expected);
        }
Ejemplo n.º 5
0
        public void TagFilter()
        {
            RootFilter expected = new RootFilter(
                new TagFilter(StringId.Create(StringTable, "Test")));

            RunPositiveFilterParserTest("tag=\'Test\'", expected);
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Creates the scheduler state
 /// </summary>
 public SchedulerState(Scheduler scheduler)
 {
     // If the filter is not applied, rootFilter and filterPassingNodes are null.
     m_rootFilter                 = scheduler.RootFilter;
     m_filterPassingNodes         = scheduler.FilterPassingNodes;
     m_incrementalSchedulingState = scheduler.IncrementalSchedulingState;
 }
Ejemplo n.º 7
0
        public void SingleFilterRequiredInputs()
        {
            RootFilter expected = new RootFilter(
                new DependenciesFilter(new TagFilter(StringId.Create(StringTable, "Test")), ClosureMode.DirectExcludingSelf));

            RunPositiveFilterParserTest("requiredfor(tag=\'Test\')", expected);
        }
Ejemplo n.º 8
0
        public void SingleFilterDoubleNegated()
        {
            RootFilter expected = new RootFilter(
                new TagFilter(StringId.Create(StringTable, "Test")));

            RunPositiveFilterParserTest("~(~(tag=\'Test\'))", expected);
        }
Ejemplo n.º 9
0
        public void DefaultFallback()
        {
            RootFilter filter = ParseFilter(values: null, commandLineFilter: null, defaultFilter: NegatedTagFilter, out _, out _);

            XAssert.IsFalse(filter.IsEmpty);
            XAssert.IsTrue(filter.PipFilter is NegatingFilter);
        }
Ejemplo n.º 10
0
        public void CommandLineFilterIsHighest()
        {
            RootFilter filter = ParseFilter(values: null, commandLineFilter: TagFilter, defaultFilter: NegatedTagFilter, out _, out _);

            XAssert.IsFalse(filter.IsEmpty);
            XAssert.IsFalse(filter.PipFilter is NegatingFilter);
        }
Ejemplo n.º 11
0
        public void ValueFilter()
        {
            FullSymbol identifier = FullSymbol.Create(m_context.SymbolTable, "BuildXL.Transformers.dll");
            RootFilter expected   = new RootFilter(new ValueFilter(identifier));

            RunPositiveFilterParserTest("value=\'BuildXL.Transformers.dll'", expected);
        }
Ejemplo n.º 12
0
        public void OutputFilterFileName()
        {
            RootFilter expected = new RootFilter(
                new OutputFileFilter(AbsolutePath.Invalid, $"{Path.DirectorySeparatorChar}myoutput.dll", MatchMode.PathPrefixWildcard, pathFromMount: false));

            RunPositiveFilterParserTest($"output='*{Path.DirectorySeparatorChar}myoutput.dll'", expected);
        }
Ejemplo n.º 13
0
        public void SingleFilterDependencies()
        {
            RootFilter expected = new RootFilter(
                new DependenciesFilter(new TagFilter(StringId.Create(StringTable, "Test"))));

            RunPositiveFilterParserTest("dpc(tag=\'Test\')", expected);
        }
Ejemplo n.º 14
0
        public void SpecFilterFromMountTrailingWildcard()
        {
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Create(m_context.PathTable, DummyMountPath + $"{Path.DirectorySeparatorChar}hello"), null, MatchMode.WithinDirectoryAndSubdirectories, pathFromMount: true));

            RunPositiveFilterParserTest($"spec='Mount[DummyMount]{Path.DirectorySeparatorChar}hello{Path.DirectorySeparatorChar}*'", expected);
        }
Ejemplo n.º 15
0
        public void SourceFilter()
        {
            RootFilter expected = new RootFilter(
                new OutputFileFilter(AbsolutePath.Invalid, $"{Path.DirectorySeparatorChar}Program.cs", MatchMode.PathPrefixWildcard, pathFromMount: false));

            RunPositiveFilterParserTest($"input='*{Path.DirectorySeparatorChar}Program.cs'", expected);
        }
Ejemplo n.º 16
0
        public void SpecFilterFromMount()
        {
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Create(m_context.PathTable, DummyMountPath), null, MatchMode.WithinDirectoryAndSubdirectories, pathFromMount: true));

            RunPositiveFilterParserTest("spec='Mount[DummyMount]'", expected);
        }
Ejemplo n.º 17
0
        private RootFilter RunPositiveFilterParserTest(string inputString, RootFilter expected)
        {
            RootFilter result = Deserialize(inputString);

            XAssert.AreEqual(expected.GetHashCode(), result.GetHashCode());
            return(result);
        }
Ejemplo n.º 18
0
        public void SpecFilterModuleDottedName()
        {
            RootFilter expected = new RootFilter(
                CreateModuleFilter(StringId.Create(m_context.StringTable, @"My.Test.Module")));

            RunPositiveFilterParserTest("module=\'My.Test.Module\'", expected);
        }
Ejemplo n.º 19
0
        public void SpecFilterAbsolute()
        {
            var        path     = X("/c/users/John Doe/src/foo.ds");
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Create(m_context.PathTable, path)));

            RunPositiveFilterParserTest($"spec=\'{path}'", expected);
        }
Ejemplo n.º 20
0
        public void OutputFilterRecursivePath()
        {
            var        path     = X("/c/users/John Doe/src");
            RootFilter expected = new RootFilter(
                new OutputFileFilter(AbsolutePath.Create(m_context.PathTable, path), null, MatchMode.WithinDirectoryAndSubdirectories, pathFromMount: false));

            RunPositiveFilterParserTest($"output=\'{path}{Path.DirectorySeparatorChar}*'", expected);
        }
Ejemplo n.º 21
0
        public void SpecFilterFilenamePrefixAndSuffixWildcardWithoutAnyNonWildcardCharacters()
        {
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Invalid, Path.DirectorySeparatorChar.ToString(), MatchMode.PathPrefixAndSuffixWildcard));
            RootFilter actual = RunPositiveFilterParserTest("spec='**'", expected);

            XAssert.AreEqual(0, actual.GetEvaluationFilter(SymbolTable, PathTable).ValueDefinitionRootsToResolve.Count);
        }
Ejemplo n.º 22
0
        public void SpecFilterFilenamePrefixAndSuffixWildcard()
        {
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Invalid, $"src{Path.DirectorySeparatorChar}BuildXL.", MatchMode.PathPrefixAndSuffixWildcard));
            RootFilter actual = RunPositiveFilterParserTest($"spec='*src{Path.DirectorySeparatorChar}BuildXL.*'", expected);

            XAssert.AreEqual(0, actual.GetEvaluationFilter(SymbolTable, PathTable).ValueDefinitionRootsToResolve.Count);
        }
Ejemplo n.º 23
0
        public void DependentsSelected()
        {
            RootFilter expected = new RootFilter(
                new DependentsFilter(
                    new TagFilter(StringId.Create(StringTable, "Test"))));

            RunPositiveFilterParserTest("+tag=\'Test\'", expected);
        }
Ejemplo n.º 24
0
        public void ImplicitPathTrumpsDefault()
        {
            RootFilter filter = ParseFilter(values: new string[] { "myPath" }, commandLineFilter: null, defaultFilter: NegatedTagFilter, out _, out _);

            XAssert.IsTrue(filter.PipFilter is BinaryFilter);
            XAssert.IsTrue(((BinaryFilter)filter.PipFilter).Left is OutputFileFilter);
            XAssert.IsTrue(((BinaryFilter)filter.PipFilter).Right is SpecFileFilter);
        }
Ejemplo n.º 25
0
        public void SpecFilterDependenciesAbsolute()
        {
            var        path     = X("/c/users/John Doe/src/foo.ds");
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Create(m_context.PathTable, path), specDependencies: true));

            RunPositiveFilterParserTest($"specref=\'{path}\'", expected);
        }
Ejemplo n.º 26
0
        public void SpecFilterCurrentDirectory()
        {
            var        path     = X("/c/users/John Doe/src");
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Create(m_context.PathTable, path), null, MatchMode.WithinDirectory));

            RunPositiveFilterParserTest($"spec=\'{path}{Path.DirectorySeparatorChar}.'", expected);
        }
Ejemplo n.º 27
0
        private IFilterManager GetFilter2(string str)
        {
            FilterParser   parser       = new FilterParser();
            IVideoFilter   video_filter = parser.Parse(str);
            IFilterManager filter       = new RootFilter(is_output_filtered_video, video_filter);

            return(filter);
        }
Ejemplo n.º 28
0
        public void SpecFilterFilenameSuffixWildcard()
        {
            var        path     = X("/c/src/BuildXL.");
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Invalid, path, MatchMode.PathSuffixWildcard));
            RootFilter actual = RunPositiveFilterParserTest($"spec='{path}*'", expected);

            XAssert.AreEqual(0, actual.GetEvaluationFilter(SymbolTable, PathTable).ValueDefinitionRootsToResolve.Count);
        }
Ejemplo n.º 29
0
        public void SpecFilterFilenamePrefixWildcard()
        {
            RootFilter expected = new RootFilter(
                CreateSpecFilter(AbsolutePath.Invalid, ".ds", MatchMode.PathPrefixWildcard));

            RootFilter actual = RunPositiveFilterParserTest("spec=\'*.ds'", expected);

            XAssert.AreEqual(0, actual.GetEvaluationFilter(SymbolTable, PathTable).ValueDefinitionRootsToResolve.Count);
        }
Ejemplo n.º 30
0
        public void OutputFilterFromMount()
        {
            RootFilter expected = new RootFilter(
                new OutputFileFilter(AbsolutePath.Create(m_context.PathTable, DummyMountPath), null, MatchMode.WithinDirectoryAndSubdirectories, pathFromMount: true));

            RunPositiveFilterParserTest("output='Mount[DummyMount]'", expected);
            RunNegativeFilterParserTest("output='MOUNT[DUMMYMOUNT'", 24, "end of a named mount");
            RunNegativeFilterParserTest("output='mount[badMountName]'", 14, "Could not find mount");
            RunNegativeFilterParserTest("output='mount[)(@!&%]'", 14, "Could not find mount");
        }
Ejemplo n.º 31
0
        public static RootFilter FromXmlDocument(XmlDocument xmlDocument)
        {
            Hashtable item;
            RootFilter result;

            try
            {
                item = (Hashtable)SNDK.Convert.FromXmlDocument (SNDK.Convert.XmlNodeToXmlDocument (xmlDocument.SelectSingleNode ("(//scms.rootfilter)[1]")));
            }
            catch
            {
                item = (Hashtable)SNDK.Convert.FromXmlDocument (xmlDocument);
            }

            try
            {
                result = new RootFilter (SNDK.Convert.StringToEnum<Enums.RootFilterType> ((string)item["type"]));
            }
            catch (Exception exception)
            {
                // LOG: LogDebug.ExceptionUnknown
                SorentoLib.Services.Logging.LogDebug (string.Format (SorentoLib.Strings.LogDebug.ExceptionUnknown, "SCMS.ROOTFILTER", exception.Message));

                // EXCEPTION: Exception.RootFilterFromXMLDocument
                throw new Exception (Strings.Exception.RootFilterFromXMLDocument);
            }

            if (item.ContainsKey ("data"))
            {
                result._data = (string)item["data"];
            }

            return result;
        }