Example #1
0
 def setUp(self):
     analyzer_options = options.o3_options
     self.compiler = compiler.Compiler(analyzer_options=analyzer_options,
                                       xspt_mode=False,
                                       compiler_stack_traces=True)
     self.compiler.new_registry_format = True
     self.compiler.function_name_registry['reg_f'] = ('a.reg_f',
                                                      ['skip_filter'])
Example #2
0
 def setUp(self):
     analyzer_options = options.default_options
     analyzer_options.update(cache_resolved_placeholders=True,
                             enable_warnings=True,
                             warnings_as_errors=True)
     self.compiler = compiler.Compiler(analyzer_options=analyzer_options,
                                       xspt_mode=False,
                                       compiler_stack_traces=True)
Example #3
0
 def setUp(self):
     # TODO: Use BaseTest.setUp()?
     analyzer_options = options.default_options
     analyzer_options.update(static_analysis=True,
                             directly_access_defined_variables=True)
     self.compiler = compiler.Compiler(analyzer_options=analyzer_options,
                                       xspt_mode=False,
                                       compiler_stack_traces=True)
Example #4
0
 def setUp(self):
     analyzer_options = options.default_options
     analyzer_options.update(static_analysis=True,
                             directly_access_defined_variables=True,
                             hoist_conditional_aliases=True,
                             cache_filtered_placeholders=True)
     self.compiler = compiler.Compiler(analyzer_options=analyzer_options,
                                       xspt_mode=False,
                                       compiler_stack_traces=True)
Example #5
0
 def setUp(self):
     self.analyzer_options = options.default_options
     self.analyzer_options.update(enable_warnings=True,
                                  warnings_as_errors=True,
                                  no_raw=True)
     self.compiler = compiler.Compiler(
         analyzer_options=self.analyzer_options,
         xspt_mode=False,
         compiler_stack_traces=True)
Example #6
0
 def setUp(self):
     analyzer_options = options.default_options
     analyzer_options.update(cache_resolved_udn_expressions=True,
                             enable_warnings=True,
                             warnings_as_errors=True,
                             directly_access_defined_variables=True,
                             static_analysis=False)
     self.compiler = compiler.Compiler(analyzer_options=analyzer_options,
                                       xspt_mode=False,
                                       compiler_stack_traces=True)
Example #7
0
 def setUp(self):
     self.analyzer_options = options.default_options
     self.analyzer_options.update(cache_resolved_placeholders=True,
                                  enable_warnings=True,
                                  warnings_as_errors=True,
                                  baked_mode=True,
                                  generate_unicode=False)
     self.compiler = compiler.Compiler(
         analyzer_options=self.analyzer_options,
         xspt_mode=False,
         compiler_stack_traces=True)
     self.compiler.new_registry_format = True
     self.compiler.function_name_registry['reg_f'] = ('a.reg_f',
                                                      ['skip_filter'])
Example #8
0
def load_template(template_src,
                  template_name,
                  analyzer_options=options.default_options,
                  compiler_options=None):
    class_name = filename2classname(template_name)
    filename = '<%s>' % class_name
    module_name = class_name
    # Note: The compiler module is imported here to avoid a circular dependency
    from spitfire.compiler import compiler
    spt_compiler = compiler.Compiler(analyzer_options=analyzer_options)
    if compiler_options:
        for k, v in compiler_options.iteritems():
            setattr(spt_compiler, k, v)
    src_code = spt_compiler.compile_template(template_src, class_name)
    module = load_module_from_src(src_code, filename, module_name)
    return getattr(module, class_name)
Example #9
0
def load_template_file(filename,
                       module_name=None,
                       analyzer_options=options.default_options,
                       compiler_options=None,
                       xspt_mode=False):
    # Note: The compiler module is imported here to avoid a circular dependency.
    from spitfire.compiler import compiler
    spt_compiler = compiler.Compiler(analyzer_options=analyzer_options,
                                     xspt_mode=xspt_mode)
    if compiler_options:
        for k, v in compiler_options.iteritems():
            setattr(spt_compiler, k, v)
    class_name = filename2classname(filename)
    if not module_name:
        module_name = class_name

    src_code = spt_compiler.compile_file(filename)
    module = load_module_from_src(src_code, filename, module_name)
    return getattr(module, class_name)
Example #10
0
    option_parser.add_option(
        '--test-accept-result',
        action='store_true',
        default=False,
        help='accept current code output as correct for future tests')
    option_parser.add_option('--debug', action='store_true', default=False)
    option_parser.add_option(
        '--debug-flags',
        action='store',
        default='hoisted_tree,source_code',
        help=
        'parse_tree, analyzed_tree, optimized_tree, hoisted_tree, source_code')
    option_parser.add_option('--enable-c-accelerator',
                             action='store_true',
                             default=False)

    (spt_options, spt_args) = option_parser.parse_args()
    if spt_options.debug:
        spt_options.verbose = True
        spt_options.debug_flags = getattr(spt_options, 'debug_flags').split(',')
    else:
        spt_options.debug_flags = []

    udn.set_accelerator(spt_options.enable_c_accelerator, enable_test_mode=True)

    spt_compiler_args = compiler.Compiler.args_from_optparse(spt_options)
    spt_compiler = compiler.Compiler(**spt_compiler_args)

    test_runner = TestRunner(spt_compiler, spt_options, spt_args)
    test_runner.run()
Example #11
0
 def setUp(self):
     self.compiler = compiler.Compiler(
         analyzer_options=self.analyzer_options,
         xspt_mode=False,
         compiler_stack_traces=True)
Example #12
0
 def setUp(self):
     analyzer_options = options.default_options
     self.compiler = compiler.Compiler(analyzer_options=analyzer_options,
                                       xspt_mode=False,
                                       compiler_stack_traces=True,
                                       baked_mode=True)