Skip to content
Snippets Groups Projects
Commit 39c8d369 authored by Scott Snyder's avatar Scott Snyder Committed by Graeme Stewart
Browse files

A couple missing #includes in leakcheck.h. (TestTools-00-07-45)

	* Tagging TestTools-00-07-45.

2016-11-26  scott snyder  <snyder@bnl.gov>

	* Tagging TestTools-00-07-44.
	* leakcheck.h: (new) Very simple leak checker.

2016-11-14  scott snyder  <snyder@bnl.gov>

	* Tagging TestTools-00-07-43.
	* Ignore ubsan warning from regex.h.

2016-10-27  scott snyder  <snyder@bnl.gov>

	* Tagging TestTools-00-07-42.
	* share/post.sh: Ignore more messages coming from change in gaudi
	versions.

2016-08-30  scott snyder  <snyder@bnl.gov>
...
(Long ChangeLog diff - truncated)


Former-commit-id: e25995e2
parent 9aad21cf
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,7 @@
* EXPECT_EXCEPTION (std::runtime_error, doSomething());
@endcode
*
* This will produce an exception failure if @c doSomething()
* This will produce an assertion failure if @c doSomething()
* does _not_ throw a @c std::runtime_error exception.
*/
#define EXPECT_EXCEPTION(EXC, CODE) do { \
......
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id$
/**
* @file TestTools/leakcheck.h
* @author scott snyder <snyder@bnl.gov>
* @date Nov, 2016
* @brief Pitifully simple leak checker for unit tests.
* Just verifies that allocations/deallocations
* match over an RAII region.
*
* Overrides the standard new/delete functions, so should not be
* #included from any code that would be included in a library.
*/
#ifndef TESTTOOLS_LEAKCHECK_H
#define TESTTOOLS_LEAKCHECK_H
#include <malloc.h>
#include <unordered_set>
#include <iostream>
#include <cassert>
namespace Athena_test {
std::unordered_set<void*>* allocs = nullptr;
struct LeakCheckDisable
{
LeakCheckDisable() : m_allocs(allocs) { allocs = nullptr; }
~LeakCheckDisable() { allocs = m_allocs; }
void insert(void* p) { if (m_allocs) m_allocs->insert(p); }
void erase(void* p) { if (m_allocs) m_allocs->erase(p); }
std::unordered_set<void*>* m_allocs;
};
} // namespace Athena_test
void* operator new(std::size_t size)
{
void* ptr = malloc(size);
if (Athena_test::allocs) {
Athena_test::LeakCheckDisable disable;
disable.insert (ptr);
}
return ptr;
}
void operator delete (void* ptr) noexcept
{
if (Athena_test::allocs) {
Athena_test::LeakCheckDisable disable;
disable.erase (ptr);
}
free(ptr);
}
void operator delete (void* ptr, size_t) noexcept
{
if (Athena_test::allocs) {
Athena_test::LeakCheckDisable disable;
disable.erase (ptr);
}
free(ptr);
}
namespace Athena_test {
struct Leakcheck
{
Leakcheck() : m_old_allocs (allocs) { allocs = &m_allocs; }
~Leakcheck();
std::unordered_set<void*>* m_old_allocs;
std::unordered_set<void*> m_allocs;
};
// Not inline; this file should NOT be included in any library.
Leakcheck::~Leakcheck()
{
allocs = m_old_allocs;
if (!m_allocs.empty()) {
std::cerr << "Leaks!\n";
for (void* p : m_allocs)
std::cerr << " " << p << "\n";
assert (m_allocs.empty());
}
}
} // namespace Athena_test
#endif // not TESTTOOLS_LEAKCHECK_H
......@@ -143,11 +143,17 @@ PP="$PP"'|^ConditionStore +INFO Start ConditionStore'
PP="$PP"'|^ConditionStore +INFO Stop ConditionStore'
# Differences between Gaudi versions.
PP="$PP"'|DEBUG input handles:|DEBUG output handles:|DEBUG Data Deps for|DEBUG Property update for OutputLevel :|-ExtraInputs |-ExtraOutputs |-Cardinality |-IsClonable |-NeededResources |-Timeline '
PP="$PP"'|DEBUG input handles:|DEBUG output handles:|DEBUG Data Deps for|DEBUG Property update for OutputLevel :|-ExtraInputs |-ExtraOutputs |-Cardinality |-IsClonable |-NeededResources |-Timeline |Service base class initialized successfully'
# StoreGate INFO messages changed to VERBOSE
PP="$PP"'|^(StoreGateSvc|[^ ]+Store) +(INFO|VERBOSE) (Stop|stop|Start)'
# Transient frontier warnings.
PP="$PP"'|^warn .fn-'
# ubsan
PP="$PP"'|bits/regex.h:1545'
if [ "$extrapatterns" != "" ]; then
PP="$PP""|$extrapatterns"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment