19
19
from optparse import OptionParser
20
20
from oeqa .oetest import oeTest
21
21
from oeqa .oetest import oeRuntimeTest
22
- from oeqa .oetest import TestContext as OETestContext
22
+ from oeqa .oetest import runTests
23
+ from oeqa .runexported import FakeTarget
24
+ from oeqa .runexported import MyDataDict
25
+ from oeqa .runexported import TestContext
23
26
from oeqa .utils .sshcontrol import SSHControl
24
27
from oeqa .utils .decorators import gettag
25
28
26
- class FakeTarget (object ):
27
- def __init__ (self , d ):
28
- self .connection = None
29
- self .ip = None
30
- self .server_ip = None
31
- self .datetime = time .strftime ('%Y%m%d%H%M%S' ,time .gmtime ())
32
- self .testdir = d .getVar ("TEST_LOG_DIR" , True )
33
- self .pn = d .getVar ("PN" , True )
34
-
35
- def exportStart (self ):
36
- self .sshlog = os .path .join (self .testdir , "ssh_target_log.%s" % self .datetime )
37
- sshloglink = os .path .join (self .testdir , "ssh_target_log" )
38
- if os .path .exists (sshloglink ):
39
- os .remove (sshloglink )
40
- os .symlink (self .sshlog , sshloglink )
41
- print ("SSH log file: %s" % self .sshlog )
42
- self .connection = SSHControl (self .ip , logfile = self .sshlog )
43
-
44
- def run (self , cmd , timeout = None ):
45
- return self .connection .run (cmd , timeout )
46
-
47
- def copy_to (self , localpath , remotepath ):
48
- return self .connection .copy_to (localpath , remotepath )
49
-
50
- def copy_from (self , remotepath , localpath ):
51
- return self .connection .copy_from (remotepath , localpath )
52
-
53
-
54
- class MyDataDict (dict ):
55
- def getVar (self , key , unused = None ):
56
- return self .get (key , "" )
57
-
58
- class TestContext (object ):
59
- def __init__ (self ):
60
- self .d = None
61
- self .target = None
62
-
63
- class RuntestTestContext (OETestContext ):
64
- def __init__ (self , tc ):
65
- d = tc .d
66
- super (RuntestTestContext , self ).__init__ (d )
67
- self .pkgmanifest = tc .pkgmanifest
68
- self .target = tc .target
69
- self .tagexp = tc .tagexp
70
- self .imagefeatures = tc .imagefeatures
71
- self .distrofeatures = tc .distrofeatures
72
- def _get_test_suites (self ):
73
- return self .d .getVar ("testslist" , True )
74
- def _get_tests_list (self , bbpath ):
75
- return self .testsuites
76
- def _get_test_suites_required (self ):
77
- return self .testsuites
78
- def loadTests (self ):
79
- super (RuntestTestContext , self ).loadTests ()
80
- setattr (oeRuntimeTest , "pscmd" , "ps -ef" if oeTest .hasPackage ("procps" ) else "ps" )
81
29
try :
82
30
import simplejson as json
83
31
except ImportError :
@@ -188,7 +136,6 @@ def main():
188
136
d ["BUILD_ARCH" ] = "x86_64" if not navarch else navarch
189
137
if options .nativearch :
190
138
d ["BUILD_ARCH" ] = options .nativearch
191
- d ["testslist" ] = tc .testslist
192
139
setattr (tc , "d" , d )
193
140
194
141
#inject build package manifest
@@ -208,9 +155,7 @@ def main():
208
155
209
156
target .exportStart ()
210
157
setattr (tc , "tagexp" , options .tag )
211
- runner = RuntestTestContext (tc )
212
- runner .loadTests ()
213
- runner .runTests ()
158
+ runTests (tc )
214
159
215
160
return 0
216
161
0 commit comments