[DTrace-devel] [PATCH] test: Add test for option "quiet" (and -q)
Eugene Loh
eugene.loh at oracle.com
Sat Mar 4 22:35:58 UTC 2023
I guess adding the new tests is okay, but if either -q or "option quiet"
were broken, lots and lots of tests would fail and we would know.
Nevertheless, I have no objection to adding explicit and narrow tests
for this purpose.
What I don't get, though, is why the scripting test is removed. What's
incorrect about it? Okay, so it's named "quite" instead of "quiet".
Sure, the .r results file does not show "quiet" results, but the reason
is important. This (and other scripting tests) is an interpreter file,
with -q on the initial #! line. The problem is that runtest.sh ignores
that. If it sees a .d file, it launches it with "dtrace -s", ignoring
any options specified on the initial #! line.
I propose a different strategy:
*) Fix runtest.sh to support interpreter files.
*) Fix quiet.d to use that support. Fix its .r file. And fix its
broken "quite" name.
I'll post the two patches so you can see what I mean. If they look
good, I can post a bunch of other patches I have lying around dealing
with other cases where tests were supposed to be launched as interpreter
files but weren't.
On 3/2/23 23:45, Kris Van Hees via DTrace-devel wrote:
> Also remove (incorrect) tst.quite.d test.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
> test/unittest/options/tst.q.d | 19 +++++++++++++++++++
> test/unittest/options/tst.q.r | 1 +
> test/unittest/options/tst.quiet.d | 20 ++++++++++++++++++++
> test/unittest/options/tst.quiet.r | 1 +
> test/unittest/scripting/tst.quite.d | 21 ---------------------
> test/unittest/scripting/tst.quite.r | 5 -----
> 6 files changed, 41 insertions(+), 26 deletions(-)
> create mode 100644 test/unittest/options/tst.q.d
> create mode 100644 test/unittest/options/tst.q.r
> create mode 100644 test/unittest/options/tst.quiet.d
> create mode 100644 test/unittest/options/tst.quiet.r
> delete mode 100644 test/unittest/scripting/tst.quite.d
> delete mode 100644 test/unittest/scripting/tst.quite.r
>
> diff --git a/test/unittest/options/tst.q.d b/test/unittest/options/tst.q.d
> new file mode 100644
> index 00000000..34e21e93
> --- /dev/null
> +++ b/test/unittest/options/tst.q.d
> @@ -0,0 +1,19 @@
> +/*
> + * Oracle Linux DTrace.
> + * Copyright (c) 2023, 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.
> + */
> +
> +/*
> + * ASSERTION: The -q option can be used to output only explicitly traced data.
> + *
> + * SECTION: Options and Tunables/Consumer Options
> + */
> +
> +/* @@runtest-opts: -q */
> +
> +BEGIN
> +{
> + exit(0);
> +}
> diff --git a/test/unittest/options/tst.q.r b/test/unittest/options/tst.q.r
> new file mode 100644
> index 00000000..8b137891
> --- /dev/null
> +++ b/test/unittest/options/tst.q.r
> @@ -0,0 +1 @@
> +
> diff --git a/test/unittest/options/tst.quiet.d b/test/unittest/options/tst.quiet.d
> new file mode 100644
> index 00000000..2aed2597
> --- /dev/null
> +++ b/test/unittest/options/tst.quiet.d
> @@ -0,0 +1,20 @@
> +/*
> + * Oracle Linux DTrace.
> + * Copyright (c) 2023, 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.
> + */
> +
> +/*
> + * ASSERTION: The -xquiet option can be used to output only explicitly traced
> + * data.
> + *
> + * SECTION: Options and Tunables/Consumer Options
> + */
> +
> +/* @@runtest-opts: -xquiet */
> +
> +BEGIN
> +{
> + exit(0);
> +}
> diff --git a/test/unittest/options/tst.quiet.r b/test/unittest/options/tst.quiet.r
> new file mode 100644
> index 00000000..8b137891
> --- /dev/null
> +++ b/test/unittest/options/tst.quiet.r
> @@ -0,0 +1 @@
> +
> diff --git a/test/unittest/scripting/tst.quite.d b/test/unittest/scripting/tst.quite.d
> deleted file mode 100644
> index 46402cbd..00000000
> --- a/test/unittest/scripting/tst.quite.d
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -#!/usr/sbin/dtrace -qs
> -
> -/*
> - * Oracle Linux DTrace.
> - * Copyright (c) 2006, 2020, 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.
> - */
> -
> -/*
> - * ASSERTION:
> - * Script which uses -qs in scripting line
> - *
> - * SECTION: Scripting
> - *
> - */
> -
> -BEGIN
> -{
> - exit(0);
> -}
> diff --git a/test/unittest/scripting/tst.quite.r b/test/unittest/scripting/tst.quite.r
> deleted file mode 100644
> index b7bc367e..00000000
> --- a/test/unittest/scripting/tst.quite.r
> +++ /dev/null
> @@ -1,5 +0,0 @@
> - FUNCTION:NAME
> - :BEGIN
> -
> --- @@stderr --
> -dtrace: script 'test/unittest/scripting/tst.quite.d' matched 1 probe
More information about the DTrace-devel
mailing list