aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/autobuilder/buildsteps/RunESDKSanityTests.py
blob: 1ec26e4190bb472355fc05bd5367af945aa1a383 (plain)
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
'''
Created on Aug 18, 2015

__author__ = "Elizabeth 'pidge' Flanagan"
__copyright__ = "Copyright 2012-2015, 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 RunESDKSanityTests(BitbakeShellCommand):

    haltOnFailure = False
    flunkOnFailure = True
    name = "Running ESDK 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 SDK Sanity Tests"
        kwargs['timeout']=self.timeout
        super(RunESDKSanityTests, self).__init__(factory, argdict=None, **kwargs)

    def start(self):
        layerversion = int(self.getProperty("layerversion_core", "0"))
        command = ""
        command = command + ". ./oe-init-build-env; "
        command = command + "checkvnc; "
        if layerversion >= 7:
            command = command + "echo 'INHERIT += \"testsdk\"' >> ./conf/auto.conf;"
            command = command + "echo 'TEST_QEMUBOOT_TIMEOUT = \"1500\"' >> ./conf/auto.conf;"
            if self.suites:
                command = command + "echo 'TEST_SUITES = \"" + self.suites + "\"'" + " >> ./conf/auto.conf;"
            if self.suitesappend:
                command = command + "echo 'TEST_SUITES_append = \" " + self.suitesappend + "\"'" + " >> ./conf/auto.conf;"
            command = command + "DISPLAY=:1 bitbake -v " + self.images + " -c testsdkext"
            self.command = command
        else:
            self.skipStep('Skipping step for older versions.')
        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