Exemplo n.º 1
0
 def test_set_logfile(self):
     from examples.sum_of_squares import populate_ctxt
     ctxt = gccjit.Context()
     with tempfile.NamedTemporaryFile(suffix=".txt") as f:
         ctxt.set_logfile(f)
         populate_ctxt(ctxt)
         ctxt.compile()
         with open(f.name) as f:
             logtxt = f.read()
             self.assertIn('JIT: ', logtxt)
             self.assertIn('entering: gcc_jit_context_get_type', logtxt)
Exemplo n.º 2
0
 def test_set_logfile(self):
     from examples.sum_of_squares import populate_ctxt
     ctxt = gccjit.Context()
     with tempfile.NamedTemporaryFile(suffix=".txt") as f:
         ctxt.set_logfile(f)
         populate_ctxt(ctxt)
         ctxt.compile()
         with open(f.name) as f:
             logtxt = f.read()
             self.assertIn('JIT: ', logtxt)
             self.assertIn('entering: gcc_jit_context_get_type', logtxt)
Exemplo n.º 3
0
 def test_dump_reproducer(self):
     from examples.sum_of_squares import populate_ctxt
     ctxt = gccjit.Context()
     populate_ctxt(ctxt)
     with tempfile.NamedTemporaryFile(delete=False, suffix=".c") as f:
         ctxt.dump_reproducer_to_file(f.name.encode('utf-8'))
     try:
         with open(f.name) as f:
             gensrc = f.read()
             self.assertIn('#include <libgccjit.h>', gensrc)
     finally:
         os.unlink(f.name)
Exemplo n.º 4
0
 def test_dump_reproducer(self):
     from examples.sum_of_squares import populate_ctxt
     ctxt = gccjit.Context()
     populate_ctxt(ctxt)
     with tempfile.NamedTemporaryFile(delete=False, suffix=".c") as f:
         ctxt.dump_reproducer_to_file(f.name.encode('utf-8'))
     try:
         with open(f.name) as f:
             gensrc = f.read()
             self.assertIn('#include <libgccjit.h>', gensrc)
     finally:
         os.unlink(f.name)