[Lldb-commits] [lldb] r225284 - Added a test case for launching a process in a separate terminal window to ensure we don't regress on this.
zturner at google.com
Tue Jan 6 11:24:18 PST 2015
FWIW I plan to support launching in a tty on Windows because it's so easy.
In fact it'll probably be the default. Right now I launch in a separate
terminal no matter what. So I guess I should say I plan to add support for
*not* launching in a terminal :)
Minor nitpick, but as a matter of habit it would be good if we could avoid
hardcoded paths in tests. Of course it's sometimes necessary, but it would
be good to aim for pure test portability, even if the functionality being
tested is not known to be portable. In the above test, for example, you
might be able to fix this by using sys.executable instead of /bin/ls, and
tempfile.gettempdir() instead of /tmp/
On Tue Jan 06 2015 at 11:19:51 AM Greg Clayton <gclayton at apple.com> wrote:
> Author: gclayton
> Date: Tue Jan 6 13:17:58 2015
> New Revision: 225284
> URL: http://llvm.org/viewvc/llvm-project?rev=225284&view=rev
> Added a test case for launching a process in a separate terminal window to
> ensure we don't regress on this.
> A recent POSIX host thread issue where HostThreadPosix::Join() wasn't
> returning the thread result was responsible for this regression, yet we had
> no test case covering this so it wasn't discovered.
> Added: lldb/trunk/test/functionalities/tty/TestTerminal.py
> URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/
> --- lldb/trunk/test/functionalities/tty/TestTerminal.py (added)
> +++ lldb/trunk/test/functionalities/tty/TestTerminal.py Tue Jan 6
> 13:17:58 2015
> @@ -0,0 +1,35 @@
> +Test lldb command aliases.
> +import os, time
> +import unittest2
> +import lldb
> +from lldbtest import *
> +import lldbutil
> +class LaunchInTerminalTestCase(TestBase):
> + mydir = TestBase.compute_mydir(__file__)
> + # Darwin is the only platform that I know of that supports optionally
> + # a program in a separate terminal window. It would be great if other
> + # added support for this.
> + @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires
> + def test_launch_in_terminal (self):
> + exe = "/bin/ls"
> + target = self.dbg.CreateTarget(exe)
> + launch_info = lldb.SBLaunchInfo(["-lAF", "/tmp/"])
> + launch_info.SetLaunchFlags(lldb.eLaunchFlagLaunchInTTY)
> + error = lldb.SBError()
> + process = target.Launch (launch_info, error)
> + self.assertTrue(error.Success(), "Make sure launch happened
> successfully in a terminal window")
> + # Running in synchronous mode our process should have run and
> already exited by the time target.Launch() returns
> + self.assertTrue(process.GetState() == lldb.eStateExited)
> +if __name__ == '__main__':
> + import atexit
> + lldb.SBDebugger.Initialize()
> + atexit.register(lambda: lldb.SBDebugger.Terminate())
> + unittest2.main()
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the lldb-commits