diff --git a/Justfile b/Justfile index 03e803761..1159084da 100644 --- a/Justfile +++ b/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' diff --git a/hledger/test/perf.test b/hledger/test/perf.test new file mode 100644 index 000000000..12c6f3cdb --- /dev/null +++ b/hledger/test/perf.test @@ -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'