Skip to content

Commit

Permalink
Formatted printa() is broken
Browse files Browse the repository at this point in the history
A few tests were failing due simply to this bug.  Their XFAIL
annotations should be removed.  Add stddev and llquantize to
tst.basics.d so that all aggregation functions are tested;  each
function causes a specific callback to be used.

#5
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Signed-off-by: Eugene Loh <eugene.loh@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
euloh committed Jan 14, 2021
1 parent 8068b2c commit 4413e6d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
6 changes: 3 additions & 3 deletions libdtrace/dt_printf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1381,9 +1381,10 @@ dt_printf_format(dtrace_hdl_t *dtp, FILE *fp, const dt_pfargv_t *pfv,
curagg++;

rec = &agg->dtagd_recs[aggrec];
addr = aggdata->dtada_data + rec->dtrd_offset;
addr = aggdata->dtada_data;
limit = addr + aggdata->dtada_size;
normal = aggdata->dtada_normal;
size = agg->dtagd_size;
sig = agg->dtagd_sig;
flags = DTRACE_BUFDATA_AGGVAL;
} else {
Expand All @@ -1408,11 +1409,10 @@ dt_printf_format(dtrace_hdl_t *dtp, FILE *fp, const dt_pfargv_t *pfv,
addr = (caddr_t)buf + rec->dtrd_offset;
limit = lim;
normal = 1;
size = rec->dtrd_size;
sig = 0;
}

size = rec->dtrd_size;

if (addr + size > limit) {
dt_dprintf("bad size: addr=%p size=0x%x lim=%p\n",
(void *)addr, rec->dtrd_size, (void *)lim);
Expand Down
1 change: 0 additions & 1 deletion test/unittest/aggs/tst.clearavg2.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
/* @@xfail: dtv2 */

/*
* ASSERTION:
Expand Down
1 change: 0 additions & 1 deletion test/unittest/aggs/tst.multiaggs3.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
/* @@xfail: dtv2 */

/*
* ASSERTION:
Expand Down
6 changes: 5 additions & 1 deletion test/unittest/printa/tst.basics.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
/* @@xfail: dtv2 */

/*
* ASSERTION:
Expand All @@ -25,6 +24,9 @@ BEGIN
@e = min(1);
@f = sum(1);
@g = quantize(1);
@h = llquantize(320, 10, 0, 5, 5, 8);
@i = stddev(10);
@i = stddev(20);

printa("@a = %@u\n", @a);
printa("@b = %@u\n", @b);
Expand All @@ -33,6 +35,8 @@ BEGIN
printa("@e = %@u\n", @e);
printa("@f = %@u\n", @f);
printa("@g = %@d\n", @g);
printa("@h = %@d\n", @h);
printa("@i = %@d\n", @i);

exit(0);
}
7 changes: 7 additions & 0 deletions test/unittest/printa/tst.basics.r
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@
1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
2 | 0

@h =
value ------------- Distribution ------------- count
100 | 0
200 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 8
400 | 0

@i = 5

0 comments on commit 4413e6d

Please sign in to comment.