def run_case(self, testcase: DataDrivenTestCase) -> None: # Kind of hacky. Not sure if we need more structure here. options = CompilerOptions(strip_asserts='StripAssert' in testcase.name) """Perform a runtime checking transformation test case.""" with use_custom_builtins( os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase): expected_output = remove_comment_lines(testcase.output) # replace native_int with platform specific ints int_format_str = 'int32' if IS_32_BIT_PLATFORM else 'int64' expected_output = [ s.replace('native_int', int_format_str) for s in expected_output ] try: ir = build_ir_for_single_file(testcase.input, options) except CompileError as e: actual = e.messages else: actual = [] for fn in ir: if (fn.name == TOP_LEVEL_NAME and not testcase.name.endswith('_toplevel')): continue actual.extend(format_func(fn)) assert_test_output(testcase, actual, 'Invalid source code output', expected_output)
def run_case(self, testcase: DataDrivenTestCase) -> None: """Perform a runtime checking transformation test case.""" options = infer_ir_build_options_from_test_name(testcase.name) if options is None: # Skipped test case return with use_custom_builtins( os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase): expected_output = remove_comment_lines(testcase.output) expected_output = replace_native_int(expected_output) expected_output = replace_word_size(expected_output) try: ir = build_ir_for_single_file(testcase.input, options) except CompileError as e: actual = e.messages else: actual = [] for fn in ir: if (fn.name == TOP_LEVEL_NAME and not testcase.name.endswith('_toplevel')): continue insert_uninit_checks(fn) insert_ref_count_opcodes(fn) actual.extend(format_func(fn)) assert_test_output(testcase, actual, 'Invalid source code output', expected_output)
def run_case(self, testcase: DataDrivenTestCase) -> None: """Perform a runtime checking transformation test case.""" with use_custom_builtins( os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase): expected_output = remove_comment_lines(testcase.output) try: ir = build_ir_for_single_file(testcase.input) except CompileError as e: actual = e.messages else: actual = [] for fn in ir: if (fn.name == TOP_LEVEL_NAME and not testcase.name.endswith('_toplevel')): continue insert_uninit_checks(fn) insert_exception_handling(fn) insert_ref_count_opcodes(fn) actual.extend(format_func(fn)) if testcase.name.endswith('_freq'): common = frequently_executed_blocks(fn.blocks[0]) actual.append('hot blocks: %s' % sorted(b.label for b in common)) assert_test_output(testcase, actual, 'Invalid source code output', expected_output)
def run_case(self, testcase: DataDrivenTestCase) -> None: # Kind of hacky. Not sure if we need more structure here. options = CompilerOptions(strip_asserts='StripAssert' in testcase.name) """Perform a runtime checking transformation test case.""" with use_custom_builtins( os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase): expected_output = remove_comment_lines(testcase.output) expected_output = replace_native_int(expected_output) expected_output = replace_word_size(expected_output) name = testcase.name # If this is specific to some bit width, always pass if platform doesn't match. if name.endswith('_64bit') and IS_32_BIT_PLATFORM: return if name.endswith('_32bit') and not IS_32_BIT_PLATFORM: return try: ir = build_ir_for_single_file(testcase.input, options) except CompileError as e: actual = e.messages else: actual = [] for fn in ir: if (fn.name == TOP_LEVEL_NAME and not name.endswith('_toplevel')): continue actual.extend(format_func(fn)) assert_test_output(testcase, actual, 'Invalid source code output', expected_output)
def run_case(self, testcase: DataDrivenTestCase) -> None: """Perform a runtime checking transformation test case.""" with use_custom_builtins( os.path.join(self.data_prefix, ICODE_GEN_BUILTINS), testcase): expected_output = remove_comment_lines(testcase.output) try: ir = build_ir_for_single_file(testcase.input) except CompileError as e: actual = e.messages else: actual = [] for fn in ir: if (fn.name == TOP_LEVEL_NAME and not testcase.name.endswith('_toplevel')): continue actual.extend(format_func(fn)) assert_test_output(testcase, actual, 'Invalid source code output', expected_output)