diff options
Diffstat (limited to 'bitbake/lib/toaster/tests/builds')
-rw-r--r-- | bitbake/lib/toaster/tests/builds/buildtest.py | 13 | ||||
-rw-r--r-- | bitbake/lib/toaster/tests/builds/test_core_image_min.py | 20 |
2 files changed, 16 insertions, 17 deletions
diff --git a/bitbake/lib/toaster/tests/builds/buildtest.py b/bitbake/lib/toaster/tests/builds/buildtest.py index 872bbd3775..cacfccd4d3 100644 --- a/bitbake/lib/toaster/tests/builds/buildtest.py +++ b/bitbake/lib/toaster/tests/builds/buildtest.py | |||
@@ -88,7 +88,7 @@ def load_build_environment(): | |||
88 | class BuildTest(unittest.TestCase): | 88 | class BuildTest(unittest.TestCase): |
89 | 89 | ||
90 | PROJECT_NAME = "Testbuild" | 90 | PROJECT_NAME = "Testbuild" |
91 | BUILDDIR = "/tmp/build/" | 91 | BUILDDIR = os.environ.get("BUILDDIR") |
92 | 92 | ||
93 | def build(self, target): | 93 | def build(self, target): |
94 | # So that the buildinfo helper uses the test database' | 94 | # So that the buildinfo helper uses the test database' |
@@ -116,10 +116,19 @@ class BuildTest(unittest.TestCase): | |||
116 | project = Project.objects.create_project(name=BuildTest.PROJECT_NAME, | 116 | project = Project.objects.create_project(name=BuildTest.PROJECT_NAME, |
117 | release=release) | 117 | release=release) |
118 | 118 | ||
119 | passthrough_variable_names = ["SSTATE_DIR", "DL_DIR", "SSTATE_MIRRORS", "BB_HASHSERVE", "BB_HASHSERVE_UPSTREAM"] | ||
120 | for variable_name in passthrough_variable_names: | ||
121 | current_variable = os.environ.get(variable_name) | ||
122 | if current_variable: | ||
123 | ProjectVariable.objects.get_or_create( | ||
124 | name=variable_name, | ||
125 | value=current_variable, | ||
126 | project=project) | ||
127 | |||
119 | if os.environ.get("TOASTER_TEST_USE_SSTATE_MIRROR"): | 128 | if os.environ.get("TOASTER_TEST_USE_SSTATE_MIRROR"): |
120 | ProjectVariable.objects.get_or_create( | 129 | ProjectVariable.objects.get_or_create( |
121 | name="SSTATE_MIRRORS", | 130 | name="SSTATE_MIRRORS", |
122 | value="file://.* http://autobuilder.yoctoproject.org/pub/sstate/PATH;downloadfilename=PATH", | 131 | value="file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH", |
123 | project=project) | 132 | project=project) |
124 | 133 | ||
125 | ProjectTarget.objects.create(project=project, | 134 | ProjectTarget.objects.create(project=project, |
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 44b6cbec7b..c5bfdbfbb5 100644 --- a/bitbake/lib/toaster/tests/builds/test_core_image_min.py +++ b/bitbake/lib/toaster/tests/builds/test_core_image_min.py | |||
@@ -10,6 +10,7 @@ | |||
10 | # Ionut Chisanovici, Paul Eggleton and Cristian Iorga | 10 | # Ionut Chisanovici, Paul Eggleton and Cristian Iorga |
11 | 11 | ||
12 | import os | 12 | import os |
13 | import pytest | ||
13 | 14 | ||
14 | from django.db.models import Q | 15 | from django.db.models import Q |
15 | 16 | ||
@@ -20,12 +21,13 @@ from orm.models import CustomImagePackage | |||
20 | 21 | ||
21 | from tests.builds.buildtest import BuildTest | 22 | from tests.builds.buildtest import BuildTest |
22 | 23 | ||
23 | 24 | @pytest.mark.order(4) | |
25 | @pytest.mark.django_db(True) | ||
24 | class BuildCoreImageMinimal(BuildTest): | 26 | class BuildCoreImageMinimal(BuildTest): |
25 | """Build core-image-minimal and test the results""" | 27 | """Build core-image-minimal and test the results""" |
26 | 28 | ||
27 | def setUp(self): | 29 | def setUp(self): |
28 | self.completed_build = self.build("core-image-minimal") | 30 | self.completed_build = self.target_already_built("core-image-minimal") |
29 | 31 | ||
30 | # Check if build name is unique - tc_id=795 | 32 | # Check if build name is unique - tc_id=795 |
31 | def test_Build_Unique_Name(self): | 33 | def test_Build_Unique_Name(self): |
@@ -44,17 +46,6 @@ class BuildCoreImageMinimal(BuildTest): | |||
44 | total_builds, | 46 | total_builds, |
45 | msg='Build cooker log path is not unique') | 47 | msg='Build cooker log path is not unique') |
46 | 48 | ||
47 | # Check if task order is unique for one build - tc=824 | ||
48 | def test_Task_Unique_Order(self): | ||
49 | total_task_order = Task.objects.filter( | ||
50 | build=self.built).values('order').count() | ||
51 | distinct_task_order = Task.objects.filter( | ||
52 | build=self.completed_build).values('order').distinct().count() | ||
53 | |||
54 | self.assertEqual(total_task_order, | ||
55 | distinct_task_order, | ||
56 | msg='Errors task order is not unique') | ||
57 | |||
58 | # Check task order sequence for one build - tc=825 | 49 | # Check task order sequence for one build - tc=825 |
59 | def test_Task_Order_Sequence(self): | 50 | def test_Task_Order_Sequence(self): |
60 | cnt_err = [] | 51 | cnt_err = [] |
@@ -98,7 +89,6 @@ class BuildCoreImageMinimal(BuildTest): | |||
98 | 'task_name', | 89 | 'task_name', |
99 | 'sstate_result') | 90 | 'sstate_result') |
100 | cnt_err = [] | 91 | cnt_err = [] |
101 | |||
102 | for task in tasks: | 92 | for task in tasks: |
103 | if (task['sstate_result'] != Task.SSTATE_NA and | 93 | if (task['sstate_result'] != Task.SSTATE_NA and |
104 | task['sstate_result'] != Task.SSTATE_MISS): | 94 | task['sstate_result'] != Task.SSTATE_MISS): |
@@ -221,6 +211,7 @@ class BuildCoreImageMinimal(BuildTest): | |||
221 | # orm_build.outcome=0 then if the file exists and its size matches | 211 | # orm_build.outcome=0 then if the file exists and its size matches |
222 | # the file_size value. Need to add the tc in the test run | 212 | # the file_size value. Need to add the tc in the test run |
223 | def test_Target_File_Name_Populated(self): | 213 | def test_Target_File_Name_Populated(self): |
214 | cnt_err = [] | ||
224 | builds = Build.objects.filter(outcome=0).values('id') | 215 | builds = Build.objects.filter(outcome=0).values('id') |
225 | for build in builds: | 216 | for build in builds: |
226 | targets = Target.objects.filter( | 217 | targets = Target.objects.filter( |
@@ -230,7 +221,6 @@ class BuildCoreImageMinimal(BuildTest): | |||
230 | target_id=target['id']).values('id', | 221 | target_id=target['id']).values('id', |
231 | 'file_name', | 222 | 'file_name', |
232 | 'file_size') | 223 | 'file_size') |
233 | cnt_err = [] | ||
234 | for file_info in target_files: | 224 | for file_info in target_files: |
235 | target_id = file_info['id'] | 225 | target_id = file_info['id'] |
236 | target_file_name = file_info['file_name'] | 226 | target_file_name = file_info['file_name'] |