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
101 if [ -d $DB_CACHE_DIR ]; then
102 cp -r $DB_CACHE_DIR ${MAIL_DIR}/.notmuch
104 time_run 'Initial notmuch new' "notmuch new"
110 if [ -d $MAIL_DIR/.notmuch ]; then
111 cp -r $MAIL_DIR/.notmuch $DB_CACHE_DIR
113 echo "Warning: No database found to cache"
117 uncache_database () {
122 printf "[v%4s %6s] Wall(s)\tUsr(s)\tSys(s)\tRes(K)\tIn/Out(512B)\n" \
123 ${PERFTEST_VERSION} ${corpus_size}
128 if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi
129 if ! eval >&3 "/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2" ; then
130 test_failure=$(($test_failure + 1))
137 if [ "$test_failure" = "0" ]; then
145 cd -P "$test" || error "Cannot setup test environment"
149 echo $(basename "$0"): "Testing ${test_description:-notmuch performance}"