[DTrace-devel] [PATCH 1/3] test: Fix trace((char)-1) in agg test
Kris Van Hees
kris.van.hees at oracle.com
Thu Sep 1 18:11:47 UTC 2022
On Thu, Sep 01, 2022 at 01:32:34PM -0400, eugene.loh--- via DTrace-devel wrote:
> From: Eugene Loh <eugene.loh at oracle.com>
>
> Legacy DTrace idiosyncratically printed (char)-1 and (short)-1 as
> unsigned. In the BPF port, the old .r file made the test fail.
>
> Fix the .r results file to show negative values.
>
> While it is assumed that char is signed, strictly speaking char's
> signedness is platform-dependent. So make (char) explicitly signed.
>
> Rewrite the comment block.
>
> Signed-off-by: Eugene Loh <eugene.loh at oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees at oracle.com>
... queued for dev
> ---
> test/unittest/aggs/tst.signedkeys.d | 21 +++++++++------------
> test/unittest/aggs/tst.signedkeys.r | 8 ++++----
> 2 files changed, 13 insertions(+), 16 deletions(-)
>
> diff --git a/test/unittest/aggs/tst.signedkeys.d b/test/unittest/aggs/tst.signedkeys.d
> index 1b720893..be2a55dd 100644
> --- a/test/unittest/aggs/tst.signedkeys.d
> +++ b/test/unittest/aggs/tst.signedkeys.d
> @@ -1,10 +1,9 @@
> /*
> * Oracle Linux DTrace.
> - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved.
> + * Copyright (c) 2006, 2022, 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.
> */
> -/* @@xfail: dtv2 */
>
> /*
> * ASSERTION:
> @@ -12,11 +11,9 @@
> *
> * SECTION: Aggregations, Printing Aggregations
> *
> - * NOTES: DTrace sorts integer keys as unsigned values, yet prints 32-
> - * and 64-bit integers as signed values. Since the Java DTrace API is
> - * expected to emulate this behavior, this test was added to ensure that
> - * the behavior is preserved. Consistency with trace() output is also
> - * tested.
> + * NOTES: DTrace sorts integer keys as unsigned values. Since the Java DTrace
> + * API is expected to emulate this behavior, this test was added to ensure that
> + * the behavior is preserved. Historically, trace() output is also tested.
> */
>
> #pragma D option quiet
> @@ -24,15 +21,15 @@
>
> BEGIN
> {
> - trace((char)-2);
> + trace((signed char)-2);
> trace("\n");
> - trace((char)-1);
> + trace((signed char)-1);
> trace("\n");
> - trace((char)0);
> + trace((signed char)0);
> trace("\n");
> - trace((char)1);
> + trace((signed char)1);
> trace("\n");
> - trace((char)2);
> + trace((signed char)2);
> trace("\n");
> trace("\n");
>
> diff --git a/test/unittest/aggs/tst.signedkeys.r b/test/unittest/aggs/tst.signedkeys.r
> index 42e619e0..39b93c72 100644
> --- a/test/unittest/aggs/tst.signedkeys.r
> +++ b/test/unittest/aggs/tst.signedkeys.r
> @@ -1,11 +1,11 @@
> -254
> -255
> +-2
> +-1
> 0
> 1
> 2
>
> -65534
> -65535
> +-2
> +-1
> 0
> 1
> 2
> --
> 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