[Lldb-commits] [PATCH] D42763: Build each testcase variant in its own subdirectory and remove the srcdir lock file

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 1 11:14:07 PST 2018


Now that we aren't mixing variants, would it be possible to have a test class claim that all the tests use the same binary file?  At present to get self-contained tests you often need to do roughly the same thing many times, on the same binary.  You only need to build it once per variant in that case.  Of course, not all tests would behave this way, some play tricks with the binary products mid-test.  But I bet the majority of test classes with more than one test method just build exactly the same thing as all the other tests, and don't modify it.

Jim


> On Feb 1, 2018, at 9:55 AM, Pavel Labath via Phabricator <reviews at reviews.llvm.org> wrote:
> 
> labath added inline comments.
> 
> 
> ================
> Comment at: packages/Python/lldbsuite/test/lldbinline.py:96-98
> +            return "-N dwarf %s" % (testdir)
>         else:
> +            return "-N dsym %s" % (testdir)
> ----------------
> aprantl wrote:
>> labath wrote:
>>> xiaobai wrote:
>>>> Good opportunity to move away from the old style of formatting strings to a newer style? It doesn't make a huge difference, I just think it'd be nice to do. :)
>>>> `return "-N dwarf {}".format(testdir)`
>>>> `return "-N dwarf {}".format(testdir)`
>>>> 
>>>> This is supported in Python 2.7, but I'm not sure if we can assume that version or greater to be present.
>>> 2.7 is definitely fine, and we use `{}` format in plently of places already. (But I don't have any beef with the %s format either).
>> In this case I think this should just be `return "-N dsym " + testdir`
> :D 
> 
> 
> ================
> Comment at: packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py:85
>         """Create target, spawn a process, and attach to it with process id."""
> -        self.build(dictionary=self.d)
> -        self.setTearDownCleanup(dictionary=self.d)
> -        target = self.dbg.CreateTarget(self.exe)
> +        exe = self.getBuildArtifact(self.testMethodName)
> +        d = {'EXE': exe}
> ----------------
> I think `self.testMethodName` is what you're looking for. (There also seems to be a `self._testMethodName` but I'm not sure what's the difference between the two.)
> 
> 
> https://reviews.llvm.org/D42763
> 
> 
> 



More information about the lldb-commits mailing list