mirror of
https://github.com/simonmichael/hledger.git
synced 2024-09-19 10:17:35 +03:00
tools: clean up coverage report scripts
This commit is contained in:
parent
d0efde5429
commit
c8e84b3a3a
24
Makefile
24
Makefile
@ -210,10 +210,10 @@ hledgernowarnings:
|
|||||||
hledgerp:
|
hledgerp:
|
||||||
ghc --make $(MAIN) -prof -auto-all -o bin/hledgerp $(BUILDFLAGS)
|
ghc --make $(MAIN) -prof -auto-all -o bin/hledgerp $(BUILDFLAGS)
|
||||||
|
|
||||||
# build the coverage-enabled binary. coverage-enabled .o files are kept
|
# build the -fhpc hledger binary used for coverage reports and heap profiles.
|
||||||
# separate to avoid contamination.
|
# The associated .o files are kept separate from the regular ones.
|
||||||
hledgercov:
|
hledgerhpc:
|
||||||
ghc --make $(MAIN) -fhpc -o bin/hledgercov -outputdir .coverageobjs $(BUILDFLAGS)
|
ghc --make $(MAIN) -fhpc -o bin/hledgerhpc -outputdir .hledgerhpcobjs $(BUILDFLAGS)
|
||||||
|
|
||||||
# build the fastest binary we can
|
# build the fastest binary we can
|
||||||
hledgeropt:
|
hledgeropt:
|
||||||
@ -375,13 +375,19 @@ quickheap: samplejournals hledgerp
|
|||||||
hp2ps hledgerp.hp
|
hp2ps hledgerp.hp
|
||||||
$(VIEWPS) hledger.ps
|
$(VIEWPS) hledger.ps
|
||||||
|
|
||||||
# generate a code coverage report
|
# display a code coverage text report from running hledger COVCMD
|
||||||
coverage: samplejournals hledgercov
|
quickcoverage:
|
||||||
@echo "Generating coverage report with $(COVCMD)"
|
@echo "Generating code coverage text report for hledger command: $(COVCMD)"
|
||||||
tools/coverage "markup --destdir=profs/coverage" test
|
tools/runhledgerhpc "report" $(COVCMD)
|
||||||
|
|
||||||
|
# generate a code coverage html report from running hledger COVCMD
|
||||||
|
coverage: samplejournals hledgerhpc
|
||||||
|
@echo "Generating code coverage html report for hledger command: $(COVCMD)"
|
||||||
|
tools/runhledgerhpc "markup --destdir=profs/coverage" $(COVCMD)
|
||||||
cd profs/coverage; rm -f index.html; ln -s hpc_index.html index.html
|
cd profs/coverage; rm -f index.html; ln -s hpc_index.html index.html
|
||||||
|
|
||||||
viewcoverage: coverage
|
# view the last html code coverage report
|
||||||
|
viewcoverage:
|
||||||
$(VIEWHTML) profs/coverage/index.html
|
$(VIEWHTML) profs/coverage/index.html
|
||||||
|
|
||||||
# get a debug prompt
|
# get a debug prompt
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# usage: hledger$ tools/coverage HPCCOMMAND HLEDGERARGS
|
|
||||||
# A front-end for hledgercov/hpc. Resets the tix count on each invocation.
|
|
||||||
|
|
||||||
import sys, os
|
|
||||||
cov="hledgercov"
|
|
||||||
cmd, args = sys.argv[1], ' '.join(sys.argv[2:])
|
|
||||||
os.system("rm -f %s.tix" % cov)
|
|
||||||
os.system("bin/%s %s >/dev/null" % (cov,args))
|
|
||||||
os.system("hpc %s %s" % (cmd,cov))
|
|
31
tools/runhledgerhpc
Normal file
31
tools/runhledgerhpc
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# runhledgerhpc "HPCCOMMAND [HPCARGS]" [HLEDGERARGS]
|
||||||
|
#
|
||||||
|
# A front-end that resets the tix count, runs hledgerhpc 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/runhledgerhpc report test
|
||||||
|
# hledger$ tools/runhledgerhpc "markup --destdir=coverage" test 'some unit test'
|
||||||
|
|
||||||
|
hledgerhpc="hledgerhpc"
|
||||||
|
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" % hledgerhpc)
|
||||||
|
|
||||||
|
# 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" % (hledgerhpc,hledgerargs))
|
||||||
|
elif verbosity==1:
|
||||||
|
os.system("bin/%s %s >/dev/null" % (hledgerhpc,hledgerargs))
|
||||||
|
else:
|
||||||
|
os.system("bin/%s %s" % (hledgerhpc,hledgerargs))
|
||||||
|
|
||||||
|
# run the specified hpc command on the tix files
|
||||||
|
os.system("hpc %s %s" % (hpcargs,hledgerhpc))
|
Loading…
Reference in New Issue
Block a user