* [Buildroot] [PATCH 1/1] support/testing: new patch runtime test
@ 2024-12-18 23:04 Julien Olivain
2025-02-03 22:07 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 3+ messages in thread
From: Julien Olivain @ 2024-12-18 23:04 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch tested in:
https://gitlab.com/jolivain/buildroot/-/jobs/8681269389
---
DEVELOPERS | 2 +
support/testing/tests/package/test_patch.py | 44 +++++++++++++++++++
.../test_patch/rootfs-overlay/root/file.diff | 8 ++++
.../test_patch/rootfs-overlay/root/file.txt | 3 ++
4 files changed, 57 insertions(+)
create mode 100644 support/testing/tests/package/test_patch.py
create mode 100644 support/testing/tests/package/test_patch/rootfs-overlay/root/file.diff
create mode 100644 support/testing/tests/package/test_patch/rootfs-overlay/root/file.txt
diff --git a/DEVELOPERS b/DEVELOPERS
index 492eb765e0..f409d22353 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1950,6 +1950,8 @@ F: support/testing/tests/package/test_ola.py
F: support/testing/tests/package/test_ola/
F: support/testing/tests/package/test_openblas.py
F: support/testing/tests/package/test_parted.py
+F: support/testing/tests/package/test_patch.py
+F: support/testing/tests/package/test_patch/
F: support/testing/tests/package/test_pciutils.py
F: support/testing/tests/package/test_perftest.py
F: support/testing/tests/package/test_pigz.py
diff --git a/support/testing/tests/package/test_patch.py b/support/testing/tests/package/test_patch.py
new file mode 100644
index 0000000000..67ecb0497a
--- /dev/null
+++ b/support/testing/tests/package/test_patch.py
@@ -0,0 +1,44 @@
+import os
+
+import infra.basetest
+
+
+class TestPatch(infra.basetest.BRTest):
+ rootfs_overlay = \
+ infra.filepath("tests/package/test_patch/rootfs-overlay")
+ config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+ f"""
+ BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y
+ BR2_PACKAGE_PATCH=y
+ BR2_ROOTFS_OVERLAY="{rootfs_overlay}"
+ BR2_TARGET_ROOTFS_CPIO=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ """
+
+ def test_run(self):
+ cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+ self.emulator.boot(arch="armv5",
+ kernel="builtin",
+ options=["-initrd", cpio_file])
+ self.emulator.login()
+
+ # Check the program can execute. This also checks that we are
+ # not using the patch applet from BusyBox (as it does not
+ # recognize the --version option).
+ self.assertRunOk("patch --version")
+
+ # We check the test file contains our expected string before
+ # the patch.
+ sed_cmd = "sed -n '2p' file.txt"
+ out, ret = self.emulator.run(sed_cmd)
+ self.assertEqual(ret, 0)
+ self.assertEqual(out[0], "Hello World!")
+
+ # We apply our test patch...
+ self.assertRunOk("patch -p1 < file.diff")
+
+ # We check the test file contains our expected string after
+ # applying the patch.
+ out, ret = self.emulator.run(sed_cmd)
+ self.assertEqual(ret, 0)
+ self.assertEqual(out[0], "Hello Buildroot!")
diff --git a/support/testing/tests/package/test_patch/rootfs-overlay/root/file.diff b/support/testing/tests/package/test_patch/rootfs-overlay/root/file.diff
new file mode 100644
index 0000000000..d53324d84b
--- /dev/null
+++ b/support/testing/tests/package/test_patch/rootfs-overlay/root/file.diff
@@ -0,0 +1,8 @@
+diff -Naur a/file.txt b/file.txt
+--- a/file.txt 2024-12-18 23:11:50.863359248 +0100
++++ b/file.txt 2024-12-18 23:12:26.464561146 +0100
+@@ -1,3 +1,3 @@
+ This is some context...
+-Hello World!
++Hello Buildroot!
+ ...and this is some more context.
diff --git a/support/testing/tests/package/test_patch/rootfs-overlay/root/file.txt b/support/testing/tests/package/test_patch/rootfs-overlay/root/file.txt
new file mode 100644
index 0000000000..b506c73d9f
--- /dev/null
+++ b/support/testing/tests/package/test_patch/rootfs-overlay/root/file.txt
@@ -0,0 +1,3 @@
+This is some context...
+Hello World!
+...and this is some more context.
--
2.47.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/1] support/testing: new patch runtime test
2024-12-18 23:04 [Buildroot] [PATCH 1/1] support/testing: new patch runtime test Julien Olivain
@ 2025-02-03 22:07 ` Thomas Petazzoni via buildroot
2025-02-04 14:34 ` Peter Korsgaard
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-02-03 22:07 UTC (permalink / raw)
To: Julien Olivain; +Cc: buildroot
On Thu, 19 Dec 2024 00:04:57 +0100
Julien Olivain <ju.o@free.fr> wrote:
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
> Patch tested in:
> https://gitlab.com/jolivain/buildroot/-/jobs/8681269389
> ---
> DEVELOPERS | 2 +
> support/testing/tests/package/test_patch.py | 44 +++++++++++++++++++
> .../test_patch/rootfs-overlay/root/file.diff | 8 ++++
> .../test_patch/rootfs-overlay/root/file.txt | 3 ++
> 4 files changed, 57 insertions(+)
> create mode 100644 support/testing/tests/package/test_patch.py
> create mode 100644 support/testing/tests/package/test_patch/rootfs-overlay/root/file.diff
> create mode 100644 support/testing/tests/package/test_patch/rootfs-overlay/root/file.txt
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Buildroot] [PATCH 1/1] support/testing: new patch runtime test
2025-02-03 22:07 ` Thomas Petazzoni via buildroot
@ 2025-02-04 14:34 ` Peter Korsgaard
0 siblings, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2025-02-04 14:34 UTC (permalink / raw)
To: Thomas Petazzoni via buildroot; +Cc: Julien Olivain, Thomas Petazzoni
>>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:
> On Thu, 19 Dec 2024 00:04:57 +0100
> Julien Olivain <ju.o@free.fr> wrote:
>> Signed-off-by: Julien Olivain <ju.o@free.fr>
>> ---
>> Patch tested in:
>> https://gitlab.com/jolivain/buildroot/-/jobs/8681269389
>> ---
>> DEVELOPERS | 2 +
>> support/testing/tests/package/test_patch.py | 44 +++++++++++++++++++
>> .../test_patch/rootfs-overlay/root/file.diff | 8 ++++
>> .../test_patch/rootfs-overlay/root/file.txt | 3 ++
>> 4 files changed, 57 insertions(+)
>> create mode 100644 support/testing/tests/package/test_patch.py
>> create mode 100644 support/testing/tests/package/test_patch/rootfs-overlay/root/file.diff
>> create mode 100644 support/testing/tests/package/test_patch/rootfs-overlay/root/file.txt
> Applied to master, thanks.
Committed to 2024.02.x and 2024.11.x, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-04 14:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-18 23:04 [Buildroot] [PATCH 1/1] support/testing: new patch runtime test Julien Olivain
2025-02-03 22:07 ` Thomas Petazzoni via buildroot
2025-02-04 14:34 ` Peter Korsgaard
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.