* [Buildroot] [PATCH 1/1] support/testing: add trace-cmd runtime test
@ 2024-01-24 22:24 Julien Olivain
2024-02-05 22:04 ` Peter Korsgaard
0 siblings, 1 reply; 2+ messages in thread
From: Julien Olivain @ 2024-01-24 22:24 UTC (permalink / raw)
To: buildroot; +Cc: Julien Olivain
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch tested on branch master at commit bc680b5 with commands:
make check-package
...
0 warnings generated
support/testing/run-tests \
-d dl -o output_folder \
tests.package.test_trace_cmd
...
OK
---
DEVELOPERS | 2 +
.../testing/tests/package/test_trace_cmd.py | 54 +++++++++++++++++++
.../test_trace_cmd/linux-ftrace.fragment | 1 +
3 files changed, 57 insertions(+)
create mode 100644 support/testing/tests/package/test_trace_cmd.py
create mode 100644 support/testing/tests/package/test_trace_cmd/linux-ftrace.fragment
diff --git a/DEVELOPERS b/DEVELOPERS
index 9528837dd0..94febf5a75 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1822,6 +1822,8 @@ F: support/testing/tests/package/test_sed.py
F: support/testing/tests/package/test_stress_ng.py
F: support/testing/tests/package/test_tcl.py
F: support/testing/tests/package/test_tcl/
+F: support/testing/tests/package/test_trace_cmd.py
+F: support/testing/tests/package/test_trace_cmd/
F: support/testing/tests/package/test_weston.py
F: support/testing/tests/package/test_weston/
F: support/testing/tests/package/test_xz.py
diff --git a/support/testing/tests/package/test_trace_cmd.py b/support/testing/tests/package/test_trace_cmd.py
new file mode 100644
index 0000000000..e7d5e13bce
--- /dev/null
+++ b/support/testing/tests/package/test_trace_cmd.py
@@ -0,0 +1,54 @@
+import os
+
+import infra.basetest
+
+
+class TestTraceCmd(infra.basetest.BRTest):
+ # A specific configuration is needed for testing trace-cmd.
+ # The function tracer need to be enabled in the Kernel.
+ kern_fragment = \
+ infra.filepath("tests/package/test_trace_cmd/linux-ftrace.fragment")
+ config = \
+ f"""
+ BR2_aarch64=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.1.74"
+ BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y
+ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="board/qemu/aarch64-virt/linux.config"
+ BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="{kern_fragment}"
+ BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+ BR2_PACKAGE_TRACE_CMD=y
+ BR2_TARGET_ROOTFS_CPIO=y
+ BR2_TARGET_ROOTFS_CPIO_GZIP=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ """
+
+ def test_run(self):
+ img = os.path.join(self.builddir, "images", "rootfs.cpio.gz")
+ kern = os.path.join(self.builddir, "images", "Image")
+ self.emulator.boot(arch="aarch64",
+ kernel=kern,
+ kernel_cmdline=["console=ttyAMA0"],
+ options=["-M", "virt",
+ "-cpu", "cortex-a57",
+ "-m", "256M",
+ "-initrd", img])
+ self.emulator.login()
+
+ # Record calls to kmalloc() from a simple command.
+ self.assertRunOk("trace-cmd record -e kmalloc ls -l /")
+
+ # Show information about the trace.dat file.
+ self.assertRunOk("trace-cmd dump")
+
+ # Generate a text report of the trace.
+ self.assertRunOk("trace-cmd report > trace.txt")
+
+ # Check we have occurrences of "kmalloc:" in the trace report.
+ cmd = "grep -Fc kmalloc: trace.txt"
+ output, exit_code = self.emulator.run(cmd)
+ self.assertEquals(exit_code, 0)
+ self.assertTrue(int(output[0]) > 0)
diff --git a/support/testing/tests/package/test_trace_cmd/linux-ftrace.fragment b/support/testing/tests/package/test_trace_cmd/linux-ftrace.fragment
new file mode 100644
index 0000000000..ef82146616
--- /dev/null
+++ b/support/testing/tests/package/test_trace_cmd/linux-ftrace.fragment
@@ -0,0 +1 @@
+CONFIG_FTRACE=y
--
2.43.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 trace-cmd runtime test
2024-01-24 22:24 [Buildroot] [PATCH 1/1] support/testing: add trace-cmd runtime test Julien Olivain
@ 2024-02-05 22:04 ` Peter Korsgaard
0 siblings, 0 replies; 2+ messages in thread
From: Peter Korsgaard @ 2024-02-05 22:04 UTC (permalink / raw)
To: Julien Olivain; +Cc: buildroot
>>>>> "Julien" == Julien Olivain <ju.o@free.fr> writes:
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
> Patch tested on branch master at commit bc680b5 with commands:
> make check-package
> ...
> 0 warnings generated
> support/testing/run-tests \
> -d dl -o output_folder \
> tests.package.test_trace_cmd
> ...
> OK
Committed, thanks.
--
Bye, Peter Korsgaard
_______________________________________________
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-02-05 22:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-24 22:24 [Buildroot] [PATCH 1/1] support/testing: add trace-cmd runtime test Julien Olivain
2024-02-05 22:04 ` Peter Korsgaard
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox