[DTrace-devel] [PATCH] Add test for default value of string type TLS variables
Kris Van Hees
kris.van.hees at oracle.com
Fri Mar 4 21:18:54 UTC 2022
On Fri, Mar 04, 2022 at 04:15:33PM -0500, Eugene Loh via DTrace-devel wrote:
> Reviewed-by: Eugene Loh <eugene.loh at oracle.com>
> s/unknosn/unknown/
> s/THis/This/
Thanks.
> Prepend "test:" to the subject line???
Some people do ,some people do not. I do not think that DTrace is big enough
of a project to really warrant it. But I do not oppose it - I just don't do it
myself.
> On 3/4/22 4:00 PM, Kris Van Hees via DTrace-devel wrote:
> > The default value of any unknosn TLS variable is 0. This means that
> > a TLS variable of type string will contain NULL. THis test verifies
> > that by detecting the invalid address fault on address 0x0.
> >
> > Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> > ---
> > test/unittest/variables/tvar/tst.init-str.d | 28 +++++++++++++++++++++
> > 1 file changed, 28 insertions(+)
> > create mode 100644 test/unittest/variables/tvar/tst.init-str.d
> >
> > diff --git a/test/unittest/variables/tvar/tst.init-str.d b/test/unittest/variables/tvar/tst.init-str.d
> > new file mode 100644
> > index 00000000..47d3eab6
> > --- /dev/null
> > +++ b/test/unittest/variables/tvar/tst.init-str.d
> > @@ -0,0 +1,28 @@
> > +/*
> > + * Oracle Linux DTrace.
> > + * Copyright (c) 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.
> > + */
> > +
> > +/*
> > + * ASSERTION: Thread-local string variables are initialized to 0. Trying to
> > + * trace() it will result in a 'invalid address 0x0' fault.
> > + *
> > + * SECTION: Variables/Thread-Local Variables
> > + */
> > +
> > +#pragma D option quiet
> > +
> > +self string x;
> > +
> > +BEGIN
> > +{
> > + trace(self->x);
> > + exit(1);
> > +}
> > +
> > +ERROR
> > +{
> > + exit(arg4 != 1 || arg5 != 0);
> > +}
>
> _______________________________________________
> 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