tests: histogram prevent re-use of local variables

By moving the tests to separate functions.

http://tracker.ceph.com/issues/9235 Fixes: #9235

Signed-off-by: Loic Dachary <loic-201408@dachary.org>
Merge pull request #2334 from dachary/wip-9235-uninitialized-variables

tests: histogram prevent re-use of local variables