Package qm :: Package test :: Package classes :: Module rsh_target
[hide private]
[frames] | no frames]

Source Code for Module qm.test.classes.rsh_target

 1  ######################################################################## 
 2  # 
 3  # File:   rsh_target.py 
 4  # Author: Mark Mitchell 
 5  # Date:   10/30/2001 
 6  # 
 7  # Contents: 
 8  #   RSHTarget 
 9  # 
10  # Copyright (c) 2001, 2002 by CodeSourcery, LLC.  All rights reserved.  
11  # 
12  # For license terms see the file COPYING. 
13  # 
14  ######################################################################## 
15   
16  ######################################################################## 
17  # Imports 
18  ######################################################################## 
19   
20  from   process_target import * 
21  import string 
22   
23  ######################################################################## 
24  # Classes 
25  ######################################################################## 
26   
27 -class RSHTarget(ProcessTarget):
28 """A target that runs tests via a remote shell invocation. 29 30 A 'RSHTarget' runs tests on a remote computer via a remote shell 31 call. The remote shell is in the style of 'rsh' and 'ssh'. Using 32 the remote shell, the target invokes the 'qmtest remote' script, 33 which services commands sent via 'stdin', and replies via 34 'stdout'.""" 35 36 host = qm.fields.TextField( 37 title="Remote Host Name", 38 description="""The name of the host on which to run tests. 39 40 The name (or IP address) of the host on which QMTest 41 should execute tests. If this value is the empty string, 42 the name of the target is used.""") 43 remote_shell = qm.fields.TextField( 44 title="Remote Shell Program", 45 description="""The path to the remote shell program. 46 47 The name of the program that can be used to create a 48 remote shell. This program must accept the same command 49 line arguments as the 'rsh' program.""", 50 default_value="ssh") 51 arguments = qm.fields.TextField( 52 title="Remote Shell Arguments", 53 description="""The arguments to provide to the remote shell. 54 55 A space-separated list of arguments to provide to the 56 remote shell program.""", 57 default_value="") 58 59 60
61 - def __init__(self, database, properties):
62 """Construct a new 'RSHTarget'. 63 64 'database' -- The 'Database' containing the tests that will be 65 run. 66 67 'properties' -- A dictionary mapping strings (property names) 68 to strings (property values).""" 69 70 # Because "arguments" is both a field name and class variable, 71 # the usual default handling of field arguments will not work 72 # corectly; we must explicitly set the default value. 73 if not properties.has_key("arguments"): 74 properties["arguments"] = "" 75 76 # Initialize the base class. 77 ProcessTarget.__init__(self, database, properties) 78 79 # Use the target name as the default name for the remote host. 80 if not self.host: 81 self.host = self.GetName()
82 83
84 - def _GetInterpreter(self):
85 86 # Determine the remote shell program to use. 87 remote_shell_program = self.remote_shell 88 if not remote_shell_program: 89 remote_shell_program = qm.rc.Get("remote_shell", 90 default="ssh", 91 section="common") 92 # Extra command-line arguments to the remote shell program 93 # may be specified with the "arguments" property. 94 arguments = self.arguments.split() 95 96 return [remote_shell_program] + arguments + [self.host]
97