hledger/tools/runhledgercov
Simon Michael 523ab4331a tools: update profiling rules
A bunch of cleanups to make profiling possible again, and easier.

"make quickprof-CMD" generates a profile for CMD, which must be one
word and runs against one of the sample journals (the usual
quickprof-"SOME WORDS" quoting trick isn't working here for some
reason)

Also,

"make hledgerprof" builds the hledgerprof executable (in stack's bin dir) for profiling.

"make hledgercov" builds the hledgercov executable (in ./bin) for coverage reports
(renamed from hledgerhpc to remind me that HPC is nothing to do with heap coverage)
2015-07-22 08:52:30 -07:00

32 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python
# runhledgercov "HPCCOMMAND [HPCARGS]" [HLEDGERARGS]
#
# A front-end that resets the tix count, runs hledgercov (the HPC-enabled build)
# with the specified hledger args, and runs hpc with the specified hpc args.
# Should be run from hledger's top source directory.
#
# Eg:
# hledger$ tools/runhledgercov report test
# hledger$ tools/runhledgercov "markup --destdir=coverage" test 'some unit test'
hledgercov="hledgercov"
verbosity = 0 # 0=no output, 1=stderr only, 2=stdout+stderr
import sys, os
hpcargs, hledgerargs = sys.argv[1], ' '.join(sys.argv[2:])
# remove old tix files
os.system("rm -f %s.tix" % hledgercov)
# run the hpc-enabled binary with the specified hledger arguments to generate tix files
if verbosity<1:
os.system("bin/%s %s >/dev/null 2>&1" % (hledgercov,hledgerargs))
elif verbosity==1:
os.system("bin/%s %s >/dev/null" % (hledgercov,hledgerargs))
else:
os.system("bin/%s %s" % (hledgercov,hledgerargs))
# run the specified hpc command on the tix files
os.system("hpc %s %s" % (hpcargs,hledgercov))