aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/hob-dogtail/finishBuild.py
blob: b86e2a0c8db818ad51c08d5460aafe48ff309256 (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
import os
from dogtail import tree
import time
from stopHob import StopHob
from startHob import StartHob

try:
    bitbake = tree.root.application('bitbake')
except:
    print "can not connect to the application"
else:
    try:
        hob = bitbake.child( roleName='frame' )
    except:
        print "can not connect to the application"

class TestFinish:

    def writeInFile(self, error_name):
        f = open('hobResults', 'a')
        f.write('\n' + error_name)
        f.close()

    def analyse(self):
        iters = 0
        while iters < 25:
            iters += 1
            try:
                #finish = hob.child(name = "Your image is ready", roleName = "label")
		finish = hob.child("Build new image")
            except:
                try:
                    hob.child('File a bug')
                    self.writeInFile("finish_build: found a bug")
                except:
                    try:
                        hob.child('Step 2 of 2: Edit packages')
                    except:
                        pass
                    else:
                        return 10
                else:
                    return 20

                try:
                    win = bitbake.findChildren(predicate.GenericPredicate(roleName="dialog"))
                    self.writeInFile("finish_build: found the dialog")
                except:
                    pass
                else:
                    if len(win)>0:
                        dialog=win[0]
                        try:
                            dialog.child('Close').click()
                        except:
                            pass
                        return 20
            else:
                return 10

        if iters == 25:
            stopH=StopHob()
            stopH.stop()
            self.writeInFile("finish_build: stop hob")

            time.sleep(40)

            startH=StartHob()
            startH.start()
            self.writeInFile("finish_build: start hob")
            return 20