[PATCH 1/5] test: fbt return0: work on quiet systems
Nick Alcock <[email protected]>
| Newsgroups | dev.linux.lists.dtrace |
|---|---|
| Message-ID | <[email protected]> |
These two tests probe on sys_poll and just hope something calls it. On sufficiently quiet systems, nothing does. Define a trivial trigger to do so. Signed-off-by: Nick Alcock <[email protected]> --- test/triggers/Build | 2 +- test/triggers/fbt-tst-poll.c | 23 ++++++++++++++++++++ test/unittest/fbtprovider/tst.return0.d | 6 ++++- test/unittest/providers/rawfbt/tst.return0.d | 6 ++++- 4 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 test/triggers/fbt-tst-poll.c diff --git a/test/triggers/Build b/test/triggers/Build index 4ff5002a853ed..bd6b0510ba003 100644 --- a/test/triggers/Build +++ b/test/triggers/Build @@ -4,7 +4,7 @@ # http://oss.oracle.com/licenses/upl. EXTERNAL_64BIT_TRIGGERS = testprobe readwholedir mmap bogus-ioctl open delaydie futex \ - periodic_output \ + periodic_output fbt-tst-poll \ pid-tst-args1 pid-tst-float pid-tst-fork pid-tst-gcc \ pid-tst-ret1 pid-tst-ret2 pid-tst-vfork pid-tst-weak1 pid-tst-weak2 \ proc-tst-sigwait proc-tst-omp proc-tst-pthread-exec profile-tst-ufuncsort \ diff --git a/test/triggers/fbt-tst-poll.c b/test/triggers/fbt-tst-poll.c new file mode 100644 index 0000000000000..8b1e72eddd258 --- /dev/null +++ b/test/triggers/fbt-tst-poll.c @@ -0,0 +1,23 @@ +/* + * Oracle Linux DTrace. + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Licensed under the Universal Permissive License v 1.0 as shown at + * http://oss.oracle.com/licenses/upl. + */ + +/* + * Simply loop, polling stdin for something that cannot happen until killed. + */ + +#include <poll.h> + +int +main(int argc, char **argv) +{ + struct pollfd fd = {0}; + + fd.fd = 0; + fd.events = POLLPRI; + for (;;) + poll(&fd, 1, 100); +} diff --git a/test/unittest/fbtprovider/tst.return0.d b/test/unittest/fbtprovider/tst.return0.d index 0b7091b320904..78a82ffde7473 100644 --- a/test/unittest/fbtprovider/tst.return0.d +++ b/test/unittest/fbtprovider/tst.return0.d @@ -11,11 +11,15 @@ * SECTION: FBT Provider/Probe arguments */ +/* @@trigger: fbt-tst-poll */ +/* @@trigger-timing: before */ +/* @@runtest-opts: $_pid */ + #pragma D option quiet #pragma D option statusrate=10ms fbt::do_sys_poll:return -/arg1 == 0/ +/pid == $1 && arg1 == 0/ { printf("%s %x returned 0", probefunc, arg0); exit(0); diff --git a/test/unittest/providers/rawfbt/tst.return0.d b/test/unittest/providers/rawfbt/tst.return0.d index 0146d684f1033..915830c800b70 100644 --- a/test/unittest/providers/rawfbt/tst.return0.d +++ b/test/unittest/providers/rawfbt/tst.return0.d @@ -9,11 +9,15 @@ * ASSERTION: simple rawfbt provider arg0 and probefunc print test. */ +/* @@trigger: fbt-tst-poll */ +/* @@trigger-timing: before */ +/* @@runtest-opts: $_pid */ + #pragma D option quiet #pragma D option statusrate=10ms rawfbt::do_sys_poll:return -/arg1 == 0/ +/pid == $1 && arg1 == 0/ { printf("%s %x returned 0", probefunc, arg0); exit(0); base-commit: 877fcdeb25b370be182d51f27fb4bd8e4f739fb1 -- 2.51.0.284.g117bcb8de7