On Jun 5, 4:09 pm, Toon Verstraelen <toon.verstrae...@ugent.be> wrote: > Hello, > > I'm writing a very initial version of a code generator. I would like to add > proper tests for the generated c code. The test will involve a compilation > with > gcc and linking against a small c program that tests the output of the > function > for several inputs. If some outputs are wrong, the negative return code can be > captured with a proper assert statement. > > I could not find existing tests that generate output files. What is the > recommended directory to write these files? I was thinking of > tempfile.mkdtemp, > but that makes it annoying to check the generated code manually. A temporary > test_output directory at the root level of the source tree with subdirectories > created by the tests seems convenient to me, but this involves changes in > setup.py, which runs the tests. './setup.py test' should create this directory > and './setup.py clean' should remove it enterily. Is this OK?
You could use tcc [1], which is much faster (especially if you use libtcc and avoid any file creation -- sadly it's usually a pain to set it up). See sympy/utilities/compilef.py for an interface. There is also some primitive and specialized code generation. The advantage of gcc is of course it's spread. For configuration I'd try waf [2]. It's pure python and does not need to be installed. Vinzent [1] http://bellard.org/tcc/ [2] http://code.google.com/p/waf/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to sympy@googlegroups.com To unsubscribe from this group, send email to sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---