summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2007-05-08 02:53:28 +0000
committerJohn Wiegley <johnw@newartisans.com>2008-04-13 03:38:40 -0400
commitfa81dc479801ba1343695d66cdb37d8b80bfae9d (patch)
tree835724102a2c99a88d9e67bae71a94ee49e1f674
parentee4a16743960122bf2b626f62827b7332680ebf5 (diff)
downloadfork-ledger-fa81dc479801ba1343695d66cdb37d8b80bfae9d.tar.gz
fork-ledger-fa81dc479801ba1343695d66cdb37d8b80bfae9d.tar.bz2
fork-ledger-fa81dc479801ba1343695d66cdb37d8b80bfae9d.zip
Added target fullcheck.
-rw-r--r--Makefile.am7
-rw-r--r--Makefile.in7
-rwxr-xr-xacprep1
-rw-r--r--src/amount.cc2
-rw-r--r--src/xml.cc12
-rw-r--r--src/xml.h13
-rw-r--r--tests/UnitTests.cc28
7 files changed, 44 insertions, 26 deletions
diff --git a/Makefile.am b/Makefile.am
index 59d2add1..81e6da18 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -234,6 +234,13 @@ PyUnitTests: $(srcdir)/tests/python/PyUnitTests.py
| sed "s/%builddir%/$(ESC_builddir)/g" > $@
chmod 755 $@
+fullcheck: UnitTests
+ MallocGuardEdges=1 \
+ MallocScribble=1 \
+ MallocPreScribble=1 \
+ DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib \
+ $(top_builddir)/UnitTests --verify
+
######################################################################
DISTCLEANFILES = Doxyfile.gen
diff --git a/Makefile.in b/Makefile.in
index 1d270283..530e5017 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1858,6 +1858,13 @@ PyUnitTests: $(srcdir)/tests/python/PyUnitTests.py
| sed "s/%builddir%/$(ESC_builddir)/g" > $@
chmod 755 $@
+fullcheck: UnitTests
+ MallocGuardEdges=1 \
+ MallocScribble=1 \
+ MallocPreScribble=1 \
+ DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib \
+ $(top_builddir)/UnitTests --verify
+
alldocs: docs/ledger.info docs/ledger.pdf doxygen-docs
$(top_builddir)/Doxyfile.gen: $(srcdir)/docs/Doxyfile
diff --git a/acprep b/acprep
index 9336d33f..6ed37e84 100755
--- a/acprep
+++ b/acprep
@@ -63,6 +63,7 @@ while [ -n "$1" ]; do
# CPPFLAGS="-I/usr/local/include/stlport $CPPFLAGS"
# LIBS="$LIBS -lstlportstlg"
#fi
+ CPPFLAGS="$CPPFLAGS -D_GLIBCXX_DEBUG=1" ;;
CXXFLAGS="$CXXFLAGS -g" ;;
--prof | --perf)
diff --git a/src/amount.cc b/src/amount.cc
index 85ba07f5..274d3001 100644
--- a/src/amount.cc
+++ b/src/amount.cc
@@ -283,7 +283,7 @@ namespace {
}
if (sign) {
- char * newbuf = new char[std::strlen(result ? result : buf) + 1];
+ char * newbuf = new char[std::strlen(result ? result : buf) + 2];
newbuf[0] = '-';
std::strcpy(&newbuf[1], result ? result : buf);
mpz_set_str(dest, newbuf, 10);
diff --git a/src/xml.cc b/src/xml.cc
index 219a0162..fbc40560 100644
--- a/src/xml.cc
+++ b/src/xml.cc
@@ -51,11 +51,6 @@ const char * document_t::ledger_builtins[] = {
"transaction"
};
-document_t::document_t(node_t * _top)
- : stub(this), top(_top ? _top : &stub) {
- TRACE_CTOR(xml::document_t, "node_t *, const char **, const int");
-}
-
document_t::~document_t()
{
TRACE_DTOR(xml::document_t);
@@ -159,10 +154,9 @@ void document_t::print(std::ostream& out) const
document_t * node_t::document;
#endif
-node_t::node_t(document_t * _document, parent_node_t * _parent,
- flags_t _flags)
- : supports_flags<>(_flags),
- name_id(0), parent(_parent), next(NULL), prev(NULL), attrs(NULL)
+node_t::node_t(document_t * _document, parent_node_t * _parent, flags_t _flags)
+ : supports_flags<>(_flags), name_id(0), parent(_parent),
+ next(NULL), prev(NULL), attrs(NULL)
{
TRACE_CTOR(node_t, "document_t *, node_t *");
document = _document;
diff --git a/src/xml.h b/src/xml.h
index 96964975..b11cb86f 100644
--- a/src/xml.h
+++ b/src/xml.h
@@ -236,18 +236,23 @@ private:
names_map names_index;
- terminal_node_t stub;
-
- public:
+public:
node_t * top;
+private:
+ terminal_node_t stub;
+
+public:
// Ids 0-9 are reserved. 10-999 are for "builtin" names. 1000+ are
// for dynamically registered names.
enum special_names_t {
CURRENT, PARENT, ROOT, ALL
};
- document_t(node_t * _top = NULL);
+ document_t(node_t * _top = NULL)
+ : top(_top ? _top : &stub), stub(this) {
+ TRACE_CTOR(xml::document_t, "node_t *, const char **, const int");
+ }
~document_t();
void set_top(node_t * _top);
diff --git a/tests/UnitTests.cc b/tests/UnitTests.cc
index 1c695340..7f5d1333 100644
--- a/tests/UnitTests.cc
+++ b/tests/UnitTests.cc
@@ -17,17 +17,7 @@
CPPUNIT_REGISTRY_ADD_TO_DEFAULT("Framework");
-CPPUNIT_REGISTRY_ADD_TO_DEFAULT("corelib");
-
-CPPUNIT_REGISTRY_ADD("numerics", "corelib");
-CPPUNIT_REGISTRY_ADD("balances", "corelib");
-CPPUNIT_REGISTRY_ADD("values", "corelib");
-
-CPPUNIT_REGISTRY_ADD_TO_DEFAULT("driver");
-CPPUNIT_REGISTRY_ADD_TO_DEFAULT("journal");
-CPPUNIT_REGISTRY_ADD_TO_DEFAULT("reports");
-CPPUNIT_REGISTRY_ADD_TO_DEFAULT("transforms");
-
+CPPUNIT_REGISTRY_ADD_TO_DEFAULT("numerics");
// Create a sample test, which acts both as a template, and a
// verification that the basic framework is functioning.
@@ -62,9 +52,17 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(UnitTests, "framework");
int main(int argc, char* argv[])
{
+ int index = 1;
+
+ if (argc > index && std::string(argv[index]) == "--verify") {
+ ledger::verify_enabled = true;
+ index++;
+ }
+
// Retreive test path from command line first argument. Default to
// "" which resolves to the top level suite.
- std::string testPath = (argc > 1) ? std::string(argv[1]) : std::string("");
+ std::string testPath = ((argc > index) ? std::string(argv[index]) :
+ std::string(""));
// Create the event manager and test controller
CPPUNIT_NS::TestResult controller;
@@ -85,8 +83,14 @@ int main(int argc, char* argv[])
CPPUNIT_NS::TestRunner runner;
runner.addTest(CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
try {
+ IF_VERIFY()
+ initialize_memory_tracing();
+
runner.run(controller, testPath);
+ IF_VERIFY()
+ shutdown_memory_tracing();
+
// Print test in a compiler compatible format.
CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut());
outputter.write();