;dev: add performance tests, logging to perf.log, run by just perftest
This commit is contained in:
parent
64b97b2658
commit
4d0550f1b4
12
Justfile
12
Justfile
@ -482,13 +482,23 @@ SHELLTEST := STACK + ' exec -- shelltest --execdir --exclude=/_ --threads=32'
|
||||
|
||||
# --hide-successes
|
||||
|
||||
# build hledger warning-free and run functional tests, with any shelltest OPTS (requires mktestaddons)
|
||||
# build hledger warning-free and run functional tests, with any shelltest OPTS. (after mktestaddons)
|
||||
@functest *STOPTS:
|
||||
$STACK build --ghc-options=-Werror hledger
|
||||
time (({{ SHELLTEST }} --hide {{ if STOPTS == '' { '' } else { STOPTS } }} \
|
||||
hledger/test/ bin/ \
|
||||
-x hledger/test/perf.test \
|
||||
-x ledger-compat/ledger-baseline -x ledger-compat/ledger-regress -x ledger-compat/ledger-extra \
|
||||
&& echo $@ PASSED) || (echo $@ FAILED; false))
|
||||
# too fragile
|
||||
# echo
|
||||
# just perftest {{ STOPTS }}
|
||||
|
||||
# run performance tests with the hledger in PATH, logging to perf.log and expecting a certain txns/s. Accepts shelltest OPTS.
|
||||
@perftest *STOPTS:
|
||||
echo "Running performance tests..."
|
||||
time (({{ SHELLTEST }} --hide {{ if STOPTS == '' { '' } else { STOPTS } }} hledger/test/perf.test \
|
||||
&& echo $@ PASSED) || (echo $@ FAILED; false))
|
||||
|
||||
ADDONEXTS := 'pl py rb sh hs lhs rkt exe com bat'
|
||||
ADDONSDIR := 'hledger/test/cli/addons'
|
||||
|
||||
12
hledger/test/perf.test
Normal file
12
hledger/test/perf.test
Normal file
@ -0,0 +1,12 @@
|
||||
# * performance tests
|
||||
# This file is run after the other functional tests have completed,
|
||||
# so that they don't slow it down.
|
||||
|
||||
# ** 1. Log performance stats to a persistent perf.log.
|
||||
# so that we can detect changes over time.
|
||||
# Ideally we would detect regressions and fail automatically,
|
||||
# but it's hard to ensure consistent machine performance.
|
||||
$ hledger stats -1 -f ../../examples/10ktxns-1kaccts.journal >>../../perf.log
|
||||
|
||||
# ** 2. Test that it hits at least 14k txns/s within a few runs.
|
||||
$ hledger stats -1 -f ../../examples/10ktxns-1kaccts.journal >>../../perf.log; hledger stats -1 -f ../../examples/10ktxns-1kaccts.journal >>../../perf.log; hledger stats -1 -f ../../examples/10ktxns-1kaccts.journal >>../../perf.log; tail -3 ../../perf.log | grep -qE '[1-9][4-9]... txns/s'
|
||||
Loading…
Reference in New Issue
Block a user