25 echo "error: unknown performance test option '$1'" >&2; exit 1 ;;
28 . ../test/test-lib-common.sh
32 if ! test -x ../notmuch
34 echo >&2 'You do not seem to have built notmuch yet.'
38 DB_CACHE_DIR=${TEST_DIRECTORY}/notmuch.cache.$corpus_size
44 case "$corpus_size" in
46 mail_subdir="mail/enron/bailey-s"
47 check_for="${TEST_DIRECTORY}/corpus/$mail_subdir"
50 mail_subdir="mail/notmuch-archive"
51 check_for="${TEST_DIRECTORY}/corpus/$mail_subdir"
55 check_for="${TEST_DIRECTORY}/corpus/$mail_subdir/enron/wolfe-j"
58 MAIL_CORPUS="${TEST_DIRECTORY}/corpus/$mail_subdir"
59 TAG_CORPUS="${TEST_DIRECTORY}/corpus/tags"
62 if [ ! -d "$TAG_CORPUS" ] ; then
63 args+=("notmuch-email-corpus/tags")
66 if [ ! -d "$check_for" ] ; then
67 args+=("notmuch-email-corpus/$mail_subdir")
70 if [[ ${#args[@]} > 0 ]]; then
71 if command -v pixz > /dev/null; then
77 printf "Unpacking corpus\n"
78 mkdir -p "${TEST_DIRECTORY}/corpus"
80 tar --checkpoint=.5000 --extract --strip-components=1 \
81 --directory ${TEST_DIRECTORY}/corpus \
82 --use-compress-program ${XZ} \
83 --file ../download/notmuch-email-corpus-${PERFTEST_VERSION}.tar.xz \
90 cp -lr $TAG_CORPUS $TMP_DIRECTORY/corpus.tags
91 cp -lr $MAIL_CORPUS $MAIL_DIR
94 notmuch_new_with_cache ()
96 if [ -d $DB_CACHE_DIR ]; then
97 cp -r $DB_CACHE_DIR ${MAIL_DIR}/.notmuch
99 "$1" 'Initial notmuch new' "notmuch new"
110 notmuch_new_with_cache time_run
117 local timestamp=$(date +%Y%m%dT%H%M%S)
118 log_dir="${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp}"
121 notmuch_new_with_cache memory_run
126 test_count=$(($test_count+1))
128 log_file=$log_dir/$test_count.log
129 talloc_log=$log_dir/$test_count.talloc
131 printf "[ %d ]\t%s\n" $test_count "$1"
133 NOTMUCH_TALLOC_REPORT="$talloc_log" valgrind --leak-check=full --log-file="$log_file" $2
135 awk '/LEAK SUMMARY/,/suppressed/ { sub(/^==[0-9]*==/," "); print }' "$log_file"
137 sed -n -e 's/.*[(]total *\([^)]*\)[)]/talloced at exit: \1/p' $talloc_log
148 if [ -d $MAIL_DIR/.notmuch ]; then
149 cp -r $MAIL_DIR/.notmuch $DB_CACHE_DIR
151 echo "Warning: No database found to cache"
162 printf "\t\t\tWall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n"
168 test_count=$(($test_count+1))
169 if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi
170 if ! eval >&3 "/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2" ; then
171 test_failure=$(($test_failure + 1))
179 if [ "$test_failure" = "0" ]; then
187 cd -P "$test" || error "Cannot setup test environment"
191 printf "\n%-55s [%s %s]\n" \
192 "$(basename "$0"): Testing ${test_description:-notmuch performance}" \
193 "${PERFTEST_VERSION}" "${corpus_size}"