diff options
Diffstat (limited to 'lib/toaster/tests/builds')
-rw-r--r-- | lib/toaster/tests/builds/buildtest.py | 13 | ||||
-rw-r--r-- | lib/toaster/tests/builds/test_core_image_min.py | 20 |
2 files changed, 16 insertions, 17 deletions
diff --git a/lib/toaster/tests/builds/buildtest.py b/lib/toaster/tests/builds/buildtest.py index 872bbd377..cacfccd4d 100644 --- a/lib/toaster/tests/builds/buildtest.py +++ b/lib/toaster/tests/builds/buildtest.py @@ -88,7 +88,7 @@ def load_build_environment(): class BuildTest(unittest.TestCase): PROJECT_NAME = "Testbuild" - BUILDDIR = "/tmp/build/" + BUILDDIR = os.environ.get("BUILDDIR") def build(self, target): # So that the buildinfo helper uses the test database' @@ -116,10 +116,19 @@ class BuildTest(unittest.TestCase): project = Project.objects.create_project(name=BuildTest.PROJECT_NAME, release=release) + passthrough_variable_names = ["SSTATE_DIR", "DL_DIR", "SSTATE_MIRRORS", "BB_HASHSERVE", "BB_HASHSERVE_UPSTREAM"] + for variable_name in passthrough_variable_names: + current_variable = os.environ.get(variable_name) + if current_variable: + ProjectVariable.objects.get_or_create( + name=variable_name, + value=current_variable, + project=project) + if os.environ.get("TOASTER_TEST_USE_SSTATE_MIRROR"): ProjectVariable.objects.get_or_create( name="SSTATE_MIRRORS", - value="file://.* http://autobuilder.yoctoproject.org/pub/sstate/PATH;downloadfilename=PATH", + value="file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH", project=project) ProjectTarget.objects.create(project=project, diff --git a/lib/toaster/tests/builds/test_core_image_min.py b/lib/toaster/tests/builds/test_core_image_min.py index 44b6cbec7..c5bfdbfbb 100644 --- a/lib/toaster/tests/builds/test_core_image_min.py +++ b/lib/toaster/tests/builds/test_core_image_min.py @@ -10,6 +10,7 @@ # Ionut Chisanovici, Paul Eggleton and Cristian Iorga import os +import pytest from django.db.models import Q @@ -20,12 +21,13 @@ from orm.models import CustomImagePackage from tests.builds.buildtest import BuildTest - +@pytest.mark.order(4) +@pytest.mark.django_db(True) class BuildCoreImageMinimal(BuildTest): """Build core-image-minimal and test the results""" def setUp(self): - self.completed_build = self.build("core-image-minimal") + self.completed_build = self.target_already_built("core-image-minimal") # Check if build name is unique - tc_id=795 def test_Build_Unique_Name(self): @@ -44,17 +46,6 @@ class BuildCoreImageMinimal(BuildTest): total_builds, msg='Build cooker log path is not unique') - # Check if task order is unique for one build - tc=824 - def test_Task_Unique_Order(self): - total_task_order = Task.objects.filter( - build=self.built).values('order').count() - distinct_task_order = Task.objects.filter( - build=self.completed_build).values('order').distinct().count() - - self.assertEqual(total_task_order, - distinct_task_order, - msg='Errors task order is not unique') - # Check task order sequence for one build - tc=825 def test_Task_Order_Sequence(self): cnt_err = [] @@ -98,7 +89,6 @@ class BuildCoreImageMinimal(BuildTest): 'task_name', 'sstate_result') cnt_err = [] - for task in tasks: if (task['sstate_result'] != Task.SSTATE_NA and task['sstate_result'] != Task.SSTATE_MISS): @@ -221,6 +211,7 @@ class BuildCoreImageMinimal(BuildTest): # orm_build.outcome=0 then if the file exists and its size matches # the file_size value. Need to add the tc in the test run def test_Target_File_Name_Populated(self): + cnt_err = [] builds = Build.objects.filter(outcome=0).values('id') for build in builds: targets = Target.objects.filter( @@ -230,7 +221,6 @@ class BuildCoreImageMinimal(BuildTest): target_id=target['id']).values('id', 'file_name', 'file_size') - cnt_err = [] for file_info in target_files: target_id = file_info['id'] target_file_name = file_info['file_name'] |