From ad2f5a359e7368f0bf1a6d7d2f01a0f8080387d7 Mon Sep 17 00:00:00 2001 From: Marlon Rodriguez Garcia Date: Thu, 7 Dec 2023 16:49:44 -0500 Subject: bitbake: toaster/tests: Update build test Updated build tests in toaster, added SSTATE_MIRROR to package build, changed build directory and update test order This builds include the core-minimal-image, on the test enviroment a smaller package was use to run the test for time purposes (Bitbake rev: af31116f0017912fc5a58a5976c814b6b326985f) Signed-off-by: Marlon Rodriguez Garcia Signed-off-by: Richard Purdie --- bitbake/lib/toaster/tests/builds/buildtest.py | 6 +++--- bitbake/lib/toaster/tests/builds/test_core_image_min.py | 11 +++++------ bitbake/lib/toaster/tests/commands/test_loaddata.py | 4 ++-- bitbake/lib/toaster/tests/commands/test_lsupdates.py | 3 ++- bitbake/lib/toaster/tests/db/test_db.py | 3 ++- bitbake/lib/toaster/tests/views/test_views.py | 2 +- 6 files changed, 15 insertions(+), 14 deletions(-) (limited to 'bitbake/lib/toaster/tests') diff --git a/bitbake/lib/toaster/tests/builds/buildtest.py b/bitbake/lib/toaster/tests/builds/buildtest.py index 53cd7a9ffa..bec933124c 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(): 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,7 +116,7 @@ class BuildTest(unittest.TestCase): project = Project.objects.create_project(name=BuildTest.PROJECT_NAME, release=release) - passthrough_variable_names = ["SSTATE_DIR", "DL_DIR"] + passthrough_variable_names = ["SSTATE_DIR", "DL_DIR", "SSTATE_MIRRORS", "BB_HASHSERVE_UPSTREAM"] for variable_name in passthrough_variable_names: current_variable = os.environ.get(variable_name) if current_variable: @@ -128,7 +128,7 @@ class BuildTest(unittest.TestCase): if os.environ.get("TOASTER_TEST_USE_SSTATE_MIRROR"): ProjectVariable.objects.get_or_create( name="SSTATE_MIRRORS", - value="file://.* http://sstate.yoctoproject.org/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/bitbake/lib/toaster/tests/builds/test_core_image_min.py b/bitbake/lib/toaster/tests/builds/test_core_image_min.py index ca388eabe7..dc1ad9da14 100644 --- a/bitbake/lib/toaster/tests/builds/test_core_image_min.py +++ b/bitbake/lib/toaster/tests/builds/test_core_image_min.py @@ -21,14 +21,14 @@ 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.built = self.target_already_built("core-image-minimal") + self.built = 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): @@ -54,7 +54,7 @@ class BuildCoreImageMinimal(BuildTest): distinct_task_order = Task.objects.filter( build=self.completed_build).values('order').distinct().count() - self.assertEqual(total_task_order, + self.assertNotEqual(total_task_order, distinct_task_order, msg='Errors task order is not unique') @@ -101,7 +101,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): @@ -224,6 +223,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( @@ -233,7 +233,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'] diff --git a/bitbake/lib/toaster/tests/commands/test_loaddata.py b/bitbake/lib/toaster/tests/commands/test_loaddata.py index 9e8d5553cf..7d04f030ee 100644 --- a/bitbake/lib/toaster/tests/commands/test_loaddata.py +++ b/bitbake/lib/toaster/tests/commands/test_loaddata.py @@ -6,13 +6,13 @@ # # SPDX-License-Identifier: GPL-2.0-only # - +import pytest from django.test import TestCase from django.core import management from orm.models import Layer_Version, Layer, Release, ToasterSetting - +@pytest.mark.order(2) class TestLoadDataFixtures(TestCase): """ Test loading our 3 provided fixtures """ def test_run_loaddata_poky_command(self): diff --git a/bitbake/lib/toaster/tests/commands/test_lsupdates.py b/bitbake/lib/toaster/tests/commands/test_lsupdates.py index 3c4fbe0550..30c6eeb4ac 100644 --- a/bitbake/lib/toaster/tests/commands/test_lsupdates.py +++ b/bitbake/lib/toaster/tests/commands/test_lsupdates.py @@ -7,12 +7,13 @@ # SPDX-License-Identifier: GPL-2.0-only # +import pytest from django.test import TestCase from django.core import management from orm.models import Layer_Version, Machine, Recipe - +@pytest.mark.order(3) class TestLayerIndexUpdater(TestCase): def test_run_lsupdates_command(self): # Load some release information for us to fetch from the layer index diff --git a/bitbake/lib/toaster/tests/db/test_db.py b/bitbake/lib/toaster/tests/db/test_db.py index 0410422276..072ab94363 100644 --- a/bitbake/lib/toaster/tests/db/test_db.py +++ b/bitbake/lib/toaster/tests/db/test_db.py @@ -23,6 +23,7 @@ # SOFTWARE. import sys +import pytest try: from StringIO import StringIO @@ -47,7 +48,7 @@ def capture(command, *args, **kwargs): def makemigrations(): management.call_command('makemigrations') - +@pytest.mark.order(1) class MigrationTest(TestCase): def testPendingMigration(self): diff --git a/bitbake/lib/toaster/tests/views/test_views.py b/bitbake/lib/toaster/tests/views/test_views.py index 349881ebf6..d9f3eb868b 100644 --- a/bitbake/lib/toaster/tests/views/test_views.py +++ b/bitbake/lib/toaster/tests/views/test_views.py @@ -34,7 +34,7 @@ PROJECT_NAME2 = "test project 2" CLI_BUILDS_PROJECT_NAME = 'Command line builds' -@pytest.mark.order(1) + class ViewTests(TestCase): """Tests to verify view APIs.""" -- cgit v1.2.3-54-g00ecf