[lldb-dev] Refactoring dotest as a Python package
Zachary Turner via lldb-dev
lldb-dev at lists.llvm.org
Tue Oct 27 12:49:41 PDT 2015
I've got a patch locally to make all of our Python stuff part of an lldb
package called `lldbsuite`. Currently we've got a bunch of standalone
scripts that live in various directories such as `lldb/test`, or
`lldb/scripts`, and possibly some other locations, and this organization
makes it hard to share code because it is incompatible with Python's
built-in code reuse mechanism, which is its package system.
The problem is, this patch is *big*. Functionally there weren't many major
changes, but it renames the entire test directory. To be clear, it still
leaves `test/dotest.py` in place, so nobody has to change their workflow or
do anything differently. If you used to write "cd test && dotest.py" you
can still do that. dotest.py is now just a 2 line wrapper around the
package, so it looks like:
the advantage of this method is that lldbsuite can contain subpackages. It
already contains one subpackage, which is lldbsuite.test, and I plan to
move some of the Python code in `lldb/scripts` there as well, so that we
have lldbsuite.scripts. Then we can add a third submodule,
lldbsuite.shared, and now dotest can share code with scripts, and it gives
us a nice place to put stuff that previously had been copied all around.
It also gives us a nice way to perform module-wide initialization that we
don't have to repeat in every single test, such as writing "import
lldb_shared" at the top of every file, since that can be done as part of
In any case, I have this all working on my machine, but I would like to see
if someone can try my patch out on other platforms. The size of the patch
presents a problem though - it's over 7MB since it renames a very large
As usual, comments / concerns also welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-dev