1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
'''
Created on Jan 10, 2013
__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2013, Intel Corp."
__credits__ = ["Elizabeth Flanagan"]
__license__ = "GPL"
__version__ = "2.0"
__maintainer__ = "Elizabeth Flanagan"
__email__ = "pidge@toganlabs.com"
'''
from buildbot.steps.shell import ShellCommand
from buildbot.status.results import SUCCESS, FAILURE
from twisted.python import log as tlog
import os, re
from lib.buildsteps import BitbakeShellCommand
class RunSanityTests(BitbakeShellCommand):
haltOnFailure = False
flunkOnFailure = True
name = "Running Sanity Tests"
def __init__(self, factory, argdict=None, **kwargs):
self.factory = factory
self.testsfailed = 0
self.testspassed = 0
self.testsnoresult = 0
self.namefailed = []
self.namepassed = []
self.namenoresult = []
self.images=""
self.scene=None
self.suites=None
self.suitesappend=None
# the default of 4800 seconds is enough for running sanity tests in most cases
self.timeout = 14800
for k, v in argdict.iteritems():
setattr(self, k, v)
self.description = "Running Sanity Tests"
kwargs['timeout']=self.timeout
super(RunSanityTests, self).__init__(factory, argdict=None, **kwargs)
def start(self):
localconf = self.getProperty("LOCALCONF")
layerversion = int(self.getProperty("layerversion_core", "0"))
distro = self.getProperty("DISTRO")
self.command = ""
self.command = self.command + ". ./oe-init-build-env; "
self.command = self.command + "checkvnc; "
if distro == "poky-lsb" and layerversion < 6:
self.skipStep('Skipping step.')
elif layerversion < 9 and 'musl' in localconf:
self.skipStep('Skipping step for musl.')
# Releases older than Rocko didn't build core-image-sato-sdk
# with musl.
elif layerversion < 11 and 'musl' in localconf:
self.images = self.images.replace("core-image-sato-sdk", "core-image-sato")
elif layerversion < 8 \
and 'DISTRO_FEATURES_remove="x11"' in localconf.replace(" ", ""):
self.skipStep('Skipping step for no-x11.')
elif layerversion > 1:
self.command = self.command + "echo 'INHERIT += \"testimage\"' >> ./conf/auto.conf;"
self.command = self.command + "echo 'TEST_QEMUBOOT_TIMEOUT = \"1500\"' >> ./conf/auto.conf;"
target_ip = self.getProperty('target_ip')
server_ip = self.getProperty('server_ip')
if target_ip and server_ip:
self.command = self.command + "echo 'TEST_TARGET=\"simpleremote\"' >> ./conf/auto.conf;"
self.command = self.command + "echo 'TEST_TARGET_IP=\"%s\"' >> ./conf/auto.conf;" % target_ip
self.command = self.command + "echo 'TEST_SERVER_IP=\"%s\"' >> ./conf/auto.conf;" % server_ip
if self.suites:
if layerversion > 3:
self.command = self.command + "echo 'TEST_SUITES = \"" + self.suites + "\"'" + " >> ./conf/auto.conf;"
else:
self.command = self.command + "echo 'TEST_SUITES = \"" + self.suites.replace('kernelmodule', '').replace('python', '') + "\"'" + " >> ./conf/auto.conf;"
if self.suitesappend:
self.command = self.command + "echo 'TEST_SUITES_append = \" " + self.suitesappend + "\"'" + " >> ./conf/auto.conf;"
self.command = self.command + "DISPLAY=:1 bitbake -v " + self.images + " -c testimage"
else:
self.command = self.command + "echo 'IMAGETEST = \"qemu\"' >> ./conf/auto.conf;"
if self.scene:
self.command = self.command + "echo 'TEST_SCEN = \"" + self.scene + "\"'" + " >> ./conf/auto.conf;"
self.command = self.command + "DISPLAY=localhost:1 bitbake -v " + self.images + " -c qemuimagetest_standalone"
ShellCommand.start(self)
######################################################################
#
#
# Until we get better sanity reporting, I'm commenting this out.
#
#
######################################################################
# def describe(self, done=False):
# description = ShellCommand.describe(self,done)
# return description
# def createSummary(self, log):
# log_text = log.getText()
# from StringIO import StringIO
# for line in StringIO(log_text):
# tlog.msg(line)
# if "NOTE:" in line:
# if "0 1 0" in line:
# self.testsfailed = self.testsfailed + 1
# self.namefailed.append(line.replace("|","").replace(" ", "").replace("NOTE:", "").replace("0","").replace("1","").replace("\n","").replace("\t",""))
# elif "1 0 0" in line:
# self.testspassed = self.testspassed + 1
# self.namepassed.append(line.replace("|","").replace(" ", "").replace("NOTE:", "").replace("0","").replace("1","").replace("\n","").replace("\t",""))
# elif "0 0 1" in line:
# self.testsnoresult = self.testsnoresult + 1
# self.namenoresult.append(line.replace("|","").replace(" ", "").replace("NOTE:", "").replace("0","").replace("1","").replace("\n","").replace("\t",""))
# def getText(self, cmd, results):
# text = self.describe(True)[:]
# text.append("---------")
# text.append("failed : " + str(self.testsfailed))
# text.append("")
# if self.namefailed != []:
# for test in self.namefailed:
# text.append(test)
# text.append("---------")
# text.append("passed : " + str(self.testspassed))
# text.append("")
# if self.namepassed != []:
# for test in self.namepassed:
# text.append(test)
# text.append("---------")
# text.append("noresult : " + str(self.testsnoresult))
# text.append("")
# if self.namenoresult != []:
# for test in self.namenoresult:
# text.append(test)
# text.append("---------")
# return text
|