blog/bench.sh

27 lines
745 B
Bash
Raw Permalink Normal View History

2024-06-19 18:53:44 +00:00
#!/usr/bin/env bash
amt=$1
if [[ -z "$amt" ]]; then
echo "ERROR: pass number of test posts for bench" 1>&2
exit 1
fi
echo "INFO: removing old __bench files" 1>&2
rm -f ./posts/*__bench*
for i in $(seq 1 "$amt"); do
cp ./posts/build_a_blog.md ./posts/build_a_blog_${i}__bench.md
done
echo "INFO: number of *.md files $(find ./posts/ -iname '*.md' | wc -l)" 1>&2
echo "INFO: number of *.html files $(find ./posts/ -iname '*.html' | wc -l)" 1>&2
echo "INFO: running" 1>&2
time -p python main.py 2>/dev/null
2024-06-19 19:34:10 +00:00
rc=$?
if [[ "$rc" != "0" ]]; then
echo "ERROR: program exited with $rc" 1>&2
exit 1
fi
2024-06-19 18:53:44 +00:00
echo "INFO: number of *.html files $(find ./posts/ -iname '*.html' | wc -l)" 1>&2
echo "INFO: cleanup __bench files" 1>&2
rm -f ./posts/*__bench*