def setUp(self):
        """Setup the query master with some patterns used by the tests"""

        # ISSUE007
        # TODO, pyunit's bright idea is to call setup before each test.  It
        # was defining multiple patterns which was annoying but not a problem.
        # The cleanest way to do things is probably to remove patterns after
        # the test, but we don't have that functionality.  For now just create
        # one pattern to avoid confusion, but do it by hacking in a global
        # variable

        global firstTime

        if not firstTime:
            return
        firstTime = False

        # get the full source name for even and odd sources
        even_numbers = quilt_test_core.get_source_name(
            "even_numbers")
        odd_numbers = quilt_test_core.get_source_name(
            "odd_numbers")

        # define template pattern code string
        followsTemplate = "follows(5, source('$EVEN','grep'),source('$ODD','grep'))"

        # replace EVEN and ODD variables in the template with full names
        replacements = {'EVEN': even_numbers, 'ODD': odd_numbers}
        followsTemplate = Template(followsTemplate)
        followsPatCode = followsTemplate.safe_substitute(replacements)


        # TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        # call quilt_define with the pattern code and name query
        #   dups_follows
        quilt_test_core.call_quilt_script('quilt_define.py', ['-n',
            'dups_follows', followsPatCode])

        # define template pattern code string
        concurrentTemplate = "concurrent(source('$EVEN','grep'),source('$EVEN','grep'), source('$EVEN','grep'))"

        # replace EVEN variable in the template with full source name
        concurrentTemplate = Template(concurrentTemplate)
        concurrentPatCode = concurrentTemplate.safe_substitute(replacements)

        # TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        # call quilt_define with the pattern code and name query
        #   dups_concurrent

        quilt_test_core.call_quilt_script('quilt_define.py', ['-n',
            'dups_concurrent', concurrentPatCode])
Example #2
0
    def setUp(self):
        """Setup the query master with some patterns used by the tests"""

        # ISSUE007
        # TODO, pyunit's bright idea is to call setup before each test.  It
        # was defining multiple patterns which was annoying but not a problem.
        # The cleanest way to do things is probably to remove patterns after
        # the test, but we don't have that functionality.  For now just create
        # one pattern to avoid confusion, but do it by hacking in a global
        # variable

        global firstTime

        if not firstTime:
            return
        firstTime = False

        # get the full source name for even and odd sources
        out_of_order_numbers = quilt_test_core.get_source_name(
            "out_of_order_numbers")

        # TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        # call quilt_define with the pattern code and name query
        #   dups_follows
        quilt_test_core.call_quilt_script('quilt_define.py', ['-n',
                                                              'out_of_order',
                                                              'source("' + out_of_order_numbers + '","grep")'])
Example #3
0
    def setUp(self):
        """Setup the query master with some patterns used by the tests"""

        # ISSUE007
        # TODO, pyunit's bright idea is to call setup before each test.  It
        # was defining multiple patterns which was annoying but not a problem.
        # The cleanest way to do things is probably to remove patterns after
        # the test, but we don't have that functionality.  For now just create
        # one pattern to avoid confusion, but do it by hacking in a global
        # variable

        global firstTime

        if not firstTime:
            return
        firstTime = False

        # call quilt status and parse out the name of the syslog source
        srcName = quilt_test_core.get_source_name("syslog")

        #        logging.debug("Determined source name as: " + srcName)

        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            '-n', 'test_pattern',
            '-v', 'SEARCHSTRING', 'the Search string',
            '-m', 'SEARCHSTRING', srcName, 'grep', 'OPTIONS'])
        logging.debug("Defined test_pattern")
    def setUp(self):
        """Setup the query master with some patterns used by the tests"""

        # ISSUE007
        # TODO, pyunit's bright idea is to call setup before each test.  It
        # was defining multiple patterns which was annoying but not a problem.
        # The cleanest way to do things is probably to remove patterns after
        # the test, but we don't have that functionality.  For now just create
        # one pattern to avoid confusion, but do it by hacking in a global
        # variable

        global firstTime

        if not firstTime:
            return
        firstTime = False

        syslog = quilt_test_core.get_source_name("syslog")
        multisource = quilt_test_core.get_source_name("multipattern")

        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            '-n', "bigpattern",
            '-v', 'SEARCHSTRING1', 'the Search string1',
            '-v', 'SEARCHSTRING2', 'the Search string2',
            '-v', 'SEARCHSTRING3', 'the Search string3',
            '-v', 'SEARCHSTRING4', 'the Search string4',
            '-v', 'SEARCHSTRING5', 'the Search string5',
            '-v', 'SEARCHSTRING6', 'the Search string6',
            '-m', 'SEARCHSTRING1', syslog, 'grep', 'OPTIONS',
            '-m', 'SEARCHSTRING2', syslog, 'grep', 'OPTIONS', 'fooInst',
            '-m', 'SEARCHSTRING3', multisource, 'pat1', 'PAT1SRCVAR1',
            '-m', 'SEARCHSTRING4', multisource, 'pat1', 'PAT1SRCVAR2',
            '-m', 'SEARCHSTRING5', multisource, 'pat2', 'PAT2SRCVAR1',
            '-m', 'SEARCHSTRING6', multisource, 'pat2', 'PAT2SRCVAR2'
        ])
