Running Py++ unittests using mb.split_module()
Hi Folke, This is regarding the Py++ unittests: Currently all the tests (except for the split_module_* tests) are run such that all the Py++ generated boost.python bindings are written to a single file (using mb.write_module in fundamental_tester_base_t.generate_source_files() ). Regarding our development environment, we always invoke Py++ to write to multiple files (using mb.split_module). I plan to test the sanity of some internal patches that I made to Py++ file_writer: multiple_files.py by running them against the Py++ unittests (by writing the bindings to multiple files). So I modified fundamental_tester_base_t.generate_source_files() and fundamental_tester_base_t.get_source_files() appropriately, and use a flag defined in autoconfig.py to switch from using "single file" to "multiple file" generation. Most of the tests pass, but some tests fail with linking errors due to "multiple definitions" when I generate code to multiple files. For example, abstract_tester fails with the following error: square.pypp.os: In function `abstract::call(abstract::shape*)': square.pypp.cpp:(.text+0x0): multiple definition of `abstract::call(abstract::shape*)' shape.pypp.os:shape.pypp.cpp:(.text+0x0): first defined here abstract_enumerations.pypp.os: In function `abstract::call(abstract::shape*)': abstract_enumerations.pypp.cpp:(.text+0x0): multiple definition of `abstract::call(abstract::shape*)' shape.pypp.os:shape.pypp.cpp:(.text+0x0): first defined here abstract_free_functions.pypp.os: In function `abstract::call(abstract::shape*)': abstract_free_functions.pypp.cpp:(.text+0x0): multiple definition of `abstract::call(abstract::shape*)' shape.pypp.os:shape.pypp.cpp:(.text+0x0): first defined here abstract.main.os: In function `abstract::call(abstract::shape*)': abstract.main.cpp:(.text+0x0): multiple definition of `abstract::call(abstract::shape*)' shape.pypp.os:shape.pypp.cpp:(.text+0x0): first defined here collect2: ld returned 1 exit status scons: *** [abstract.so] Error 1 Some of the other tests that fail due to "multiple definitions" are: - free_operators_tester - special_operators_tester - temporary_variable_tester - unnamed_classes_tester - overloads_macro_tester I know that this can be resolved by splitting the associated "data" files to separate .hpp and .cpp files. I was wondering if anybody had tried running the Py++ unittests for multiple generated files? I think it would be a good idea to split these data files into .hpp and .cpp files so that we can switch between testing for "single file" and "multiple file" generation seamlessly. Thanks, -Meghana.
On 3/1/07, Haridev, Meghana <mharidev@qualcomm.com> wrote:
Hi Folke,
This is regarding the Py++ unittests:
Currently all the tests (except for the split_module_* tests) are run such that all the Py++ generated boost.python bindings are written to a single file (using mb.write_module in fundamental_tester_base_t.generate_source_files() ).
The situation even worse :-), every compiled and tested ( imported module ) stays in the memory. So, I have to be very creative when I give names to class or function.
I plan to test the sanity of some internal patches that I made to Py++ file_writer: multiple_files.py by running them against the Py++ unittests (by writing the bindings to multiple files).
It could be nice if you can share your patches. If you cannot, than I suggest you to implement another solution: module_builder_t class expose "code_creator" - the root of code creators tree. You can create new class, which derives from multiple_files_t one and add the missing\adjusted functionality to it. This is how "class_multiple_files_t" file writer is implemented. After this you, from your main script, you can construct your custom writer and pass to it reference to the "code_creator". This approach is a little bit better, because you will not have to merge your changes every time you get new Py++ version.
So I modified fundamental_tester_base_t.generate_source_files() and fundamental_tester_base_t.get_source_files() appropriately, and use a flag defined in autoconfig.py to switch from using "single file" to "multiple file" generation. Most of the tests pass, but some tests fail with linking errors due to "multiple definitions" when I generate code to multiple files.
For example, abstract_tester fails with the following error:
square.pypp.os: In function `abstract::call(abstract::shape*)': ...
I know that this can be resolved by splitting the associated "data" files to separate .hpp and .cpp files. I was wondering if anybody had tried running the Py++ unittests for multiple generated files? I think it would be a good idea to split these data files into .hpp and .cpp files so that we can switch between testing for "single file" and "multiple file" generation seamlessly.
I'll be glad if you will help me to fix this situation. I can give you SVN access or you can send me the patches. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/
participants (2)
-
Haridev, Meghana -
Roman Yakovenko