check instance counters in cleanup_for_valgrind()

This commit is contained in:
Michael Davidsaver
2020-04-05 08:58:10 -07:00
parent d852758b7b
commit 7a2ab35439
7 changed files with 39 additions and 25 deletions
+16
View File
@@ -8,9 +8,25 @@
#include "pvxs/unittest.h"
#include "utilpvt.h"
#include "udp_collector.h"
namespace pvxs {
void cleanup_for_valgrind()
{
for(auto& pair : instanceSnapshot()) {
// This will mess up test counts, but is the only way
// 'prove' will print the result in CI runs.
if(pair.second!=0)
testFail("Instance leak %s : %zu", pair.first.c_str(), pair.second);
}
#if LIBEVENT_VERSION_NUMBER >= 0x02010000
libevent_global_shutdown();
#endif
impl::logger_shutdown();
impl::UDPManager::cleanup();
}
testCase::testCase()
:result(Diag)
{}