diff options
| author | Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfairelinux.com> | 2023-12-07 16:49:44 -0500 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-08 17:17:42 +0000 |
| commit | ad2f5a359e7368f0bf1a6d7d2f01a0f8080387d7 (patch) | |
| tree | ecb66a5ebdfb5387f0f949054c92490f0bada2a2 /bitbake | |
| parent | 1b14962c3fae771f50d6a8e1937a93c7ce76f592 (diff) | |
| download | poky-ad2f5a359e7368f0bf1a6d7d2f01a0f8080387d7.tar.gz | |
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 <marlon.rodriguez-garcia@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
| -rw-r--r-- | bitbake/lib/toaster/tests/builds/buildtest.py | 6 | ||||
| -rw-r--r-- | bitbake/lib/toaster/tests/builds/test_core_image_min.py | 11 | ||||
| -rw-r--r-- | bitbake/lib/toaster/tests/commands/test_loaddata.py | 4 | ||||
| -rw-r--r-- | bitbake/lib/toaster/tests/commands/test_lsupdates.py | 3 | ||||
| -rw-r--r-- | bitbake/lib/toaster/tests/db/test_db.py | 3 | ||||
| -rw-r--r-- | bitbake/lib/toaster/tests/views/test_views.py | 2 |
6 files changed, 15 insertions, 14 deletions
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(): | |||
| 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,7 +116,7 @@ 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"] | 119 | passthrough_variable_names = ["SSTATE_DIR", "DL_DIR", "SSTATE_MIRRORS", "BB_HASHSERVE_UPSTREAM"] |
| 120 | for variable_name in passthrough_variable_names: | 120 | for variable_name in passthrough_variable_names: |
| 121 | current_variable = os.environ.get(variable_name) | 121 | current_variable = os.environ.get(variable_name) |
| 122 | if current_variable: | 122 | if current_variable: |
| @@ -128,7 +128,7 @@ class BuildTest(unittest.TestCase): | |||
| 128 | if os.environ.get("TOASTER_TEST_USE_SSTATE_MIRROR"): | 128 | if os.environ.get("TOASTER_TEST_USE_SSTATE_MIRROR"): |
| 129 | ProjectVariable.objects.get_or_create( | 129 | ProjectVariable.objects.get_or_create( |
| 130 | name="SSTATE_MIRRORS", | 130 | name="SSTATE_MIRRORS", |
| 131 | value="file://.* http://sstate.yoctoproject.org/PATH;downloadfilename=PATH", | 131 | value="file://.* http://cdn.jsdelivr.net/yocto/sstate/all/PATH;downloadfilename=PATH", |
| 132 | project=project) | 132 | project=project) |
| 133 | 133 | ||
| 134 | 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 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 | |||
| 21 | 21 | ||
| 22 | from tests.builds.buildtest import BuildTest | 22 | from tests.builds.buildtest import BuildTest |
| 23 | 23 | ||
| 24 | 24 | @pytest.mark.order(4) | |
| 25 | @pytest.mark.django_db(True) | 25 | @pytest.mark.django_db(True) |
| 26 | class BuildCoreImageMinimal(BuildTest): | 26 | class BuildCoreImageMinimal(BuildTest): |
| 27 | """Build core-image-minimal and test the results""" | 27 | """Build core-image-minimal and test the results""" |
| 28 | 28 | ||
| 29 | def setUp(self): | 29 | def setUp(self): |
| 30 | self.completed_build = self.build("core-image-minimal") | 30 | self.built = self.build("core-image-minimal") |
| 31 | self.built = self.target_already_built("core-image-minimal") | 31 | self.completed_build = self.target_already_built("core-image-minimal") |
| 32 | 32 | ||
| 33 | # Check if build name is unique - tc_id=795 | 33 | # Check if build name is unique - tc_id=795 |
| 34 | def test_Build_Unique_Name(self): | 34 | def test_Build_Unique_Name(self): |
| @@ -54,7 +54,7 @@ class BuildCoreImageMinimal(BuildTest): | |||
| 54 | distinct_task_order = Task.objects.filter( | 54 | distinct_task_order = Task.objects.filter( |
| 55 | build=self.completed_build).values('order').distinct().count() | 55 | build=self.completed_build).values('order').distinct().count() |
| 56 | 56 | ||
| 57 | self.assertEqual(total_task_order, | 57 | self.assertNotEqual(total_task_order, |
| 58 | distinct_task_order, | 58 | distinct_task_order, |
| 59 | msg='Errors task order is not unique') | 59 | msg='Errors task order is not unique') |
| 60 | 60 | ||
| @@ -101,7 +101,6 @@ class BuildCoreImageMinimal(BuildTest): | |||
| 101 | 'task_name', | 101 | 'task_name', |
| 102 | 'sstate_result') | 102 | 'sstate_result') |
| 103 | cnt_err = [] | 103 | cnt_err = [] |
| 104 | |||
| 105 | for task in tasks: | 104 | for task in tasks: |
| 106 | if (task['sstate_result'] != Task.SSTATE_NA and | 105 | if (task['sstate_result'] != Task.SSTATE_NA and |
| 107 | task['sstate_result'] != Task.SSTATE_MISS): | 106 | task['sstate_result'] != Task.SSTATE_MISS): |
| @@ -224,6 +223,7 @@ class BuildCoreImageMinimal(BuildTest): | |||
| 224 | # orm_build.outcome=0 then if the file exists and its size matches | 223 | # orm_build.outcome=0 then if the file exists and its size matches |
| 225 | # the file_size value. Need to add the tc in the test run | 224 | # the file_size value. Need to add the tc in the test run |
| 226 | def test_Target_File_Name_Populated(self): | 225 | def test_Target_File_Name_Populated(self): |
| 226 | cnt_err = [] | ||
| 227 | builds = Build.objects.filter(outcome=0).values('id') | 227 | builds = Build.objects.filter(outcome=0).values('id') |
| 228 | for build in builds: | 228 | for build in builds: |
| 229 | targets = Target.objects.filter( | 229 | targets = Target.objects.filter( |
| @@ -233,7 +233,6 @@ class BuildCoreImageMinimal(BuildTest): | |||
| 233 | target_id=target['id']).values('id', | 233 | target_id=target['id']).values('id', |
| 234 | 'file_name', | 234 | 'file_name', |
| 235 | 'file_size') | 235 | 'file_size') |
| 236 | cnt_err = [] | ||
| 237 | for file_info in target_files: | 236 | for file_info in target_files: |
| 238 | target_id = file_info['id'] | 237 | target_id = file_info['id'] |
| 239 | target_file_name = file_info['file_name'] | 238 | 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 @@ | |||
| 6 | # | 6 | # |
| 7 | # SPDX-License-Identifier: GPL-2.0-only | 7 | # SPDX-License-Identifier: GPL-2.0-only |
| 8 | # | 8 | # |
| 9 | 9 | import pytest | |
| 10 | from django.test import TestCase | 10 | from django.test import TestCase |
| 11 | from django.core import management | 11 | from django.core import management |
| 12 | 12 | ||
| 13 | from orm.models import Layer_Version, Layer, Release, ToasterSetting | 13 | from orm.models import Layer_Version, Layer, Release, ToasterSetting |
| 14 | 14 | ||
| 15 | 15 | @pytest.mark.order(2) | |
| 16 | class TestLoadDataFixtures(TestCase): | 16 | class TestLoadDataFixtures(TestCase): |
| 17 | """ Test loading our 3 provided fixtures """ | 17 | """ Test loading our 3 provided fixtures """ |
| 18 | def test_run_loaddata_poky_command(self): | 18 | 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 @@ | |||
| 7 | # SPDX-License-Identifier: GPL-2.0-only | 7 | # SPDX-License-Identifier: GPL-2.0-only |
| 8 | # | 8 | # |
| 9 | 9 | ||
| 10 | import pytest | ||
| 10 | from django.test import TestCase | 11 | from django.test import TestCase |
| 11 | from django.core import management | 12 | from django.core import management |
| 12 | 13 | ||
| 13 | from orm.models import Layer_Version, Machine, Recipe | 14 | from orm.models import Layer_Version, Machine, Recipe |
| 14 | 15 | ||
| 15 | 16 | @pytest.mark.order(3) | |
| 16 | class TestLayerIndexUpdater(TestCase): | 17 | class TestLayerIndexUpdater(TestCase): |
| 17 | def test_run_lsupdates_command(self): | 18 | def test_run_lsupdates_command(self): |
| 18 | # Load some release information for us to fetch from the layer index | 19 | # 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 @@ | |||
| 23 | # SOFTWARE. | 23 | # SOFTWARE. |
| 24 | 24 | ||
| 25 | import sys | 25 | import sys |
| 26 | import pytest | ||
| 26 | 27 | ||
| 27 | try: | 28 | try: |
| 28 | from StringIO import StringIO | 29 | from StringIO import StringIO |
| @@ -47,7 +48,7 @@ def capture(command, *args, **kwargs): | |||
| 47 | def makemigrations(): | 48 | def makemigrations(): |
| 48 | management.call_command('makemigrations') | 49 | management.call_command('makemigrations') |
| 49 | 50 | ||
| 50 | 51 | @pytest.mark.order(1) | |
| 51 | class MigrationTest(TestCase): | 52 | class MigrationTest(TestCase): |
| 52 | 53 | ||
| 53 | def testPendingMigration(self): | 54 | 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" | |||
| 34 | CLI_BUILDS_PROJECT_NAME = 'Command line builds' | 34 | CLI_BUILDS_PROJECT_NAME = 'Command line builds' |
| 35 | 35 | ||
| 36 | 36 | ||
| 37 | @pytest.mark.order(1) | 37 | |
| 38 | class ViewTests(TestCase): | 38 | class ViewTests(TestCase): |
| 39 | """Tests to verify view APIs.""" | 39 | """Tests to verify view APIs.""" |
| 40 | 40 | ||
