All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] support/testing: add wine runtime test
@ 2024-04-14 21:42 Julien Olivain
  2024-04-28 18:26 ` Arnout Vandecappelle via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Olivain @ 2024-04-14 21:42 UTC (permalink / raw)
  To: buildroot; +Cc: Julien Olivain

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 DEVELOPERS                                 |  1 +
 support/testing/tests/package/test_wine.py | 88 ++++++++++++++++++++++
 2 files changed, 89 insertions(+)
 create mode 100644 support/testing/tests/package/test_wine.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 399b2931ff3..b8beb1bd565 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1872,6 +1872,7 @@ F:	support/testing/tests/package/test_usbutils.py
 F:	support/testing/tests/package/test_usbutils/
 F:	support/testing/tests/package/test_weston.py
 F:	support/testing/tests/package/test_weston/
+F:	support/testing/tests/package/test_wine.py
 F:	support/testing/tests/package/test_xz.py
 F:	support/testing/tests/package/test_z3.py
 F:	support/testing/tests/package/test_z3/
diff --git a/support/testing/tests/package/test_wine.py b/support/testing/tests/package/test_wine.py
new file mode 100644
index 00000000000..4e5b4a8b111
--- /dev/null
+++ b/support/testing/tests/package/test_wine.py
@@ -0,0 +1,88 @@
+import os
+
+import infra.basetest
+
+
+class TestWine(infra.basetest.BRTest):
+    # Wine depends on i386 architecture. The pre-build runtime test
+    # Kernel (for armv5) cannot be used. The config also uses a ext4
+    # rootfs due to the larger Wine footprint. We also enable NLS,
+    # which is required for cmd.exe shell to work.
+    config = \
+        """
+        BR2_i386=y
+        BR2_x86_pentium4=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_LINUX_KERNEL=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.27"
+        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86/linux.config"
+        BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+        BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
+        BR2_PACKAGE_WINE=y
+        BR2_SYSTEM_ENABLE_NLS=y
+        BR2_TARGET_ROOTFS_EXT2=y
+        BR2_TARGET_ROOTFS_EXT2_4=y
+        BR2_TARGET_ROOTFS_EXT2_SIZE="256M"
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        drive = os.path.join(self.builddir, "images", "rootfs.ext4")
+        kern = os.path.join(self.builddir, "images", "bzImage")
+        self.emulator.boot(arch="i386",
+                           kernel=kern,
+                           kernel_cmdline=["root=/dev/vda console=ttyS0"],
+                           options=["-M", "pc", "-m", "256M",
+                                    "-drive", f"file={drive},if=virtio,format=raw"])
+        self.emulator.login()
+
+        # Check the program can run.
+        self.assertRunOk("wine --version")
+
+        # Remove the Wine directory to make this test idempotent. This
+        # is because we use a persistent storage. This is useful only
+        # when the run-tests script is used with the "-k" option.
+        self.assertRunOk("rm -rf ~/.wine")
+
+        # Wine usually prints lots of debug messages. We disable all
+        # logs for this test. For debugging, this line can be
+        # commented, or extra log can also be added. "WINEDEBUG=+all"
+        # enable all logs and generates a lot of messages.
+        # See: https://wiki.winehq.org/Debug_Channels
+        self.assertRunOk("export WINEDEBUG=-all")
+
+        # We force the initialization of the WINEPREFIX
+        # directory. This operation can take some time. This will make
+        # subsequent wine invocation execution time more stable.
+        self.assertRunOk("wineboot --init", timeout=45)
+
+        # We check we can list files in the Windows OS directory.
+        cmd = "wine cmd.exe /C 'DIR C:\\WINDOWS\\'"
+        self.assertRunOk(cmd, timeout=10)
+
+        # We check we can read a Windows OS specific environment
+        # variable. We use "assertIn" rather than "assertEqual"
+        # because the cmd.exe shell write extra control characters.
+        cmd = "wine cmd.exe /C 'ECHO %OS%'"
+        out, ret = self.emulator.run(cmd, timeout=10)
+        self.assertEqual(ret, 0)
+        self.assertIn("Windows_NT", out[0])
+
+        # We check we can print an arbitrary string with the
+        # cmd.exe shell.
+        string = "Hello Buildroot !"
+        cmd = f"wine cmd.exe /C 'ECHO {string}'"
+        out, ret = self.emulator.run(cmd, timeout=10)
+        self.assertEqual(ret, 0)
+        self.assertIn(string, out[0])
+
+        # We check the VER command reports a Windows OS version.
+        cmd = "wine cmd.exe /C 'VER'"
+        out, ret = self.emulator.run(cmd, timeout=10)
+        self.assertEqual(ret, 0)
+        self.assertIn("Microsoft Windows", "\n".join(out))
+
+        # We run the ping.exe command.
+        self.assertRunOk("wine ping.exe 127.0.0.1", timeout=10)
-- 
2.44.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] support/testing: add wine runtime test
  2024-04-14 21:42 [Buildroot] [PATCH 1/1] support/testing: add wine runtime test Julien Olivain
@ 2024-04-28 18:26 ` Arnout Vandecappelle via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Arnout Vandecappelle via buildroot @ 2024-04-28 18:26 UTC (permalink / raw)
  To: Julien Olivain, buildroot



On 14/04/2024 23:42, Julien Olivain wrote:
> Signed-off-by: Julien Olivain <ju.o@free.fr>

  Applied to master, thanks.

  Regards,
  Arnout

