diff mbox series

[4/4] support/tests/cpio: extend runtime tests

Message ID 5cd3be7a788ce6fc3047069feacf48658c231483.1660931225.git.yann.morin.1998@free.fr
State Accepted
Headers show
Series dracut: extend support and tests (branch yem/dracut) | expand

Commit Message

Yann E. MORIN Aug. 19, 2022, 5:51 p.m. UTC
Check that dependencies that are DT_NEEDED by a program are
automatically copied by dracut. We use cramfs, the package,
as it is small and just depends on libz.

Test extra modules, and test more than one dracut config file.

Reported-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
Cc: Adam Duskett <aduskett@gmail.com>
---
 support/testing/tests/fs/test_cpio.py                 | 11 ++++++++++-
 support/testing/tests/fs/test_cpio/dracut-cramfs.conf |  7 +++++++
 .../fs/test_cpio/modules/99cramfs/module-setup.sh     | 11 +++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 support/testing/tests/fs/test_cpio/dracut-cramfs.conf
 create mode 100755 support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh

Comments

Arnout Vandecappelle Sept. 17, 2022, 8:17 p.m. UTC | #1
On 19/08/2022 19:51, Yann E. MORIN wrote:
> Check that dependencies that are DT_NEEDED by a program are
> automatically copied by dracut. We use cramfs, the package,
> as it is small and just depends on libz.
> 
> Test extra modules, and test more than one dracut config file.
> 
> Reported-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Thierry Bultel <thierry.bultel@linatsea.fr>
> Cc: Adam Duskett <aduskett@gmail.com>

  I've removed the bits related to patch 2/4 and applied to master, thanks.

  Regards,
  Arnout

> ---
>   support/testing/tests/fs/test_cpio.py                 | 11 ++++++++++-
>   support/testing/tests/fs/test_cpio/dracut-cramfs.conf |  7 +++++++
>   .../fs/test_cpio/modules/99cramfs/module-setup.sh     | 11 +++++++++++
>   3 files changed, 28 insertions(+), 1 deletion(-)
>   create mode 100644 support/testing/tests/fs/test_cpio/dracut-cramfs.conf
>   create mode 100755 support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
> 
> diff --git a/support/testing/tests/fs/test_cpio.py b/support/testing/tests/fs/test_cpio.py
> index 9a529f1edd..9c196c1b89 100644
> --- a/support/testing/tests/fs/test_cpio.py
> +++ b/support/testing/tests/fs/test_cpio.py
> @@ -37,11 +37,16 @@ class TestCpioDracutBase(infra.basetest.BRTest):
>           BR2_TOOLCHAIN_EXTERNAL=y
>           BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
>           BR2_INIT_BUSYBOX=y
> +        BR2_PACKAGE_CRAMFS=y
>           BR2_PACKAGE_PV=y
> +        BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES="{}"
>           BR2_TARGET_ROOTFS_CPIO=y
>           BR2_TARGET_ROOTFS_CPIO_DRACUT=y
> +        BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES="{}"
>           # BR2_TARGET_ROOTFS_TAR is not set
> -        """
> +        """.format("support/testing/tests/fs/test_cpio/modules",
> +                   " ".join(["fs/cpio/dracut.conf",
> +                             "support/testing/tests/fs/test_cpio/dracut-cramfs.conf"]))
>   
>       def check_dracut(self):
>           out = subprocess.check_output(["cpio", "--list"],
> @@ -52,6 +57,10 @@ class TestCpioDracutBase(infra.basetest.BRTest):
>                                         universal_newlines=True)
>           # pv should *not* be included in cpio image
>           self.assertEqual(out.find("bin/pv"), -1)
> +        # libz should be, because of cramfs
> +        self.assertNotEqual(out.find("usr/bin/mkcramfs"), -1)
> +        self.assertNotEqual(out.find("usr/bin/cramfsck"), -1)
> +        self.assertNotEqual(out.find("usr/lib/libz.so"), -1)
>   
>           exit_code = boot_img(self.emulator,
>                                self.builddir)
> diff --git a/support/testing/tests/fs/test_cpio/dracut-cramfs.conf b/support/testing/tests/fs/test_cpio/dracut-cramfs.conf
> new file mode 100644
> index 0000000000..69e49239fc
> --- /dev/null
> +++ b/support/testing/tests/fs/test_cpio/dracut-cramfs.conf
> @@ -0,0 +1,7 @@
> +install_items+="
> +/usr/bin/mkcramfs
> +"
> +
> +add_dracutmodules+="
> +cramfs
> +"
> diff --git a/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh b/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
> new file mode 100755
> index 0000000000..60706c8bd9
> --- /dev/null
> +++ b/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
> @@ -0,0 +1,11 @@
> +check() {
> +    return 0
> +}
> +
> +depends() {
> +    return 0
> +}
> +
> +install() {
> +    inst_multiple /usr/bin/cramfsck
> +}
diff mbox series

