@@ -1811,6 +1811,7 @@ F: support/testing/tests/package/test_python_spake2.py
F: support/testing/tests/package/test_rdma_core.py
F: support/testing/tests/package/test_rdma_core/
F: support/testing/tests/package/test_screen.py
+F: support/testing/tests/package/test_strace.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/
new file mode 100644
@@ -0,0 +1,37 @@
+import os
+
+import infra.basetest
+
+
+class TestStrace(infra.basetest.BRTest):
+ config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+ """
+ BR2_PACKAGE_STRACE=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()
+
+ # Check the program can execute.
+ self.assertRunOk("strace --version")
+
+ test_file = "buildroot-strace-test.txt"
+ test_file_mode = "0600"
+ strace_log = "strace.log"
+
+ # Create a test file.
+ self.assertRunOk(f"touch {test_file}")
+
+ # Run strace on a chmod
+ cmd = f"strace -o {strace_log} chmod {test_file_mode} {test_file}"
+ self.assertRunOk(cmd)
+
+ # Check the strace log contain a call to chmod()
+ expected_str = f"chmod(\"{test_file}\", {test_file_mode}) = 0"
+ self.assertRunOk(f"grep -F '{expected_str}' {strace_log}")
Signed-off-by: Julien Olivain <ju.o@free.fr> --- Patch tested on branch master at commit b200632 with commands: make check-package ... 0 warnings generated support/testing/run-tests \ -d dl -o output_folder \ tests.package.test_strace ... OK --- DEVELOPERS | 1 + support/testing/tests/package/test_strace.py | 37 ++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 support/testing/tests/package/test_strace.py