aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/hob-dogtail/packageSizeShown.py
blob: 3cd2c6837ad5331b914efd1645abf1251a0e958b (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
import os
from dogtail import tree
from dogtail.utils import run
import time
from dogtail.tree import predicate
from finishBuild import TestFinish
from packageSizeShown import PackageSize
from base import Base

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 BuildImage(Build):

    def testFinish(self):
    	try:
    		finish = hob.child("Build new image")
		print "Image is ready"
		return 10
    	except:
		return 25
	else:
		try:
			finish = hob.child("File a bug")
			return 20
		except:
			return 25
		else:
			try:
				finish = hob.child("Step 2 of 2: Edit packages")
				return 20
			except:			
				print "Image ready not detected"
				return 25

    def build(self):
        self.selectMachine('qemux86')
        self.selectImage('core-image-minimal')

        try:
            hob.child('Build image').click()
        except:
            self.writeInFile("image_build: can not find build image button")
            return 10

        self.writeInFile('\n' + "image build: ")

	time.sleep(120)
	#t=TestFinish()
        #finish = t.analyse()
	
	finish = 1
	while (finish % 10 != 0):	
		finish = self.testFinish()

        if finish == 20:
            self.writeInFile("failed")
        else:
            self.writeInFile("passed")
            instance = PackageSize()
            instance.showPackageSize()

        time.sleep(30)
        try:
            bnw = hob.child('Build new image')
            bnw.click()
        except:
            self.writeInFile("image_build: can not find build new image button")
        return 10