summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-10-28 18:48:49 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-04 12:50:55 +0000
commit754fa212bcdfc5c88641420f6a75276705678f32 (patch)
tree4285b057bc34bf20648af190bb13c40ab4b59de9 /bitbake
parent83ebb8987716d9dce7a91eb6340c3f2614bb1e18 (diff)
downloadpoky-754fa212bcdfc5c88641420f6a75276705678f32.tar.gz
bitbake: toaster: tests builds test_core_image_min Clean ups
Instead of searching for the build for each test just use the returned value of the completed build. (Bitbake rev: ecb94e50262b3f4ca8d5107f77f053335ef23511) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/tests/builds/test_core_image_min.py50
1 files changed, 20 insertions, 30 deletions
diff --git a/bitbake/lib/toaster/tests/builds/test_core_image_min.py b/bitbake/lib/toaster/tests/builds/test_core_image_min.py
index dec0bfa7f2..586f4a8f7f 100644
--- a/bitbake/lib/toaster/tests/builds/test_core_image_min.py
+++ b/bitbake/lib/toaster/tests/builds/test_core_image_min.py
@@ -31,14 +31,14 @@ from orm.models import Package_Dependency, Recipe_Dependency, Build
31from orm.models import Task_Dependency, Package, Target, Recipe 31from orm.models import Task_Dependency, Package, Target, Recipe
32from orm.models import CustomImagePackage 32from orm.models import CustomImagePackage
33 33
34from buildtest import BuildTest 34from tests.builds.buildtest import BuildTest
35 35
36 36
37class BuildCoreImageMinimal(BuildTest): 37class BuildCoreImageMinimal(BuildTest):
38 """Build core-image-minimal and test the results""" 38 """Build core-image-minimal and test the results"""
39 39
40 def setUp(self): 40 def setUp(self):
41 self.build("core-image-minimal") 41 self.completed_build = self.build("core-image-minimal")
42 42
43 # Check if build name is unique - tc_id=795 43 # Check if build name is unique - tc_id=795
44 def test_Build_Unique_Name(self): 44 def test_Build_Unique_Name(self):
@@ -59,38 +59,29 @@ class BuildCoreImageMinimal(BuildTest):
59 59
60 # Check if task order is unique for one build - tc=824 60 # Check if task order is unique for one build - tc=824
61 def test_Task_Unique_Order(self): 61 def test_Task_Unique_Order(self):
62 builds = Build.objects.values('id') 62 total_task_order = Task.objects.filter(
63 cnt_err = [] 63 build=self.built).values('order').count()
64 64 distinct_task_order = Task.objects.filter(
65 for build in builds: 65 build=self.completed_build).values('order').distinct().count()
66 total_task_order = Task.objects.filter(
67 build=build['id']).values('order').count()
68 distinct_task_order = Task.objects.filter(
69 build=build['id']).values('order').distinct().count()
70 66
71 if (total_task_order != distinct_task_order): 67 self.assertEqual(total_task_order,
72 cnt_err.append(build['id']) 68 distinct_task_order,
73 69 msg='Errors task order is not unique')
74 self.assertEqual(len(cnt_err),
75 0,
76 msg='Errors for build id: %s' % cnt_err)
77 70
78 # Check task order sequence for one build - tc=825 71 # Check task order sequence for one build - tc=825
79 def test_Task_Order_Sequence(self): 72 def test_Task_Order_Sequence(self):
80 builds = builds = Build.objects.values('id')
81 cnt_err = [] 73 cnt_err = []
82 for build in builds: 74 tasks = Task.objects.filter(
83 tasks = Task.objects.filter( 75 Q(build=self.completed_build),
84 Q(build=build['id']), 76 ~Q(order=None),
85 ~Q(order=None), 77 ~Q(task_name__contains='_setscene')
86 ~Q(task_name__contains='_setscene') 78 ).values('id', 'order').order_by("order")
87 ).values('id', 'order').order_by("order")
88 79
89 cnt_tasks = 0 80 cnt_tasks = 0
90 for task in tasks: 81 for task in tasks:
91 cnt_tasks += 1 82 cnt_tasks += 1
92 if (task['order'] != cnt_tasks): 83 if (task['order'] != cnt_tasks):
93 cnt_err.append(task['id']) 84 cnt_err.append(task['id'])
94 self.assertEqual( 85 self.assertEqual(
95 len(cnt_err), 0, msg='Errors for task id: %s' % cnt_err) 86 len(cnt_err), 0, msg='Errors for task id: %s' % cnt_err)
96 87
@@ -126,8 +117,7 @@ class BuildCoreImageMinimal(BuildTest):
126 task['sstate_result'] != Task.SSTATE_MISS): 117 task['sstate_result'] != Task.SSTATE_MISS):
127 cnt_err.append({'id': task['id'], 118 cnt_err.append({'id': task['id'],
128 'name': task['task_name'], 119 'name': task['task_name'],
129 'sstate_result': task['sstate_result'], 120 'sstate_result': task['sstate_result']})
130 })
131 121
132 self.assertEqual(len(cnt_err), 122 self.assertEqual(len(cnt_err),
133 0, 123 0,