Example #5
0
    def setUp(self):
        """Setup the query master with some patterns used by the tests"""

        # ISSUE007
        # TODO, pyunit's bright idea is to call setup before each test.  It
        # was defining multiple patterns which was annoying but not a problem.
        # The cleanest way to do things is probably to remove patterns after
        # the test, but we don't have that functionality.  For now just create
        # one pattern to avoid confusion, but do it by hacking in a global
        # variable

        global firstTime

        if not firstTime:
            return
        firstTime = False

        christian_holidays = quilt_test_core.get_source_name(
            "christian_holidays")
        secular_holidays = quilt_test_core.get_source_name(
            "secular_holidays")

        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            'source("' + secular_holidays + '","grep")',
            '-n', 'semantics_one_source',
            '-v', 'WHICH_HOLIDAY',
            '-v', 'UNUSED',
            '-m', 'WHICH_HOLIDAY', secular_holidays, 'grep', 'GREP_ARGS',
            '-m', 'UNUSED', christian_holidays, 'grep', 'GREP_ARGS'
        ])


        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            'at(source("' + christian_holidays + '","grep"))==12',
            '-n', 'semantics_equals_literal'
        ])

        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            "concurrent(source('" + christian_holidays + "','grep')," +
            "source('" + secular_holidays + "','grep'))",
            '-n', 'semantics_concurrent'])

        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            "concurrent(source('" + christian_holidays + "','grep')," +
            "source('" + secular_holidays + "','grep')['major']=='True')",
            '-n', 'semantics_nested'])


        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            'follows(1,' +
            "source('" + secular_holidays + "','grep')," +
            "source('" + christian_holidays + "','grep'))",
            '-n', 'semantics_follows'
        ])

        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            'until(' +
            "source('" + secular_holidays + "','grep')," +
            "source('" + christian_holidays + "','grep'))",
            '-n', 'semantics_until'
        ])

        small_numbers = quilt_test_core.get_source_name(
            "small_numbers")
        med_numbers = quilt_test_core.get_source_name(
            "med_numbers")

        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            'qand(' +
            "source('" + small_numbers + "','grep')," +
            "source('" + med_numbers + "','grep'))",
            '-n', 'semantics_qand'
        ])

        #TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        quilt_test_core.call_quilt_script('quilt_define.py', [
            'qor(' +
            "source('" + small_numbers + "','grep')," +
            "source('" + med_numbers + "','grep'))",
            '-n', 'semantics_qor'
        ])
Example #6
0
    def setUp(self):
        """Setup the query master with some patterns used by the tests"""

        # ISSUE007
        # TODO, pyunit's bright idea is to call setup before each test.  It
        # was defining multiple patterns which was annoying but not a problem.
        # The cleanest way to do things is probably to remove patterns after
        # the test, but we don't have that functionality.  For now just create
        # one pattern to avoid confusion, but do it by hacking in a global
        # variable

        global firstTime

        if not firstTime:
            return
        firstTime = False

        # get the full source name for even and odd sources
        christian_holidays = quilt_test_core.get_source_name(
            "christian_holidays")
        secular_holidays = quilt_test_core.get_source_name(
            "secular_holidays")

        # define template pattern code string
        lessThanTemplate = (
            "(source('$SECULAR','grep')['paradesize'] < source('$CHRISTIAN', "
            "'grep')['paradesize'])['paradesize'] < 100")

        # replace EVEN and ODD variables in the template with full names
        replacements = {'CHRISTIAN': christian_holidays,
                       'SECULAR': secular_holidays}
        lessThanTemplate = Template(lessThanTemplate)
        patCode = lessThanTemplate.safe_substitute(replacements)

        # TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        # call quilt_define with the pattern code and name query
        #   operators_lessthan
        quilt_test_core.call_quilt_script(
            'quilt_define.py', ['-n', 'operators_lessthan', patCode])

        # define template pattern code string
        template = (
            "(source('$SECULAR','grep')['paradesize'] $OPERATOR source("
            "'$CHRISTIAN', 'grep')['paradesize'])")

        template = Template(template)
        patCode = template.safe_substitute(replacements)

        # TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        # call quilt_define with the pattern code and name query
        #   define a variable for which binary operator to use
        #   provide a default value for the variable, this value is mandatory
        #   because the query code is parsed before submission time
        quilt_test_core.call_quilt_script(
            'quilt_define.py', [
                '-n', 'operators_comparefields', patCode, '-v', 'OPERATOR',
                'operator to use in the comparison', '=='])

        # define template pattern code string
        template = (
            "source('$SECULAR','grep')['paradesize'] $OPERATOR $VALUE")

        template = Template(template)
        patCode = template.safe_substitute(replacements)

        # TODO REad the pattern id from the std output then query that one
        # See ISSUE007 and ISSUE008
        # call quilt_define with the pattern code and name query
        #   define a variable for which binary operator to use
        #   define a variable for what value to use on RHS
        #   defaults are required when modifying code with search/replace
        #   variables because template code will not parse
        quilt_test_core.call_quilt_script('quilt_define.py',
            ['-n', 'operators_comparevalue', patCode, '-v', 'OPERATOR',
             'operator to use in the comparison', '==', '-v', 'VALUE',
             'the literal value on the RHS of the comparison','0'])