[Lldb-commits] [PATCH] D42763: Build each testcase variant in its own subdirectory and remove the srcdir lock file
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 2 02:39:42 PST 2018
labath added inline comments.
Comment at: packages/Python/lldbsuite/test/api/listeners/TestListener.py:26
> labath wrote:
> > I'm confused by these changes. I was under the impression that setUp() runs before each test method (and hence this should be NFC). Can you explain the reasoning behind this?
> (see also my previous comment)
> `setUp` runs before everything else, but it runs once per testcase and `self.testMethodName` is not initialized yet. Therefore we can only run `self.build()` in `self.setUp()` in NO_DEBUG_INFO_TESTCASEs.
I'm not sure where you got the idea that testMethodName is not initialized. It's initialized as one of the first things in Base.setUp (lldbtest.py:776). This also demonstrates that the setUp method is run once *per test function* (as otherwise testMethodName would make no sense; also check out third_party/Python/module/unittest2/unittest2/case.py:379 to see how tests are run).
The problem I think you are having is that self.**debug_info** is not initialized. I was curious at hard it would be to make this work, so I played around with it a bit and the result was D42836.
It's not that I think this change is that bad (although I would prefer if we could keep doing these things in setUp), but I think this could also help make happen the ideas about building binaries once per test case (class) -- the way I'd do that is that I would enumerate all variants that are needed to build in setUpClass (and build them); then the actual test could fetch the corresponding binary according to the variant.
Comment at: packages/Python/lldbsuite/test/lldbtest.py:721-728
+ except OSError as e:
+ import errno
+ if e.errno != errno.EEXIST:
+ if not os.path.isdir(path):
Can we use the (new) lldbutil.mkdir_p here? If there's some circular dependency, maybe we could move the function somewhere else?
Comment at: packages/Python/lldbsuite/test/lldbtest.py:1517-1518
testdir = self.mydir
+ if not testname:
+ testname = self.testMethodName
Why was this necessary? Could we either always pass the name by argument, or always fetch it from `self`? Maybe it will be possible after `D42836`?
More information about the lldb-commits