diff options
| -rw-r--r-- | tests/conftest.py | 26 | ||||
| -rw-r--r-- | tests/test_container_cross_install.py | 28 |
2 files changed, 34 insertions, 20 deletions
diff --git a/tests/conftest.py b/tests/conftest.py index 22c47d17..2028ef32 100644 --- a/tests/conftest.py +++ b/tests/conftest.py | |||
| @@ -501,10 +501,17 @@ class VdkrRunner: | |||
| 501 | result = self.memres_status() | 501 | result = self.memres_status() |
| 502 | return result.returncode == 0 and "running" in result.stdout.lower() | 502 | return result.returncode == 0 and "running" in result.stdout.lower() |
| 503 | 503 | ||
| 504 | def ensure_memres(self, timeout=180): | 504 | def ensure_memres(self, timeout=180, no_registry=True): |
| 505 | """Ensure memres is running, starting it if needed.""" | 505 | """Ensure memres is running, starting it if needed. |
| 506 | |||
| 507 | Args: | ||
| 508 | timeout: Timeout for memres start | ||
| 509 | no_registry: Disable baked-in registry (default True for tests | ||
| 510 | so that pulled images use short names like alpine:latest | ||
| 511 | rather than registry-prefixed names) | ||
| 512 | """ | ||
| 506 | if not self.is_memres_running(): | 513 | if not self.is_memres_running(): |
| 507 | result = self.memres_start(timeout=timeout) | 514 | result = self.memres_start(timeout=timeout, no_registry=no_registry) |
| 508 | if result.returncode != 0: | 515 | if result.returncode != 0: |
| 509 | raise RuntimeError(f"Failed to start memres: {result.stderr}") | 516 | raise RuntimeError(f"Failed to start memres: {result.stderr}") |
| 510 | 517 | ||
| @@ -790,10 +797,17 @@ class VpdmnRunner: | |||
| 790 | result = self.memres_status() | 797 | result = self.memres_status() |
| 791 | return result.returncode == 0 and "running" in result.stdout.lower() | 798 | return result.returncode == 0 and "running" in result.stdout.lower() |
| 792 | 799 | ||
| 793 | def ensure_memres(self, timeout=180): | 800 | def ensure_memres(self, timeout=180, no_registry=True): |
| 794 | """Ensure memres is running, starting it if needed.""" | 801 | """Ensure memres is running, starting it if needed. |
| 802 | |||
| 803 | Args: | ||
| 804 | timeout: Timeout for memres start | ||
| 805 | no_registry: Disable baked-in registry (default True for tests | ||
| 806 | so that pulled images use short names like alpine:latest | ||
| 807 | rather than registry-prefixed names) | ||
| 808 | """ | ||
| 795 | if not self.is_memres_running(): | 809 | if not self.is_memres_running(): |
| 796 | result = self.memres_start(timeout=timeout) | 810 | result = self.memres_start(timeout=timeout, no_registry=no_registry) |
| 797 | if result.returncode != 0: | 811 | if result.returncode != 0: |
| 798 | raise RuntimeError(f"Failed to start memres: {result.stderr}") | 812 | raise RuntimeError(f"Failed to start memres: {result.stderr}") |
| 799 | 813 | ||
diff --git a/tests/test_container_cross_install.py b/tests/test_container_cross_install.py index ceb8b874..f14bfbc5 100644 --- a/tests/test_container_cross_install.py +++ b/tests/test_container_cross_install.py | |||
| @@ -88,21 +88,21 @@ def meta_virt_dir(poky_dir): | |||
| 88 | 88 | ||
| 89 | 89 | ||
| 90 | def run_bitbake(build_dir, recipe, task=None, extra_args=None, timeout=1800): | 90 | def run_bitbake(build_dir, recipe, task=None, extra_args=None, timeout=1800): |
| 91 | """Run a bitbake command.""" | 91 | """Run a bitbake command within the Yocto environment.""" |
| 92 | cmd = ["bitbake"] | 92 | bb_cmd = "bitbake" |
| 93 | if task: | 93 | if task: |
| 94 | cmd.extend(["-c", task]) | 94 | bb_cmd += f" -c {task}" |
| 95 | cmd.append(recipe) | 95 | bb_cmd += f" {recipe}" |
| 96 | if extra_args: | 96 | if extra_args: |
| 97 | cmd.extend(extra_args) | 97 | bb_cmd += " " + " ".join(extra_args) |
| 98 | 98 | ||
| 99 | env = os.environ.copy() | 99 | poky_dir = build_dir.parent |
| 100 | env["BUILDDIR"] = str(build_dir) | 100 | full_cmd = f"bash -c 'cd {poky_dir} && source oe-init-build-env {build_dir} >/dev/null 2>&1 && {bb_cmd}'" |
| 101 | 101 | ||
| 102 | result = subprocess.run( | 102 | result = subprocess.run( |
| 103 | cmd, | 103 | full_cmd, |
| 104 | shell=True, | ||
| 104 | cwd=build_dir, | 105 | cwd=build_dir, |
| 105 | env=env, | ||
| 106 | timeout=timeout, | 106 | timeout=timeout, |
| 107 | capture_output=True, | 107 | capture_output=True, |
| 108 | text=True, | 108 | text=True, |
| @@ -298,13 +298,13 @@ class TestVdkrRecipes: | |||
| 298 | assert len(installers) > 0, f"No SDK installer found in {sdk_deploy}" | 298 | assert len(installers) > 0, f"No SDK installer found in {sdk_deploy}" |
| 299 | 299 | ||
| 300 | def test_vdkr_initramfs_create(self, build_dir): | 300 | def test_vdkr_initramfs_create(self, build_dir): |
| 301 | """Test vdkr-initramfs-create builds.""" | 301 | """Test vdkr-initramfs-create builds via multiconfig.""" |
| 302 | result = run_bitbake(build_dir, "vdkr-initramfs-create") | 302 | result = run_bitbake(build_dir, "mc:vruntime-x86-64:vdkr-initramfs-create") |
| 303 | assert result.returncode == 0, f"Build failed: {result.stderr}" | 303 | assert result.returncode == 0, f"Build failed: {result.stderr}" |
| 304 | 304 | ||
| 305 | def test_vpdmn_initramfs_create(self, build_dir): | 305 | def test_vpdmn_initramfs_create(self, build_dir): |
| 306 | """Test vpdmn-initramfs-create builds.""" | 306 | """Test vpdmn-initramfs-create builds via multiconfig.""" |
| 307 | result = run_bitbake(build_dir, "vpdmn-initramfs-create") | 307 | result = run_bitbake(build_dir, "mc:vruntime-x86-64:vpdmn-initramfs-create") |
| 308 | assert result.returncode == 0, f"Build failed: {result.stderr}" | 308 | assert result.returncode == 0, f"Build failed: {result.stderr}" |
| 309 | 309 | ||
| 310 | 310 | ||
| @@ -991,7 +991,7 @@ class TestCustomServiceFileBoot: | |||
| 991 | @pytest.mark.boot | 991 | @pytest.mark.boot |
| 992 | def test_systemd_services_directory_exists(self, runqemu_session): | 992 | def test_systemd_services_directory_exists(self, runqemu_session): |
| 993 | """Test that systemd service directories exist.""" | 993 | """Test that systemd service directories exist.""" |
| 994 | output = runqemu_session.run_command('ls -la /lib/systemd/system/ | head -5') | 994 | output = runqemu_session.run_command('ls -la /lib/systemd/system/ | head -n 5') |
| 995 | assert 'systemd' in output or 'total' in output, \ | 995 | assert 'systemd' in output or 'total' in output, \ |
| 996 | "Systemd system directory not accessible" | 996 | "Systemd system directory not accessible" |
| 997 | 997 | ||
