[lldb-dev] Testing through api vs. commands

Zachary Turner via lldb-dev lldb-dev at lists.llvm.org
Thu Sep 17 10:33:01 PDT 2015


On Thu, Sep 17, 2015 at 10:31 AM <dawn at burble.org> wrote:

> On Tue, Sep 15, 2015 at 04:46:41PM -0700, Jim Ingham wrote:
> > > In any case, there's a lot I never could figure out how to do in the SB
> > > API that I could only do via commands.  For example, how do you test
> > > that a trailing space at the end of the expr --language option's
> argument
> > > is trimmed in the SB API?
> >
> > I'm not quite sure I understand what you mean by this example?  It
> sounds like you are asking how to test peculiarities of the
> > Command Line language name option parser through the SB API.  Not sure
> that makes sense.
>
> See test test_settings_with_trailing_whitespace in
> test/settings/TestSettings.py.
> A test I added here looks like:
>         # language
>         self.runCmd ("settings set target.language c89")      # Set to
> known value
>         self.runCmd ("settings set target.language pascal ")    # Set to
> new value with trailing whitespace
>         self.expect ("settings show target.language",
> SETTING_MSG("target.language"),
>             startstr = "target.language (language) = pascal")
>         self.runCmd("settings clear target.language", check=False)
>
> How would you write this test using the Python API?
>

 I don't have an answer about how or if it is possible to do that using the
Python API.  But remember that the Python API can be extended however you
see fit.  If there is no mechanism to set or retrieve the value of
settings, you can add those methods to the SB API.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150917/9bf5d3dc/attachment.html>


More information about the lldb-dev mailing list