From: David Bremner Date: Mon, 10 May 2021 14:36:56 +0000 (-0300) Subject: Merge branch 'release' X-Git-Tag: archive/debian/0.33_rc0-1~113 X-Git-Url: https://git.cworth.org/git?p=notmuch;a=commitdiff_plain;h=b4a4ed0df9cd2150e75853f5491cfa02fe72caf1;hp=5ebbf17242522e3a00d7f084f0ddfc86b0611825 Merge branch 'release' --- diff --git a/NEWS b/NEWS index 44a18951..081c6089 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,11 @@ +Notmuch 0.33 (UNRELEASED) +========================= + +Vim +--- + +Respect excluded tags when showing a thread. + Notmuch 0.32.1 (UNRELEASED) =========================== diff --git a/performance-test/README b/performance-test/README index fbc61028..59b37b1b 100644 --- a/performance-test/README +++ b/performance-test/README @@ -16,6 +16,7 @@ In addition to having notmuch, you need: - xz. Some speedup can be gotten by installing "pixz", but this is probably only worthwhile if you are debugging the tests. - valgrind (for the memory tests) +- perf (optional, for more fine-grained timing) Getting set up to run tests: ---------------------------- @@ -56,11 +57,24 @@ supports the following arguments --small / --medium / --large Choose corpus size. --debug Enable debugging. In particular don't delete - temporary directories. + temporary directories. +--perf Run perf record in place of /usr/bin/time. Perf output can be + found in a log directory. +--call-graph {fp,lbr,dwarf} Call graph option for perf record. Default is 'lbr'. When using the make targets, you can pass arguments to all test scripts by defining the make variable OPTIONS. +Log Directory +------------- + +The memory tests, and the time tests when option '--perf' is given +save their output in a directory named as follows + + log.$test_name-$corpus_size-$timestamp + +These directories are removed by "make clean". + Writing tests ------------- diff --git a/performance-test/perf-test-lib.sh b/performance-test/perf-test-lib.sh index b70288cc..e7c502b6 100644 --- a/performance-test/perf-test-lib.sh +++ b/performance-test/perf-test-lib.sh @@ -1,6 +1,9 @@ . $(dirname "$0")/version.sh || exit 1 +debug="" corpus_size=large +perf_callgraph=lbr +use_perf=0 while test "$#" -ne 0 do @@ -9,6 +12,15 @@ do debug=t; shift ;; + -p|--perf) + use_perf=1; + shift + ;; + -c|--call-graph) + shift + perf_callgraph=$1 + shift + ;; -s|--small) corpus_size=small; shift @@ -127,10 +139,20 @@ notmuch_new_with_cache () fi } +make_log_dir () { + local timestamp=$(date +%Y%m%dT%H%M%S) + log_dir=${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp} + mkdir -p "${log_dir}" +} + time_start () { add_email_corpus + if [[ "$use_perf" = 1 ]]; then + make_log_dir + fi + print_header notmuch_new_with_cache time_run @@ -140,9 +162,7 @@ memory_start () { add_email_corpus - local timestamp=$(date +%Y%m%dT%H%M%S) - log_dir="${TEST_DIRECTORY}/log.$(basename $0)-$corpus_size-${timestamp}" - mkdir -p ${log_dir} + make_log_dir notmuch_new_with_cache memory_run } @@ -193,7 +213,13 @@ time_run () printf " %-22s" "$1" test_count=$(($test_count+1)) if test "$verbose" != "t"; then exec 4>test.output 3>&4; fi - if ! eval >&3 "/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2" ; then + if [[ "$use_perf" = 1 ]]; then + command_str="perf record --call-graph=${perf_callgraph} -o ${log_dir}/${test_count}.perf $2" + else + command_str="/usr/bin/time -f '%e\t%U\t%S\t%M\t%I/%O' $2" + fi + + if ! eval >&3 "$command_str" ; then test_failure=$(($test_failure + 1)) return 1 fi diff --git a/test/T310-emacs.sh b/test/T310-emacs.sh index 78ac19a8..e64627c6 100755 --- a/test/T310-emacs.sh +++ b/test/T310-emacs.sh @@ -5,6 +5,7 @@ test_description="emacs interface" EXPECTED=$NOTMUCH_SRCDIR/test/emacs.expected-output +test_require_emacs add_email_corpus # syntax errors in test-lib.el cause mysterious failures diff --git a/test/T350-crypto.sh b/test/T350-crypto.sh index 0aada4df..ae1d6a98 100755 --- a/test/T350-crypto.sh +++ b/test/T350-crypto.sh @@ -9,6 +9,7 @@ test_description='PGP/MIME signature verification and decryption' ################################################## +test_require_emacs add_gnupg_home test_begin_subtest "emacs delivery of signed message" diff --git a/test/T355-smime.sh b/test/T355-smime.sh index 8b2b52be..12ac2525 100755 --- a/test/T355-smime.sh +++ b/test/T355-smime.sh @@ -3,6 +3,7 @@ test_description='S/MIME signature verification and decryption' . $(dirname "$0")/test-lib.sh || exit 1 +test_require_emacs test_require_external_prereq openssl test_require_external_prereq gpgsm diff --git a/test/T357-index-decryption.sh b/test/T357-index-decryption.sh index 1ed5f28c..b81bdfe1 100755 --- a/test/T357-index-decryption.sh +++ b/test/T357-index-decryption.sh @@ -7,6 +7,7 @@ test_description='indexing decrypted mail' ################################################## +test_require_emacs add_gnupg_home # create a test encrypted message diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh index a0b76eb8..597330d3 100755 --- a/test/T395-ruby.sh +++ b/test/T395-ruby.sh @@ -8,95 +8,61 @@ fi add_email_corpus +test_ruby() { + ( + cat <<-EOF + require 'notmuch' + db = Notmuch::Database.new('$MAIL_DIR') + EOF + cat + ) | $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT + test_expect_equal_file EXPECTED OUTPUT +} + test_begin_subtest "compare thread ids" +notmuch search --sort=oldest-first --output=threads tag:inbox > EXPECTED test_ruby <<"EOF" -require 'notmuch' -$maildir = ENV['MAIL_DIR'] -if not $maildir then - abort('environment variable MAIL_DIR must be set') -end -@db = Notmuch::Database.new($maildir) -@q = @db.query('tag:inbox') -@q.sort = Notmuch::SORT_OLDEST_FIRST -for t in @q.search_threads do - print t.thread_id, "\n" +q = db.query('tag:inbox') +q.sort = Notmuch::SORT_OLDEST_FIRST +q.search_threads.each do |t| + puts 'thread:%s' % t.thread_id end EOF -notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED -test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "compare message ids" +notmuch search --sort=oldest-first --output=messages tag:inbox > EXPECTED test_ruby <<"EOF" -require 'notmuch' -$maildir = ENV['MAIL_DIR'] -if not $maildir then - abort('environment variable MAIL_DIR must be set') -end -@db = Notmuch::Database.new($maildir) -@q = @db.query('tag:inbox') -@q.sort = Notmuch::SORT_OLDEST_FIRST -for m in @q.search_messages do - print m.message_id, "\n" +q = db.query('tag:inbox') +q.sort = Notmuch::SORT_OLDEST_FIRST +q.search_messages.each do |m| + puts 'id:%s' % m.message_id end EOF -notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED -test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "get non-existent file" +echo nil > EXPECTED test_ruby <<"EOF" -require 'notmuch' -$maildir = ENV['MAIL_DIR'] -if not $maildir then - abort('environment variable MAIL_DIR must be set') -end -@db = Notmuch::Database.new($maildir) -result = @db.find_message_by_filename('i-dont-exist') -print (result == nil) +p db.find_message_by_filename('i-dont-exist') EOF -test_expect_equal "$(cat OUTPUT)" "true" test_begin_subtest "count messages" +notmuch count --output=messages tag:inbox > EXPECTED test_ruby <<"EOF" -require 'notmuch' -$maildir = ENV['MAIL_DIR'] -if not $maildir then - abort('environment variable MAIL_DIR must be set') -end -@db = Notmuch::Database.new($maildir) -@q = @db.query('tag:inbox') -print @q.count_messages(),"\n" +puts db.query('tag:inbox').count_messages() EOF -notmuch count --output=messages tag:inbox > EXPECTED -test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "count threads" +notmuch count --output=threads tag:inbox > EXPECTED test_ruby <<"EOF" -require 'notmuch' -$maildir = ENV['MAIL_DIR'] -if not $maildir then - abort('environment variable MAIL_DIR must be set') -end -@db = Notmuch::Database.new($maildir) -@q = @db.query('tag:inbox') -print @q.count_threads(),"\n" +puts db.query('tag:inbox').count_threads() EOF -notmuch count --output=threads tag:inbox > EXPECTED -test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "get all tags" +notmuch search --output=tags '*' > EXPECTED test_ruby <<"EOF" -require 'notmuch' -$maildir = ENV['MAIL_DIR'] -if not $maildir then - abort('environment variable MAIL_DIR must be set') -end -@db = Notmuch::Database.new($maildir) -@t = @db.all_tags() -for tag in @t do - print tag,"\n" +db.all_tags.each do |tag| + puts tag end EOF -notmuch search --output=tags '*' > EXPECTED -test_expect_equal_file EXPECTED OUTPUT test_done diff --git a/test/T450-emacs-show.sh b/test/T450-emacs-show.sh index cca56ca3..bd76d378 100755 --- a/test/T450-emacs-show.sh +++ b/test/T450-emacs-show.sh @@ -5,6 +5,7 @@ test_description="emacs notmuch-show view" EXPECTED=$NOTMUCH_SRCDIR/test/emacs-show.expected-output +test_require_emacs add_email_corpus test_begin_subtest "Hiding Original Message region at beginning of a message" diff --git a/test/T460-emacs-tree.sh b/test/T460-emacs-tree.sh index cb2c90b8..195485c1 100755 --- a/test/T460-emacs-tree.sh +++ b/test/T460-emacs-tree.sh @@ -5,6 +5,7 @@ test_description="emacs tree view interface" EXPECTED=$NOTMUCH_SRCDIR/test/emacs-tree.expected-output +test_require_emacs add_email_corpus test_begin_subtest "Basic notmuch-tree view in emacs" diff --git a/test/T730-emacs-forwarding.sh b/test/T730-emacs-forwarding.sh index 45e61568..5d6ac9f0 100755 --- a/test/T730-emacs-forwarding.sh +++ b/test/T730-emacs-forwarding.sh @@ -3,6 +3,8 @@ test_description="emacs forwarding" . $(dirname "$0")/test-lib.sh || exit 1 +test_require_emacs + test_begin_subtest "Forward setting the correct references header" # Check that, when forwarding a message, the new message has # a References-header pointing to the original (forwarded) message. diff --git a/test/test-lib.sh b/test/test-lib.sh index 4c9f2a21..d46bb4c3 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -112,6 +112,13 @@ unset ALTERNATE_EDITOR # for reproducibility unset EMAIL +unset NAME + +test_require_emacs () { + test_require_external_prereq emacs + test_require_external_prereq ${TEST_EMACSCLIENT} + test_require_external_prereq dtach +} add_gnupg_home () { @@ -591,6 +598,9 @@ test_emacs_expect_t () { exec 1>&6 2>&7 # Restore stdout and stderr inside_subtest= + # test_emacs may update missing external prerequisites + test_check_missing_external_prereqs_ "$test_subtest_name" && return + # Report success/failure. result=$(cat OUTPUT) if [ "$result" = t ] @@ -708,10 +718,15 @@ import os, sys, pwd, socket pw = pwd.getpwuid(os.getuid()) user = pw.pw_name name = pw.pw_gecos.partition(",")[0] -fqdn = socket.getfqdn() +fqdn = socket.getaddrinfo(socket.gethostname(), 0, 0, socket.SOCK_STREAM, 0, socket.AI_CANONNAME)[0][3] for l in sys.stdin: - l = l.replace(user, "USERNAME").replace(fqdn, "FQDN").replace(".(none)","").replace(name, "USER_FULL_NAME") + if user: + l = l.replace(user, "USERNAME") + if fqdn: + l = l.replace(fqdn, "FQDN").replace(".(none)","") + if name: + l = l.replace(name, "USER_FULL_NAME") sys.stdout.write(l) ' } @@ -913,7 +928,7 @@ test_expect_success () { test_run_ "$1" run_ret="$?" # test_run_ may update missing external prerequisites - test_check_missing_external_prereqs_ "$@" || + test_check_missing_external_prereqs_ "$test_subtest_name" || if [ "$run_ret" = 0 -a "$eval_ret" = 0 ] then test_ok_ @@ -937,7 +952,7 @@ test_expect_code () { test_run_ "$2" run_ret="$?" # test_run_ may update missing external prerequisites, - test_check_missing_external_prereqs_ "$@" || + test_check_missing_external_prereqs_ "$test_subtest_name" || if [ "$run_ret" = 0 -a "$eval_ret" = "$1" ] then test_ok_ @@ -1109,10 +1124,6 @@ test_python() { $NOTMUCH_PYTHON -B - > OUTPUT } -test_ruby() { - MAIL_DIR=$MAIL_DIR $NOTMUCH_RUBY -I "$NOTMUCH_BUILDDIR/bindings/ruby"> OUTPUT -} - test_C () { local exec_file test_file exec_file="test${test_count}" diff --git a/vim/notmuch.vim b/vim/notmuch.vim index 541698cd..c1c2f63d 100644 --- a/vim/notmuch.vim +++ b/vim/notmuch.vim @@ -317,6 +317,9 @@ ruby << EOF $curbuf.render do |b| q = $curbuf.query(get_cur_view) q.sort = Notmuch::SORT_OLDEST_FIRST + $exclude_tags.each { |t| + q.add_tag_exclude(t) + } msgs = q.search_messages msgs.each do |msg| m = Mail.read(msg.filename)