From f6c087cfe48e6410db61a9367ce7c718a490af77 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 1 Mar 2012 17:32:51 -0600 Subject: Added a new 'python' directive --- test/LedgerHarness.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/LedgerHarness.py') diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index c0dbe368..7b4dfa83 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -34,6 +34,7 @@ class LedgerHarness: failed = 0 verify = False gmalloc = False + python = False def __init__(self, argv): if not os.path.isfile(argv[1]): @@ -49,6 +50,9 @@ class LedgerHarness: self.failed = 0 self.verify = '--verify' in argv self.gmalloc = '--gmalloc' in argv + self.python = '--python' in argv + + os.chdir(self.sourcepath) def run(self, command, verify=None, gmalloc=None, columns=True): env = os.environ.copy() -- cgit v1.2.3 From c813eafbd8aaad5d66c3eb8857393c9fa1c98db6 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 9 Mar 2012 03:57:30 -0600 Subject: Display file name when a regression test fails --- test/LedgerHarness.py | 4 +++- test/RegressTests.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'test/LedgerHarness.py') diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index 7b4dfa83..564a4d32 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -112,8 +112,10 @@ class LedgerHarness: sys.stdout.write(".") self.succeeded += 1 - def failure(self): + def failure(self, name=None): sys.stdout.write("E") + if name: + sys.stdout.write("[%s]" % name) self.failed += 1 def exit(self): diff --git a/test/RegressTests.py b/test/RegressTests.py index def202e4..da5d92ca 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -148,14 +148,14 @@ class RegressFile(object): if success: harness.success() else: - harness.failure() + harness.failure(os.path.basename(self.filename)) else: if success: print if test['exitcode']: self.notify_user("FAILURE in exit code (%d != %d) from %s:" % (test['exitcode'], p.returncode, self.filename), test) - harness.failure() + harness.failure(os.path.basename(self.filename)) def run_tests(self): test = self.read_test() -- cgit v1.2.3 From 1240ce24b3dd59bb2f48a396043b4115cc49c6e1 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sat, 17 Mar 2012 16:47:33 -0500 Subject: Passing --verify to regression tests uses valgrind --- test/LedgerHarness.py | 7 +++++++ test/fullcheck.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'test/LedgerHarness.py') diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index 564a4d32..3477e720 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -81,6 +81,13 @@ class LedgerHarness: command = re.sub('\$ledger', '%s%s %s' % \ (self.ledger, insert, '--args-only'), command) + valgrind = '/usr/bin/valgrind' + if not os.path.isfile(valgrind): + valgrind = '/opt/local/bin/valgrind' + + if os.path.isfile(valgrind) and '--verify' in insert: + command = valgrind + ' -q ' + command + return Popen(command, shell=True, close_fds=True, env=env, stdin=PIPE, stdout=PIPE, stderr=PIPE) diff --git a/test/fullcheck.sh b/test/fullcheck.sh index f607f2d9..db63921d 100755 --- a/test/fullcheck.sh +++ b/test/fullcheck.sh @@ -2,7 +2,7 @@ VALGRIND='' if [ -x /usr/bin/valgrind -o -x /opt/local/bin/valgrind ]; then - VALGRIND=valgrind + VALGRIND="valgrind -q" fi #export MallocGuardEdges=1 -- cgit v1.2.3 From ee641f353c9a2216533800464d26afe86f1b028e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Sun, 15 Apr 2012 01:17:01 -0500 Subject: Resolve some issues with proof builds --- acprep | 5 ++++- src/draft.cc | 14 +++++++------- src/draft.h | 9 +++++++++ src/xact.cc | 3 ++- test/LedgerHarness.py | 4 ++-- test/RegressTests.py | 3 ++- 6 files changed, 26 insertions(+), 12 deletions(-) (limited to 'test/LedgerHarness.py') diff --git a/acprep b/acprep index 0d7f3cd0..4ebd6914 100755 --- a/acprep +++ b/acprep @@ -1643,7 +1643,10 @@ class PrepareBuild(CommandLineApp): isdir(self.build_directory()): self.log.info('=== Wiping build directory %s ===' % self.build_directory()) - shutil.rmtree(self.build_directory()) + try: + shutil.rmtree(self.build_directory()) + except: + self.execute('rm', '-fr', self.build_directory()) def phase_distcheck(self, *args): self.log.info('Executing phase: distcheck') diff --git a/src/draft.cc b/src/draft.cc index 7edf7edc..43c214cb 100644 --- a/src/draft.cc +++ b/src/draft.cc @@ -507,7 +507,6 @@ value_t template_command(call_scope_t& args) out << std::endl << std::endl; draft_t draft(args.value()); - out << _("--- Transaction template ---") << std::endl; draft.dump(out); @@ -517,15 +516,16 @@ value_t template_command(call_scope_t& args) value_t xact_command(call_scope_t& args) { report_t& report(find_scope(args)); - draft_t draft(args.value()); + draft_t draft(args.value()); - xact_t * new_xact = draft.insert(*report.session.journal.get()); + unique_ptr new_xact(draft.insert(*report.session.journal.get())); + if (new_xact.get()) { + // Only consider actual postings for the "xact" command + report.HANDLER(limit_).on("#xact", "actual"); - // Only consider actual postings for the "xact" command - report.HANDLER(limit_).on("#xact", "actual"); + report.xact_report(post_handler_ptr(new print_xacts(report)), *new_xact.get()); + } - if (new_xact) - report.xact_report(post_handler_ptr(new print_xacts(report)), *new_xact); return true; } diff --git a/src/draft.h b/src/draft.h index 46aa26e1..9023e6da 100644 --- a/src/draft.h +++ b/src/draft.h @@ -81,6 +81,15 @@ class draft_t : public expr_base_t xact_template_t() { TRACE_CTOR(xact_template_t, ""); } + xact_template_t(const xact_template_t& other) + : date(other.date), + code(other.code), + note(other.note), + payee_mask(other.payee_mask), + posts(other.posts) + { + TRACE_CTOR(xact_template_t, "copy"); + } ~xact_template_t() throw() { TRACE_DTOR(xact_template_t); } diff --git a/src/xact.cc b/src/xact.cc index 3f4b753c..226fd5ab 100644 --- a/src/xact.cc +++ b/src/xact.cc @@ -56,7 +56,8 @@ xact_base_t::~xact_base_t() // temporary is. assert(! post->has_flags(ITEM_TEMP)); - post->account->remove_post(post); + if (post->account) + post->account->remove_post(post); checked_delete(post); } } diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index 3477e720..3e797e85 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -44,8 +44,8 @@ class LedgerHarness: print "Cannot find source path at '%s'" % argv[2] sys.exit(1) - self.ledger = argv[1] - self.sourcepath = argv[2] + self.ledger = os.path.abspath(argv[1]) + self.sourcepath = os.path.abspath(argv[2]) self.succeeded = 0 self.failed = 0 self.verify = '--verify' in argv diff --git a/test/RegressTests.py b/test/RegressTests.py index a7d51ada..792c2d3e 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -184,7 +184,8 @@ if __name__ == '__main__': tests = [os.path.join(tests, x) for x in os.listdir(tests) if (x.endswith('.test') and - (not '_py.test' in x or harness.python))] + (not '_py.test' in x or (harness.python and + not harness.verify)))] if pool: pool.map(do_test, tests, 1) else: -- cgit v1.2.3 From a910549ca9f7d07d7610eb27d8b0709dc42802a6 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 25 Apr 2012 03:08:45 -0500 Subject: Fixes so that tests can run under distcheck --- test/LedgerHarness.py | 5 ++--- test/RegressTests.py | 7 ++++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'test/LedgerHarness.py') diff --git a/test/LedgerHarness.py b/test/LedgerHarness.py index 3e797e85..b8900971 100755 --- a/test/LedgerHarness.py +++ b/test/LedgerHarness.py @@ -52,8 +52,6 @@ class LedgerHarness: self.gmalloc = '--gmalloc' in argv self.python = '--python' in argv - os.chdir(self.sourcepath) - def run(self, command, verify=None, gmalloc=None, columns=True): env = os.environ.copy() @@ -89,7 +87,8 @@ class LedgerHarness: command = valgrind + ' -q ' + command return Popen(command, shell=True, close_fds=True, env=env, - stdin=PIPE, stdout=PIPE, stderr=PIPE) + stdin=PIPE, stdout=PIPE, stderr=PIPE, + cwd=self.sourcepath) def read(self, fd): text = "" diff --git a/test/RegressTests.py b/test/RegressTests.py index 792c2d3e..7d67eb21 100755 --- a/test/RegressTests.py +++ b/test/RegressTests.py @@ -42,7 +42,7 @@ class RegressFile(object): def transform_line(self, line): line = re.sub('\$sourcepath', harness.sourcepath, line) - line = re.sub('\$FILE', self.filename, line) + line = re.sub('\$FILE', os.path.abspath(self.filename), line) return line def read_test(self): @@ -93,7 +93,7 @@ class RegressFile(object): def notify_user(self, msg, test): print msg print "--" - print test['command'], + print self.transform_line(test['command']), print "--" def run_test(self, test): @@ -101,7 +101,8 @@ class RegressFile(object): if test['command'].find("-f - ") != -1: use_stdin = True else: - test['command'] = (('$ledger -f "%s" ' % self.filename) + + test['command'] = (('$ledger -f "%s" ' % + os.path.abspath(self.filename)) + test['command']) p = harness.run(test['command'], -- cgit v1.2.3