perf test stat+shadow_stat.sh: Add threshold for rounding errors
authorVeronika Molnarova <vmolnaro@redhat.com>
Tue, 19 Sep 2023 15:02:42 +0000 (17:02 +0200)
committerNamhyung Kim <namhyung@kernel.org>
Thu, 21 Sep 2023 18:53:45 +0000 (11:53 -0700)
commitfa52d995d1d0b64e75f63571df2e57ba22ff0cb1
tree74507571d6808a796cd4dc59775cbfd24a869673
parente49be27e18c59639be28cd0d766caf594fe2b77f
perf test stat+shadow_stat.sh: Add threshold for rounding errors

The test was failing in specific scenarios due to imperfection of FP
arithmetics. The `bc` command wasn't correctly rounding the result of
division causing the failure.

Replace the `bc` with `awk` which should work with more decimal places
and add a threshold to catch any possible rounding errors.  The
acceptable rounding error is set to 0.01 when the test passes with a
warning message.

Signed-off-by: Veronika Molnarova <vmolnaro@redhat.com>
Acked-by: Michael Petlan <mpetlan@redhat.com>
Link: https://lore.kernel.org/r/20230919150419.23193-1-vmolnaro@redhat.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
tools/perf/tests/shell/stat+shadow_stat.sh