mirror of
https://git.busybox.net/buildroot.git
synced 2024-11-23 05:23:39 +08:00
support/testing: add strace runtime test
Signed-off-by: Julien Olivain <ju.o@free.fr> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
parent
0149b50166
commit
988a2115c2
@ -1818,6 +1818,7 @@ 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_sed.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/
|
||||
|
37
support/testing/tests/package/test_strace.py
Normal file
37
support/testing/tests/package/test_strace.py
Normal file
@ -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}")
|
Loading…
Reference in New Issue
Block a user