diff mbox series

[1/3] support/testing/tests/package/test_python_boto3: use ext2 instead of cpio

Message ID 20220815214815.2234201-2-thomas.petazzoni@bootlin.com
State Accepted
Headers show
Series Fix 3 Python test cases | expand

Commit Message

Thomas Petazzoni Aug. 15, 2022, 9:48 p.m. UTC
The CPIO filesystem generated by the test_python_boto3 test is too
large, and doesn't fit as an initramfs in the 256MB of RAM available
in the versatilepb machine. This causes a "Initramfs unpacking failed:
write error" when booting, and many files being missing from the root
filesystem, ultimately causing the test to fail.

It would make sense to switch all test cases to use ext2 + a
hard-drive, but for now, let's fix the few test cases that are causing
problems.

Fixes:

  https://gitlab.com/buildroot.org/buildroot/-/jobs/2884635041

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/testing/tests/package/test_python_boto3.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Yann E. MORIN Aug. 16, 2022, 4:26 p.m. UTC | #1
Thomas, All,

On 2022-08-15 23:48 +0200, Thomas Petazzoni via buildroot spake thusly:
> The CPIO filesystem generated by the test_python_boto3 test is too
> large, and doesn't fit as an initramfs in the 256MB of RAM available
> in the versatilepb machine. This causes a "Initramfs unpacking failed:
> write error" when booting, and many files being missing from the root
> filesystem, ultimately causing the test to fail.
> 
> It would make sense to switch all test cases to use ext2 + a
> hard-drive, but for now, let's fix the few test cases that are causing
> problems.
> 
> Fixes:
> 
>   https://gitlab.com/buildroot.org/buildroot/-/jobs/2884635041
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
>  support/testing/tests/package/test_python_boto3.py | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/support/testing/tests/package/test_python_boto3.py b/support/testing/tests/package/test_python_boto3.py
> index 756495fec9..7f24399304 100644
> --- a/support/testing/tests/package/test_python_boto3.py
> +++ b/support/testing/tests/package/test_python_boto3.py
> @@ -1,4 +1,5 @@
>  from tests.package.test_python import TestPythonPackageBase
> +import os
>  
>  
>  class TestPythonPy3Boto3(TestPythonPackageBase):
> @@ -7,6 +8,17 @@ class TestPythonPy3Boto3(TestPythonPackageBase):
>          """
>          BR2_PACKAGE_PYTHON3=y
>          BR2_PACKAGE_PYTHON_BOTO3=y
> +        BR2_TARGET_ROOTFS_EXT2=y
> +        BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
> +        # BR2_TARGET_ROOTFS_TAR is not set

BR2_TARGET_ROOTFS_TAR is already unset in TestPythonPackageBase.config,
so disabling it here is superfluous.

But this will however still build the cpio archive, because it is
enabled in TestPythonPackageBase.config.

We can disable it with:

    class TestPythonPy3Boto3(TestPythonPackageBase):
        config = TestPythonPackageBase.config.replace('BR2_TARGET_ROOTFS_CPIO=y\n', '') + \
            """
            blablabla
            """

If you believe that it is acceptable, I can fix when applying. Or we can
continue to uselessly build the cpio archive, which does not take very
long to assemble...

Regards,
Yann E. MORIN.

>          """
>      sample_scripts = ["tests/package/sample_python_boto3.py"]
>      timeout = 10
> +
> +    def login(self):
> +        ext2_file = os.path.join(self.builddir, "images", "rootfs.ext2")
> +        self.emulator.boot(arch="armv5",
> +                           kernel="builtin",
> +                           options=["-drive", "file=%s,if=scsi,format=raw" % ext2_file],
> +                           kernel_cmdline=["rootwait", "root=/dev/sda"])
> +        self.emulator.login()
> -- 
> 2.37.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni Aug. 16, 2022, 8:42 p.m. UTC | #2
Hello,

On Tue, 16 Aug 2022 18:26:26 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> >  class TestPythonPy3Boto3(TestPythonPackageBase):
> > @@ -7,6 +8,17 @@ class TestPythonPy3Boto3(TestPythonPackageBase):
> >          """
> >          BR2_PACKAGE_PYTHON3=y
> >          BR2_PACKAGE_PYTHON_BOTO3=y
> > +        BR2_TARGET_ROOTFS_EXT2=y
> > +        BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
> > +        # BR2_TARGET_ROOTFS_TAR is not set  
> 
> BR2_TARGET_ROOTFS_TAR is already unset in TestPythonPackageBase.config,
> so disabling it here is superfluous.

Ah indeed.

> But this will however still build the cpio archive, because it is
> enabled in TestPythonPackageBase.config.
> 
> We can disable it with:
> 
>     class TestPythonPy3Boto3(TestPythonPackageBase):
>         config = TestPythonPackageBase.config.replace('BR2_TARGET_ROOTFS_CPIO=y\n', '') + \
>             """
>             blablabla
>             """
> 
> If you believe that it is acceptable, I can fix when applying. Or we can
> continue to uselessly build the cpio archive, which does not take very
> long to assemble...

I think we can continue to uselessly build the cpio archive. As I said,
my long term proposal would rather be to switch all tests to use ext2 +
a hard drive. We still need to define an image size, but at least we
can a hard and clear error if the filesystem no longer fits rather than
these weird errors caused by initramfs being partially uncompressed.

Thanks for the review!

Thomas
diff mbox series

Patch

diff --git a/support/testing/tests/package/test_python_boto3.py b/support/testing/tests/package/test_python_boto3.py
index 756495fec9..7f24399304 100644
--- a/support/testing/tests/package/test_python_boto3.py
+++ b/support/testing/tests/package/test_python_boto3.py
@@ -1,4 +1,5 @@ 
 from tests.package.test_python import TestPythonPackageBase
+import os
 
 
 class TestPythonPy3Boto3(TestPythonPackageBase):
@@ -7,6 +8,17 @@  class TestPythonPy3Boto3(TestPythonPackageBase):
         """
         BR2_PACKAGE_PYTHON3=y
         BR2_PACKAGE_PYTHON_BOTO3=y
+        BR2_TARGET_ROOTFS_EXT2=y
+        BR2_TARGET_ROOTFS_EXT2_SIZE="120M"
+        # BR2_TARGET_ROOTFS_TAR is not set
         """
     sample_scripts = ["tests/package/sample_python_boto3.py"]
     timeout = 10
+
+    def login(self):
+        ext2_file = os.path.join(self.builddir, "images", "rootfs.ext2")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-drive", "file=%s,if=scsi,format=raw" % ext2_file],
+                           kernel_cmdline=["rootwait", "root=/dev/sda"])
+        self.emulator.login()