[DTrace-devel] [PATCH 2/3] test: Add support for a @@nosort tag
Kris Van Hees
kris.van.hees at oracle.com
Thu Sep 1 19:06:00 UTC 2022
On Thu, Sep 01, 2022 at 01:32:35PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> By default, we sort test results before comparing with a .r results
> file, since test results often do not have a well-defined order.
> For example, probes firing on different CPUs emit output in varying
> order.
>
> Some tests, however, check for particular ordering.
>
> Add a tag to suppress the default sort behavior.
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
... queued for dev
> ---
> runtest.sh | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
> diff --git a/runtest.sh b/runtest.sh
> index 0fe1cdb0..6996087f 100755
> --- a/runtest.sh
> +++ b/runtest.sh
> @@ -837,6 +837,12 @@ for dt in $dtrace; do
> # @@link: A library to link .c programs against (see below). -ldtrace
> # by default.
> #
> + # @@nosort: If present, this means do not sort before comparing results
> + # with a .r file. Results are sorted by default, since many
> + # test results do not have a well-defined order -- notably,
> + # when generated on different CPUs. Some tests, however,
> + # care about strict ordering.
> + #
> # Certain filenames of test .d script are treated specially:
> #
> # tst.*.d: These are assumed to have /* @@trigger: none */ by default.
> @@ -1310,12 +1316,20 @@ for dt in $dtrace; do
> want_all_output=
> failmsg=
>
> + # By default, sort before comparing since test results often
> + # have indeterminate order (generated on different CPUs, etc.).
> + if exist_options nosort $_test; then
> + sortcmd=cat
> + else
> + sortcmd=sort
> + fi
> +
> # Compare results, if available, and log the diff.
> rfile=$base.$arch.r
> [[ -e $rfile ]] || rfile=$base.r
>
> if [[ -e $rfile ]] && [[ -n $COMPARISON ]] &&
> - ! diff -u <(sort $rfile) <(sort $tmpdir/test.out) >/dev/null; then
> + ! diff -u <($sortcmd $rfile) <($sortcmd $tmpdir/test.out) >/dev/null; then
>
> fail=t
> failmsg="expected results differ"
> --
> 2.18.4
>
>
> _______________________________________________
> DTrace-devel mailing list
> DTrace-devel at oss.oracle.com
> https://oss.oracle.com/mailman/listinfo/dtrace-devel
More information about the DTrace-devel
mailing list