* [Buildroot] [PATCH 1/1] support/testing: add libcurl runtime test
@ 2024-12-15 21:21 Julien Olivain
2025-02-03 22:04 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 3+ messages in thread
From: Julien Olivain @ 2024-12-15 21:21 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/8648396262
---
DEVELOPERS | 1 +
support/testing/tests/package/test_libcurl.py | 55 +++++++++++++++++++
2 files changed, 56 insertions(+)
create mode 100644 support/testing/tests/package/test_libcurl.py
diff --git a/DEVELOPERS b/DEVELOPERS
index 047dc4a88f..ad84a6e21b 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1913,6 +1913,7 @@ F: support/testing/tests/package/test_lame.py
F: support/testing/tests/package/test_less.py
F: support/testing/tests/package/test_libcamera.py
F: support/testing/tests/package/test_libcamera/
+F: support/testing/tests/package/test_libcurl.py
F: support/testing/tests/package/test_libgpgme.py
F: support/testing/tests/package/test_libjxl.py
F: support/testing/tests/package/test_links.py
diff --git a/support/testing/tests/package/test_libcurl.py b/support/testing/tests/package/test_libcurl.py
new file mode 100644
index 0000000000..b326f9308f
--- /dev/null
+++ b/support/testing/tests/package/test_libcurl.py
@@ -0,0 +1,55 @@
+import os
+
+import infra.basetest
+
+
+class TestLibCurl(infra.basetest.BRTest):
+ config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+ """
+ BR2_PACKAGE_LIBCURL=y
+ BR2_PACKAGE_LIBCURL_CURL=y
+ BR2_PACKAGE_THTTPD=y
+ 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()
+
+ msg = "Hello Buildroot!"
+ fname = "file.txt"
+ url = f"http://localhost/{fname}"
+
+ # We check the program can execute.
+ self.assertRunOk("curl --version")
+
+ # We create a simple file to serve.
+ self.assertRunOk(f"echo '{msg}' > /var/www/data/{fname}")
+
+ # We try to download that file, using our local httpd server.
+ self.assertRunOk(f"curl -o {fname} {url}")
+
+ # We check the downloaded file contains our initial message.
+ out, ret = self.emulator.run(f"cat {fname}")
+ self.assertEqual(ret, 0)
+ self.assertEqual(out[0], msg)
+
+ # We download again the file without saving it, but printing
+ # it on stdout this time.
+ out, ret = self.emulator.run(f"curl -q {url}")
+ self.assertEqual(ret, 0)
+ self.assertEqual(out[0], msg)
+
+ # We download one last time, showing the server response. We
+ # check we can see the OK status and our thttpd server
+ # identification.
+ cmd = f"curl --no-progress-meter --dump-header - -o /dev/null {url}"
+ out, ret = self.emulator.run(cmd)
+ self.assertEqual(ret, 0)
+ out_str = "\n".join(out)
+ self.assertIn("HTTP/1.1 200 OK", out_str)
+ self.assertIn("Server: thttpd/", out_str)
--
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: add libcurl runtime test
2024-12-15 21:21 [Buildroot] [PATCH 1/1] support/testing: add libcurl runtime test Julien Olivain
@ 2025-02-03 22:04 ` Thomas Petazzoni via buildroot
2025-02-04 14:25 ` Peter Korsgaard
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-02-03 22:04 UTC (permalink / raw)
To: Julien Olivain; +Cc: buildroot
On Sun, 15 Dec 2024 22:21:53 +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/8648396262
> ---
> DEVELOPERS | 1 +
> support/testing/tests/package/test_libcurl.py | 55 +++++++++++++++++++
> 2 files changed, 56 insertions(+)
> create mode 100644 support/testing/tests/package/test_libcurl.py
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: add libcurl runtime test
2025-02-03 22:04 ` Thomas Petazzoni via buildroot
@ 2025-02-04 14:25 ` Peter Korsgaard
0 siblings, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2025-02-04 14:25 UTC (permalink / raw)
To: Thomas Petazzoni via buildroot; +Cc: Julien Olivain, Thomas Petazzoni
>>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:
> On Sun, 15 Dec 2024 22:21:53 +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/8648396262
>> ---
>> DEVELOPERS | 1 +
>> support/testing/tests/package/test_libcurl.py | 55 +++++++++++++++++++
>> 2 files changed, 56 insertions(+)
>> create mode 100644 support/testing/tests/package/test_libcurl.py
> 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:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-15 21:21 [Buildroot] [PATCH 1/1] support/testing: add libcurl runtime test Julien Olivain
2025-02-03 22:04 ` Thomas Petazzoni via buildroot
2025-02-04 14:25 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox