xref: /aosp_15_r20/external/autotest/server/samples/autoserv_console.srv (revision 9c5db1993ded3edbeafc8092d69fe5de2ee02df7)
1*9c5db199SXin Li# autoserv_console.srv - gives you an interactive interpreter within an autoserv
2*9c5db199SXin Li# control file.  If you pass "-m hostname", a RemoteHost will be available under
3*9c5db199SXin Li# the variable "host".
4*9c5db199SXin Li
5*9c5db199SXin Li# If you install IPython (http://ipython.scipy.org/, Ubuntu package "ipython"),
6*9c5db199SXin Li# you'll get a snazzy IPython console with readline and completion and all that.
7*9c5db199SXin Li# Otherwise you'll get a simple console without any of that.
8*9c5db199SXin Li
9*9c5db199SXin Li# -Steve Howard ([email protected])
10*9c5db199SXin Li
11*9c5db199SXin Liif machines:
12*9c5db199SXin Li    host = hosts.create_host(machines[0])
13*9c5db199SXin Li
14*9c5db199SXin Litry:
15*9c5db199SXin Li    import IPython
16*9c5db199SXin Li    ipshell = IPython.Shell.IPShellEmbed(argv=[])
17*9c5db199SXin Li    ipshell()
18*9c5db199SXin Liexcept ImportError:
19*9c5db199SXin Li    import code
20*9c5db199SXin Li    code.interact("Autoserv console", raw_input, locals())
21