#!/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 rc=$? if [[ "$rc" != "0" ]]; then echo "ERROR: program exited with $rc" 1>&2 exit 1 fi 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*