unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test
@ 2020-07-30  0:01 David Bremner
  2020-07-30  0:01 ` [PATCH 2/2] test: drop use of db_ending David Bremner
  2020-07-31 17:38 ` [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test Tomi Ollila
  0 siblings, 2 replies; 4+ messages in thread
From: David Bremner @ 2020-07-30  0:01 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

Inspired by the suggestion of

         id:20200727154108.16269-3-congdanhqx@gmail.com

to drop the configuration test for the default backend. This version
is hopefully robust against backend changes.
---
 test/T360-symbol-hiding.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
index 43921cb4..4f1eb605 100755
--- a/test/T360-symbol-hiding.sh
+++ b/test/T360-symbol-hiding.sh
@@ -14,11 +14,11 @@ test_description='exception symbol hiding'
 test_begin_subtest 'running test' run_test
 mkdir -p ${PWD}/fakedb/.notmuch
 $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \
-	| notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT
+        | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,No [^ \t]* database,No XXXXXX database,g" > OUTPUT
 
 cat <<EOF > EXPECTED
 A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
-caught No backend database found at path 'CWD/nonexistent'
+caught No XXXXXX database found at path 'CWD/nonexistent'
 EOF
 test_expect_equal_file EXPECTED OUTPUT
 
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] test: drop use of db_ending
  2020-07-30  0:01 [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test David Bremner
@ 2020-07-30  0:01 ` David Bremner
  2020-07-31 17:38 ` [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test Tomi Ollila
  1 sibling, 0 replies; 4+ messages in thread
From: David Bremner @ 2020-07-30  0:01 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

This will allow the dropping of the test for the default ending from
configure.
---
 test/T050-new.sh       |  4 ++--
 test/T060-count.sh     |  5 +++--
 test/T150-tagging.sh   |  4 ++--
 test/T560-lib-error.sh | 14 +++++++-------
 test/test-lib.sh       | 11 -----------
 5 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/test/T050-new.sh b/test/T050-new.sh
index dfc8508f..009b2633 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -341,9 +341,9 @@ notmuch config set new.tags $OLDCONFIG
 
 
 test_begin_subtest "Xapian exception: read only files"
-chmod u-w  ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
+chmod u-w  ${MAIL_DIR}/.notmuch/xapian/*.*
 output=$(NOTMUCH_NEW --debug 2>&1 | sed 's/: .*$//' )
-chmod u+w  ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
+chmod u+w  ${MAIL_DIR}/.notmuch/xapian/*.*
 test_expect_equal "$output" "A Xapian exception occurred opening database"
 
 
diff --git a/test/T060-count.sh b/test/T060-count.sh
index 0c0bf473..a1ebf8ba 100755
--- a/test/T060-count.sh
+++ b/test/T060-count.sh
@@ -95,7 +95,8 @@ test_expect_equal_file EXPECTED OUTPUT
 
 backup_database
 test_begin_subtest "error message for database open"
-dd if=/dev/zero of="${MAIL_DIR}/.notmuch/xapian/postlist.${db_ending}" count=3
+target=(${MAIL_DIR}/.notmuch/xapian/postlist.*)
+dd if=/dev/zero of="$target" count=3
 notmuch count '*' 2>OUTPUT 1>/dev/null
 output=$(sed 's/^\(A Xapian exception [^:]*\):.*$/\1/' OUTPUT)
 test_expect_equal "${output}" "A Xapian exception occurred opening database"
@@ -107,7 +108,7 @@ set logging file count-files-gdb.log
 set logging on
 break count_files
 commands
-shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.${db_ending}
+shell cp /dev/null ${MAIL_DIR}/.notmuch/xapian/postlist.*
 continue
 end
 run
diff --git a/test/T150-tagging.sh b/test/T150-tagging.sh
index 208b4b98..2f0b3531 100755
--- a/test/T150-tagging.sh
+++ b/test/T150-tagging.sh
@@ -305,9 +305,9 @@ test_begin_subtest "Tag name beginning with -"
 test_expect_code 1 'notmuch tag +- One'
 
 test_begin_subtest "Xapian exception: read only files"
-chmod u-w  ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
+chmod u-w  ${MAIL_DIR}/.notmuch/xapian/*.*
 output=$(notmuch tag +something '*' 2>&1 | sed 's/: .*$//' )
-chmod u+w  ${MAIL_DIR}/.notmuch/xapian/*.${db_ending}
+chmod u+w  ${MAIL_DIR}/.notmuch/xapian/*.*
 test_expect_equal "$output" "A Xapian exception occurred opening database"
 
 test_done
diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh
index 70df292a..260ac120 100755
--- a/test/T560-lib-error.sh
+++ b/test/T560-lib-error.sh
@@ -211,8 +211,7 @@ int main (int argc, char** argv)
      fprintf (stderr, "error opening database: %d %s\n", stat, msg ? msg : "");
      exit (1);
    }
-   path = talloc_asprintf (db, "%s/.notmuch/xapian/postlist.${db_ending}", argv[1]);
-   fd = open(path,O_WRONLY|O_TRUNC);
+   fd = open(argv[2],O_WRONLY|O_TRUNC);
    if (fd < 0) {
        fprintf (stderr, "error opening %s\n", argv[1]);
        exit (1);
@@ -228,9 +227,10 @@ cat <<'EOF' > c_tail
 }
 EOF
 
+POSTLIST_PATH=(${MAIL_DIR}/.notmuch/xapian/postlist.*)
 backup_database
 test_begin_subtest "Xapian exception finding message"
-cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${POSTLIST_PATH}
    {
        notmuch_message_t *message = NULL;
        stat = notmuch_database_find_message (db, "id:nonexistent", &message);
@@ -247,7 +247,7 @@ restore_database
 
 backup_database
 test_begin_subtest "Xapian exception getting tags"
-cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${POSTLIST_PATH}
    {
        notmuch_tags_t *tags = NULL;
        tags = notmuch_database_get_all_tags (db);
@@ -265,7 +265,7 @@ restore_database
 
 backup_database
 test_begin_subtest "Xapian exception creating directory"
-cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${POSTLIST_PATH}
    {
        notmuch_directory_t *directory = NULL;
        stat = notmuch_database_get_directory (db, "none/existing", &directory);
@@ -282,7 +282,7 @@ restore_database
 
 backup_database
 test_begin_subtest "Xapian exception searching messages"
-cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${POSTLIST_PATH}
    {
        notmuch_messages_t *messages = NULL;
        notmuch_query_t *query=notmuch_query_create (db, "*");
@@ -301,7 +301,7 @@ restore_database
 
 backup_database
 test_begin_subtest "Xapian exception counting messages"
-cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR} ${POSTLIST_PATH}
    {
        int count;
        notmuch_query_t *query=notmuch_query_create (db, "id:87ocn0qh6d.fsf@yoom.home.cworth.org");
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 31c858d1..527c9e8b 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1261,17 +1261,6 @@ test -z "$NO_PYTHON" && test_set_prereq PYTHON
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
 rm -f y
 
-# convert variable from configure to more convenient form
-case "$NOTMUCH_DEFAULT_XAPIAN_BACKEND" in
-    glass)
-	db_ending=glass
-    ;;
-    chert)
-	db_ending=DB
-    ;;
-    *)
-	error "Unknown Xapian backend $NOTMUCH_DEFAULT_XAPIAN_BACKEND"
-esac
 # declare prerequisites for external binaries used in tests
 test_declare_external_prereq dtach
 test_declare_external_prereq emacs
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test
  2020-07-30  0:01 [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test David Bremner
  2020-07-30  0:01 ` [PATCH 2/2] test: drop use of db_ending David Bremner
@ 2020-07-31 17:38 ` Tomi Ollila
  2020-08-01 23:35   ` David Bremner
  1 sibling, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2020-07-31 17:38 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: David Bremner

On Wed, Jul 29 2020, David Bremner wrote:

> Inspired by the suggestion of
>
>          id:20200727154108.16269-3-congdanhqx@gmail.com
>
> to drop the configuration test for the default backend. This version
> is hopefully robust against backend changes.
> ---
>  test/T360-symbol-hiding.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/test/T360-symbol-hiding.sh b/test/T360-symbol-hiding.sh
> index 43921cb4..4f1eb605 100755
> --- a/test/T360-symbol-hiding.sh
> +++ b/test/T360-symbol-hiding.sh
> @@ -14,11 +14,11 @@ test_description='exception symbol hiding'
>  test_begin_subtest 'running test' run_test
>  mkdir -p ${PWD}/fakedb/.notmuch
>  $TEST_DIRECTORY/symbol-test ${PWD}/fakedb ${PWD}/nonexistent 2>&1 \
> -	| notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT
> +        | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,No [^ \t]* database,No XXXXXX database,g" > OUTPUT

Restore lost tab in the beginning of line, use [^[:space:]] for portability

Tomi

>  
>  cat <<EOF > EXPECTED
>  A Xapian exception occurred opening database: Couldn't stat 'CWD/fakedb/.notmuch/xapian'
> -caught No backend database found at path 'CWD/nonexistent'
> +caught No XXXXXX database found at path 'CWD/nonexistent'
>  EOF
>  test_expect_equal_file EXPECTED OUTPUT
>  
> -- 
> 2.27.0
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test
  2020-07-31 17:38 ` [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test Tomi Ollila
@ 2020-08-01 23:35   ` David Bremner
  0 siblings, 0 replies; 4+ messages in thread
From: David Bremner @ 2020-08-01 23:35 UTC (permalink / raw)
  To: Tomi Ollila, notmuch; +Cc: Danh Doan

Tomi Ollila <tomi.ollila@iki.fi> writes:

> On Wed, Jul 29 2020, David Bremner wrote:
>> -	| notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,${NOTMUCH_DEFAULT_XAPIAN_BACKEND},backend,g" > OUTPUT
>> +        | notmuch_dir_sanitize | sed -e "s,\`,\',g" -e "s,No [^ \t]* database,No XXXXXX database,g" > OUTPUT
>
> Restore lost tab in the beginning of line, use [^[:space:]] for portability

done, and both applied to master. Danh, you can respin your series
against master now (with the one patch dropped as we discussed).

d

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-01 23:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30  0:01 [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test David Bremner
2020-07-30  0:01 ` [PATCH 2/2] test: drop use of db_ending David Bremner
2020-07-31 17:38 ` [PATCH 1/2] test: drop NOTMUCH_DEFAULT_XAPIAN_BACKEND from T360-symbol-test Tomi Ollila
2020-08-01 23:35   ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).