Patch

diff --git a/support/testing/tests/fs/test_cpio.py b/support/testing/tests/fs/test_cpio.py
index 9a529f1edd..9c196c1b89 100644
--- a/support/testing/tests/fs/test_cpio.py
+++ b/support/testing/tests/fs/test_cpio.py
@@ -37,11 +37,16 @@  class TestCpioDracutBase(infra.basetest.BRTest):
         BR2_TOOLCHAIN_EXTERNAL=y
         BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
         BR2_INIT_BUSYBOX=y
+        BR2_PACKAGE_CRAMFS=y
         BR2_PACKAGE_PV=y
+        BR2_PACKAGE_HOST_DRACUT_EXTRA_MODULES="{}"
         BR2_TARGET_ROOTFS_CPIO=y
         BR2_TARGET_ROOTFS_CPIO_DRACUT=y
+        BR2_TARGET_ROOTFS_CPIO_DRACUT_CONF_FILES="{}"
         # BR2_TARGET_ROOTFS_TAR is not set
-        """
+        """.format("support/testing/tests/fs/test_cpio/modules",
+                   " ".join(["fs/cpio/dracut.conf",
+                             "support/testing/tests/fs/test_cpio/dracut-cramfs.conf"]))
 
     def check_dracut(self):
         out = subprocess.check_output(["cpio", "--list"],
@@ -52,6 +57,10 @@  class TestCpioDracutBase(infra.basetest.BRTest):
                                       universal_newlines=True)
         # pv should *not* be included in cpio image
         self.assertEqual(out.find("bin/pv"), -1)
+        # libz should be, because of cramfs
+        self.assertNotEqual(out.find("usr/bin/mkcramfs"), -1)
+        self.assertNotEqual(out.find("usr/bin/cramfsck"), -1)
+        self.assertNotEqual(out.find("usr/lib/libz.so"), -1)
 
         exit_code = boot_img(self.emulator,
                              self.builddir)
diff --git a/support/testing/tests/fs/test_cpio/dracut-cramfs.conf b/support/testing/tests/fs/test_cpio/dracut-cramfs.conf
new file mode 100644
index 0000000000..69e49239fc
--- /dev/null
+++ b/support/testing/tests/fs/test_cpio/dracut-cramfs.conf
@@ -0,0 +1,7 @@ 
+install_items+="
+/usr/bin/mkcramfs
+"
+
+add_dracutmodules+="
+cramfs
+"
diff --git a/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh b/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
new file mode 100755
index 0000000000..60706c8bd9
--- /dev/null
+++ b/support/testing/tests/fs/test_cpio/modules/99cramfs/module-setup.sh
@@ -0,0 +1,11 @@ 
+check() {
+    return 0
+}
+
+depends() {
+    return 0
+}
+
+install() {
+    inst_multiple /usr/bin/cramfsck
+}