Пример #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)
Пример #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)
Пример #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)
Пример #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)