> ---
>   DEVELOPERS                                 |  1 +
>   support/testing/tests/package/test_wine.py | 88 ++++++++++++++++++++++
>   2 files changed, 89 insertions(+)
>   create mode 100644 support/testing/tests/package/test_wine.py
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index 399b2931ff3..b8beb1bd565 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1872,6 +1872,7 @@ F:	support/testing/tests/package/test_usbutils.py
>   F:	support/testing/tests/package/test_usbutils/
>   F:	support/testing/tests/package/test_weston.py
>   F:	support/testing/tests/package/test_weston/
> +F:	support/testing/tests/package/test_wine.py
>   F:	support/testing/tests/package/test_xz.py
>   F:	support/testing/tests/package/test_z3.py
>   F:	support/testing/tests/package/test_z3/
> diff --git a/support/testing/tests/package/test_wine.py b/support/testing/tests/package/test_wine.py
> new file mode 100644
> index 00000000000..4e5b4a8b111
> --- /dev/null
> +++ b/support/testing/tests/package/test_wine.py
> @@ -0,0 +1,88 @@
> +import os
> +
> +import infra.basetest
> +
> +
> +class TestWine(infra.basetest.BRTest):
> +    # Wine depends on i386 architecture. The pre-build runtime test
> +    # Kernel (for armv5) cannot be used. The config also uses a ext4
> +    # rootfs due to the larger Wine footprint. We also enable NLS,
> +    # which is required for cmd.exe shell to work.
> +    config = \
> +        """
> +        BR2_i386=y
> +        BR2_x86_pentium4=y
> +        BR2_TOOLCHAIN_EXTERNAL=y
> +        BR2_LINUX_KERNEL=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION=y
> +        BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.27"
> +        BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
> +        BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/x86/linux.config"
> +        BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +        BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
> +        BR2_PACKAGE_WINE=y
> +        BR2_SYSTEM_ENABLE_NLS=y
> +        BR2_TARGET_ROOTFS_EXT2=y
> +        BR2_TARGET_ROOTFS_EXT2_4=y
> +        BR2_TARGET_ROOTFS_EXT2_SIZE="256M"
> +        # BR2_TARGET_ROOTFS_TAR is not set
> +        """
> +
> +    def test_run(self):
> +        drive = os.path.join(self.builddir, "images", "rootfs.ext4")
> +        kern = os.path.join(self.builddir, "images", "bzImage")
> +        self.emulator.boot(arch="i386",
> +                           kernel=kern,
> +                           kernel_cmdline=["root=/dev/vda console=ttyS0"],
> +                           options=["-M", "pc", "-m", "256M",
> +                                    "-drive", f"file={drive},if=virtio,format=raw"])
> +        self.emulator.login()
> +
> +        # Check the program can run.
> +        self.assertRunOk("wine --version")
> +
> +        # Remove the Wine directory to make this test idempotent. This
> +        # is because we use a persistent storage. This is useful only
> +        # when the run-tests script is used with the "-k" option.
> +        self.assertRunOk("rm -rf ~/.wine")
> +
> +        # Wine usually prints lots of debug messages. We disable all
> +        # logs for this test. For debugging, this line can be
> +        # commented, or extra log can also be added. "WINEDEBUG=+all"
> +        # enable all logs and generates a lot of messages.
> +        # See: https://wiki.winehq.org/Debug_Channels
> +        self.assertRunOk("export WINEDEBUG=-all")
> +
> +        # We force the initialization of the WINEPREFIX
> +        # directory. This operation can take some time. This will make
> +        # subsequent wine invocation execution time more stable.
> +        self.assertRunOk("wineboot --init", timeout=45)
> +
> +        # We check we can list files in the Windows OS directory.
> +        cmd = "wine cmd.exe /C 'DIR C:\\WINDOWS\\'"
> +        self.assertRunOk(cmd, timeout=10)
> +
> +        # We check we can read a Windows OS specific environment
> +        # variable. We use "assertIn" rather than "assertEqual"
> +        # because the cmd.exe shell write extra control characters.
> +        cmd = "wine cmd.exe /C 'ECHO %OS%'"
> +        out, ret = self.emulator.run(cmd, timeout=10)
> +        self.assertEqual(ret, 0)
> +        self.assertIn("Windows_NT", out[0])
> +
> +        # We check we can print an arbitrary string with the
> +        # cmd.exe shell.
> +        string = "Hello Buildroot !"
> +        cmd = f"wine cmd.exe /C 'ECHO {string}'"
> +        out, ret = self.emulator.run(cmd, timeout=10)
> +        self.assertEqual(ret, 0)
> +        self.assertIn(string, out[0])
> +
> +        # We check the VER command reports a Windows OS version.
> +        cmd = "wine cmd.exe /C 'VER'"
> +        out, ret = self.emulator.run(cmd, timeout=10)
> +        self.assertEqual(ret, 0)
> +        self.assertIn("Microsoft Windows", "\n".join(out))
> +
> +        # We run the ping.exe command.
> +        self.assertRunOk("wine ping.exe 127.0.0.1", timeout=10)
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-28 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-14 21:42 [Buildroot] [PATCH 1/1] support/testing: add wine runtime test Julien Olivain
2024-04-28 18:26 ` Arnout Vandecappelle via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.