Example #1
0
    def check(self, query, name, join_type=None, emit_print='console', **kwargs):
        gname = "grappa_{name}".format(name=name)

        plan = self._get_grappa_physical_plan(query, join_type, emit_print, **kwargs)

        physical_dot = viz.operator_to_dot(plan)

        with open(os.path.join("c_test_environment",
                               "{gname}.physical.dot".format(gname=gname)), 'w') as dwf:
            dwf.write(physical_dot)

        # generate code in the target language
        # test_mode=True turns on extra checks like assign-once instance
        #    variables for operators
        code = compile(plan, test_mode=True, **kwargs)

        fname = os.path.join("c_test_environment", "{gname}.cpp".format(gname=gname))
        if os.path.exists(fname):
            os.remove(fname)
        with open(fname, 'w') as f:
            f.write(code)

        #raise Exception()

        raise_skip_test(query)

        with Chdir("c_test_environment") as d:
            if emit_print == 'file':
                checkstore(name, GrappalangRunner(binary_input=False))
            else:
                checkquery(name, GrappalangRunner(binary_input=False))
 def check_file(self, query, name):
     with Chdir("c_test_environment") as d:
         os.remove("%s.cpp" % name) if os.path.exists("%s.cpp" %
                                                      name) else None
         emitCode(query,
                  name,
                  clang.CCAlgebra,
                  emit_print=cppcommon.EMIT_FILE)
         checkstore(name, ClangRunner())
 def check_file(self, query, name):
     with Chdir("c_test_environment") as d:
         os.remove("%s.cpp" % name) if os.path.exists("%s.cpp" % name) else None
         emitCode(query, name, clang.CCAlgebra, emit_print=clangcommon.EMIT_FILE)
         checkstore(name, ClangRunner())