unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Build and test ruby bindings
@ 2015-01-01 12:16 David Bremner
  2015-01-01 12:16 ` [PATCH 1/5] build: integrate building ruby bindings into notmuch build process David Bremner
                   ` (4 more replies)
  0 siblings, 5 replies; 42+ messages in thread
From: David Bremner @ 2015-01-01 12:16 UTC (permalink / raw)
  To: notmuch

This series collects some patches that were originally part of the
"count API change" series, and adds a few fixups that are designed to
help with building in MacOS and other non-Gnu places (although they
haven't been tested there yet).

[PATCH 1/5] build: integrate building ruby bindings into notmuch

- obsoletes id:1419971380-10307-2-git-send-email-david@tethera.net

[PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable
[PATCH 4/5] build/ruby: use notmuch configure script values for

- These two obsolete (I think)

  id:1416170906-23415-1-git-send-email-ll-notmuchmail@lange.nom.fr

[PATCH 5/5] test: add initial ruby tests

This obsoletes id:1419971380-10307-4-git-send-email-david@tethera.net

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

* [PATCH 1/5] build: integrate building ruby bindings into notmuch build process
  2015-01-01 12:16 Build and test ruby bindings David Bremner
@ 2015-01-01 12:16 ` David Bremner
  2015-01-01 12:16 ` [PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-01-01 12:16 UTC (permalink / raw)
  To: notmuch

Because ruby generates a Makefile, we have to use recursive make.
Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
in the parent directory.
---
 Makefile.local          |  2 +-
 bindings/Makefile       |  7 +++++++
 bindings/Makefile.local | 18 ++++++++++++++++++
 bindings/ruby/README    |  8 ++++++++
 configure               | 18 ++++++++++++++++++
 debian/rules            |  1 -
 6 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 bindings/Makefile
 create mode 100644 bindings/Makefile.local
 create mode 100644 bindings/ruby/README

diff --git a/Makefile.local b/Makefile.local
index 81ee347..7204267 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -59,7 +59,7 @@ endif
 FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)
 
 .PHONY: all
-all: notmuch notmuch-shared build-man
+all: notmuch notmuch-shared build-man ruby-bindings
 ifeq ($(MAKECMDGOALS),)
 ifeq ($(shell cat .first-build-message 2>/dev/null),)
 	@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
diff --git a/bindings/Makefile b/bindings/Makefile
new file mode 100644
index 0000000..de492a7
--- /dev/null
+++ b/bindings/Makefile
@@ -0,0 +1,7 @@
+# See Makefile.local for the list of files to be compiled in this
+# directory.
+all:
+	$(MAKE) -C .. all
+
+.DEFAULT:
+	$(MAKE) -C .. $@
diff --git a/bindings/Makefile.local b/bindings/Makefile.local
new file mode 100644
index 0000000..6ed1344
--- /dev/null
+++ b/bindings/Makefile.local
@@ -0,0 +1,18 @@
+# -*- makefile -*-
+
+dir := bindings
+
+# force the shared library to be build
+ruby-bindings: lib/libnotmuch.so
+ifeq ($(HAVE_RUBY_DEV),1)
+	cd $(dir)/ruby && ruby extconf.rb --vendor
+	$(MAKE) -C $(dir)/ruby
+else
+	@echo Missing dependency, skipping ruby bindings
+endif
+
+CLEAN += $(patsubst %,$(dir)/ruby/%, \
+	Makefile database.o directory.o filenames.o\
+	init.o message.o messages.o mkmf.log notmuch.so query.o \
+	status.o tags.o thread.o threads.o)
+
diff --git a/bindings/ruby/README b/bindings/ruby/README
new file mode 100644
index 0000000..6bb8cb2
--- /dev/null
+++ b/bindings/ruby/README
@@ -0,0 +1,8 @@
+To build the the notmuch ruby extensions, run the following commands
+from the *top level* notmuch source directory:
+
+% ./configure
+% make ruby-bindings
+
+The generic documentation about building notmuch also applies.
+
diff --git a/configure b/configure
index d14e7d1..7df3b29 100755
--- a/configure
+++ b/configure
@@ -21,6 +21,7 @@ srcdir=$(dirname "$0")
 
 subdirs="util compat lib parse-time-string completion doc emacs"
 subdirs="${subdirs} performance-test test test/test-databases"
+subdirs="${subdirs} bindings"
 
 # For a non-srcdir configure invocation (such as ../configure), create
 # the directory structure and copy Makefiles.
@@ -426,6 +427,15 @@ else
     have_doxygen=0
 fi
 
+printf "Checking for ruby development files... "
+if ruby -e "require 'mkmf'"> /dev/null 2>&1; then
+    printf "Yes.\n"
+    have_ruby_dev=1
+else
+    printf "No (skipping ruby bindings)\n"
+    have_ruby_dev=0
+fi
+
 printf "Checking if sphinx is available and supports nroff output... "
 if hash sphinx-build > /dev/null 2>&1 && python -m sphinx.writers.manpage > /dev/null 2>&1 ; then
     printf "Yes.\n"
@@ -848,6 +858,10 @@ HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name}
 # build its own version)
 HAVE_GETLINE = ${have_getline}
 
+# Are the ruby development files (and ruby) available? If not skip
+# building/testing ruby bindings.
+HAVE_RUBY_DEV = ${have_ruby_dev}
+
 # Whether the strcasestr function is available (if not, then notmuch will
 # build its own version)
 HAVE_STRCASESTR = ${have_strcasestr}
@@ -958,6 +972,10 @@ NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
 # Whether there's either sphinx or rst2man available for building
 # documentation
 NOTMUCH_HAVE_MAN=$((have_sphinx || have_rst2man))
+
+# Are the ruby development files (and ruby) available? If not skip
+# building/testing ruby bindings.
+NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
 EOF
 
 # Finally, after everything configured, inform the user how to continue.
diff --git a/debian/rules b/debian/rules
index 7a19445..ca85bc7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,7 +12,6 @@ override_dh_auto_build:
 	dh_auto_build -- V=1
 	dh_auto_build --sourcedirectory bindings/python
 	cd bindings/python && $(python3_all) setup.py build
-	cd bindings/ruby && ruby extconf.rb --vendor && make
 	$(MAKE) -C contrib/notmuch-mutt
 
 override_dh_auto_clean:
-- 
2.1.3

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

* [PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable
  2015-01-01 12:16 Build and test ruby bindings David Bremner
  2015-01-01 12:16 ` [PATCH 1/5] build: integrate building ruby bindings into notmuch build process David Bremner
@ 2015-01-01 12:16 ` David Bremner
  2015-01-01 12:16 ` [PATCH 3/5] bindings/ruby: gitignore *.o David Bremner
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-01-01 12:16 UTC (permalink / raw)
  To: notmuch

In particular this is supposed to help build on systems (presumably
using a non-gnu ld) where this flag is not available.
---
 bindings/Makefile.local  |  4 +++-
 bindings/ruby/extconf.rb |  5 +++--
 configure                | 13 +++++++++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 6ed1344..210055f 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -5,7 +5,9 @@ dir := bindings
 # force the shared library to be build
 ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
-	cd $(dir)/ruby && ruby extconf.rb --vendor
+	cd $(dir)/ruby && \
+		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 else
 	@echo Missing dependency, skipping ruby bindings
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6160db2..6d5607e 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')
 # includes
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
 
-# make sure there are no undefined symbols
-$LDFLAGS += ' -Wl,--no-undefined'
+if ENV['EXTRA_LDFLAGS']
+  $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
+end
 
 def have_local_library(lib, path, func, headers = nil)
   checking_for checking_message(func, lib) do
diff --git a/configure b/configure
index 7df3b29..1a4c956 100755
--- a/configure
+++ b/configure
@@ -712,6 +712,16 @@ else
     as_needed_ldflags=""
 fi
 
+printf "Checking for -Wl,--no-undefined... "
+if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
+then
+    printf "Yes.\n"
+    no_undefined_ldflags="-Wl,--no-undefined"
+else
+    printf "No (nothing to worry about).\n"
+    no_undefined_ldflags=""
+fi
+
 WARN_CXXFLAGS=""
 printf "Checking for available C++ compiler warning flags... "
 for flag in -Wall -Wextra -Wwrite-strings; do
@@ -916,6 +926,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}
 # Flags needed to have linker link only to necessary libraries
 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
 
+# Flags to have the linker flag undefined symbols in object files
+NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
+
 # Whether valgrind header files are available
 HAVE_VALGRIND = ${have_valgrind}
 
-- 
2.1.3

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

* [PATCH 3/5] bindings/ruby: gitignore *.o
  2015-01-01 12:16 Build and test ruby bindings David Bremner
  2015-01-01 12:16 ` [PATCH 1/5] build: integrate building ruby bindings into notmuch build process David Bremner
  2015-01-01 12:16 ` [PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
@ 2015-01-01 12:16 ` David Bremner
  2015-01-01 15:53   ` David Bremner
  2015-01-01 12:16 ` [PATCH 4/5] build/ruby: use notmuch configure script values for shared lib David Bremner
  2015-01-01 12:16 ` [PATCH 5/5] test: add initial ruby tests David Bremner
  4 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-01-01 12:16 UTC (permalink / raw)
  To: notmuch

---
 bindings/ruby/.gitignore | 1 +
 1 file changed, 1 insertion(+)

diff --git a/bindings/ruby/.gitignore b/bindings/ruby/.gitignore
index fa25752..d682798 100644
--- a/bindings/ruby/.gitignore
+++ b/bindings/ruby/.gitignore
@@ -4,3 +4,4 @@
 Makefile
 mkmf.log
 notmuch.so
+*.o
-- 
2.1.3

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

* [PATCH 4/5] build/ruby: use notmuch configure script values for shared lib
  2015-01-01 12:16 Build and test ruby bindings David Bremner
                   ` (2 preceding siblings ...)
  2015-01-01 12:16 ` [PATCH 3/5] bindings/ruby: gitignore *.o David Bremner
@ 2015-01-01 12:16 ` David Bremner
  2015-01-01 12:16 ` [PATCH 5/5] test: add initial ruby tests David Bremner
  4 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-01-01 12:16 UTC (permalink / raw)
  To: notmuch

This is supposed to help build on systems like MacOS with different
conventions for naming shared libraries. We have already computed the
relevant names, so doing it again in ruby seems like a bad idea.
---
 bindings/Makefile.local  |  1 +
 bindings/ruby/extconf.rb | 13 +++----------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 210055f..4d86e59 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -7,6 +7,7 @@ ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
 	cd $(dir)/ruby && \
 		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
 		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 else
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6d5607e..ddaa684 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -14,19 +14,12 @@ if ENV['EXTRA_LDFLAGS']
   $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
 end
 
-def have_local_library(lib, path, func, headers = nil)
-  checking_for checking_message(func, lib) do
-    lib = File.join(path, lib)
-    if try_func(func, lib, headers)
-      $LOCAL_LIBS += lib
-    end
-  end
-end
-
-if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')
+if not ENV['LIBNOTMUCH']
   exit 1
 end
 
+$LOCAL_LIBS += ENV['LIBNOTMUCH']
+
 # Create Makefile
 dir_config('notmuch')
 create_makefile('notmuch')
-- 
2.1.3

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

* [PATCH 5/5] test: add initial ruby tests
  2015-01-01 12:16 Build and test ruby bindings David Bremner
                   ` (3 preceding siblings ...)
  2015-01-01 12:16 ` [PATCH 4/5] build/ruby: use notmuch configure script values for shared lib David Bremner
@ 2015-01-01 12:16 ` David Bremner
  2015-03-06 21:57   ` integrate ruby into build and test v2 David Bremner
  4 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-01-01 12:16 UTC (permalink / raw)
  To: notmuch

This is pretty much a line by line translation of the existing python
tests, with two new tests for the count API.
---
 test/T395-ruby.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 test/test-lib.sh  |  5 ++++
 2 files changed, 91 insertions(+)
 create mode 100755 test/T395-ruby.sh

diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
new file mode 100755
index 0000000..6b89a5d
--- /dev/null
+++ b/test/T395-ruby.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+test_description="ruby bindings"
+. ./test-lib.sh
+
+if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
+    test_subtest_missing_external_prereq_["ruby development files"]=t
+fi
+
+add_email_corpus
+
+test_begin_subtest "compare thread ids"
+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"
+end
+EOF
+notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "compare message ids"
+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"
+end
+EOF
+notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "get non-existent file"
+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)
+EOF
+test_expect_equal "$(cat OUTPUT)" "true"
+
+test_begin_subtest "count messages"
+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"
+EOF
+notmuch count --output=messages tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "count messages"
+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"
+EOF
+notmuch count --output=threads tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_done
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 53db9ca..3bbdc03 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1156,6 +1156,11 @@ test_python() {
 		| $cmd -
 }
 
+test_ruby() {
+    export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
+    MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
+}
+
 # Creates a script that counts how much time it is executed and calls
 # notmuch.  $notmuch_counter_command is set to the path to the
 # generated script.  Use notmuch_counter_value() function to get the
-- 
2.1.3

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

* Re: [PATCH 3/5] bindings/ruby: gitignore *.o
  2015-01-01 12:16 ` [PATCH 3/5] bindings/ruby: gitignore *.o David Bremner
@ 2015-01-01 15:53   ` David Bremner
  0 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-01-01 15:53 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> ---
>  bindings/ruby/.gitignore | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/bindings/ruby/.gitignore b/bindings/ruby/.gitignore
> index fa25752..d682798 100644
> --- a/bindings/ruby/.gitignore
> +++ b/bindings/ruby/.gitignore
> @@ -4,3 +4,4 @@
>  Makefile
>  mkmf.log
>  notmuch.so
> +*.o
> -- 
> 2.1.3

Pushed this one trivial patch.

d

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

* integrate ruby into build and test v2
  2015-01-01 12:16 ` [PATCH 5/5] test: add initial ruby tests David Bremner
@ 2015-03-06 21:57   ` David Bremner
  2015-03-06 21:57     ` [Patch v2 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
                       ` (3 more replies)
  0 siblings, 4 replies; 42+ messages in thread
From: David Bremner @ 2015-03-06 21:57 UTC (permalink / raw)
  To: notmuch

This is just a rebase against current master, with one typo fix in
bindings/ruby/README

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

* [Patch v2 1/4] build: integrate building ruby bindings into notmuch build process
  2015-03-06 21:57   ` integrate ruby into build and test v2 David Bremner
@ 2015-03-06 21:57     ` David Bremner
  2015-03-06 21:57     ` [Patch v2 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-03-06 21:57 UTC (permalink / raw)
  To: notmuch

Because ruby generates a Makefile, we have to use recursive make.
Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
in the parent directory.
---
 Makefile.local          |  2 +-
 bindings/Makefile       |  7 +++++++
 bindings/Makefile.local | 18 ++++++++++++++++++
 bindings/ruby/README    |  8 ++++++++
 configure               | 18 ++++++++++++++++++
 debian/rules            |  1 -
 6 files changed, 52 insertions(+), 2 deletions(-)
 create mode 100644 bindings/Makefile
 create mode 100644 bindings/Makefile.local
 create mode 100644 bindings/ruby/README

diff --git a/Makefile.local b/Makefile.local
index 81ee347..7204267 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -59,7 +59,7 @@ endif
 FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)
 
 .PHONY: all
-all: notmuch notmuch-shared build-man
+all: notmuch notmuch-shared build-man ruby-bindings
 ifeq ($(MAKECMDGOALS),)
 ifeq ($(shell cat .first-build-message 2>/dev/null),)
 	@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
diff --git a/bindings/Makefile b/bindings/Makefile
new file mode 100644
index 0000000..de492a7
--- /dev/null
+++ b/bindings/Makefile
@@ -0,0 +1,7 @@
+# See Makefile.local for the list of files to be compiled in this
+# directory.
+all:
+	$(MAKE) -C .. all
+
+.DEFAULT:
+	$(MAKE) -C .. $@
diff --git a/bindings/Makefile.local b/bindings/Makefile.local
new file mode 100644
index 0000000..6ed1344
--- /dev/null
+++ b/bindings/Makefile.local
@@ -0,0 +1,18 @@
+# -*- makefile -*-
+
+dir := bindings
+
+# force the shared library to be build
+ruby-bindings: lib/libnotmuch.so
+ifeq ($(HAVE_RUBY_DEV),1)
+	cd $(dir)/ruby && ruby extconf.rb --vendor
+	$(MAKE) -C $(dir)/ruby
+else
+	@echo Missing dependency, skipping ruby bindings
+endif
+
+CLEAN += $(patsubst %,$(dir)/ruby/%, \
+	Makefile database.o directory.o filenames.o\
+	init.o message.o messages.o mkmf.log notmuch.so query.o \
+	status.o tags.o thread.o threads.o)
+
diff --git a/bindings/ruby/README b/bindings/ruby/README
new file mode 100644
index 0000000..fe4ff89
--- /dev/null
+++ b/bindings/ruby/README
@@ -0,0 +1,8 @@
+To build the the notmuch ruby extension, run the following commands
+from the *top level* notmuch source directory:
+
+% ./configure
+% make ruby-bindings
+
+The generic documentation about building notmuch also applies.
+
diff --git a/configure b/configure
index 4af7ba9..3ca9bed 100755
--- a/configure
+++ b/configure
@@ -21,6 +21,7 @@ srcdir=$(dirname "$0")
 
 subdirs="util compat lib parse-time-string completion doc emacs"
 subdirs="${subdirs} performance-test test test/test-databases"
+subdirs="${subdirs} bindings"
 
 # For a non-srcdir configure invocation (such as ../configure), create
 # the directory structure and copy Makefiles.
@@ -443,6 +444,15 @@ else
     have_doxygen=0
 fi
 
+printf "Checking for ruby development files... "
+if ruby -e "require 'mkmf'"> /dev/null 2>&1; then
+    printf "Yes.\n"
+    have_ruby_dev=1
+else
+    printf "No (skipping ruby bindings)\n"
+    have_ruby_dev=0
+fi
+
 printf "Checking if sphinx is available and supports nroff output... "
 if command -v sphinx-build > /dev/null && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then
     printf "Yes.\n"
@@ -858,6 +868,10 @@ HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name}
 # build its own version)
 HAVE_GETLINE = ${have_getline}
 
+# Are the ruby development files (and ruby) available? If not skip
+# building/testing ruby bindings.
+HAVE_RUBY_DEV = ${have_ruby_dev}
+
 # Whether the strcasestr function is available (if not, then notmuch will
 # build its own version)
 HAVE_STRCASESTR = ${have_strcasestr}
@@ -970,6 +984,10 @@ NOTMUCH_HAVE_MAN=$((have_sphinx))
 
 # Name of python interpreter
 NOTMUCH_PYTHON=${python}
+
+# Are the ruby development files (and ruby) available? If not skip
+# building/testing ruby bindings.
+NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
 EOF
 
 # Finally, after everything configured, inform the user how to continue.
diff --git a/debian/rules b/debian/rules
index 7a19445..ca85bc7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -12,7 +12,6 @@ override_dh_auto_build:
 	dh_auto_build -- V=1
 	dh_auto_build --sourcedirectory bindings/python
 	cd bindings/python && $(python3_all) setup.py build
-	cd bindings/ruby && ruby extconf.rb --vendor && make
 	$(MAKE) -C contrib/notmuch-mutt
 
 override_dh_auto_clean:
-- 
2.1.4

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

* [Patch v2 2/4] build/ruby: make use of -Wl,--no-undefined configurable
  2015-03-06 21:57   ` integrate ruby into build and test v2 David Bremner
  2015-03-06 21:57     ` [Patch v2 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
@ 2015-03-06 21:57     ` David Bremner
  2015-03-06 21:57     ` [Patch v2 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
  2015-03-06 21:57     ` [Patch v2 4/4] test: add initial ruby tests David Bremner
  3 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-03-06 21:57 UTC (permalink / raw)
  To: notmuch

In particular this is supposed to help build on systems (presumably
using a non-gnu ld) where this flag is not available.
---
 bindings/Makefile.local  |  4 +++-
 bindings/ruby/extconf.rb |  5 +++--
 configure                | 13 +++++++++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 6ed1344..210055f 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -5,7 +5,9 @@ dir := bindings
 # force the shared library to be build
 ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
-	cd $(dir)/ruby && ruby extconf.rb --vendor
+	cd $(dir)/ruby && \
+		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 else
 	@echo Missing dependency, skipping ruby bindings
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6160db2..6d5607e 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')
 # includes
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
 
-# make sure there are no undefined symbols
-$LDFLAGS += ' -Wl,--no-undefined'
+if ENV['EXTRA_LDFLAGS']
+  $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
+end
 
 def have_local_library(lib, path, func, headers = nil)
   checking_for checking_message(func, lib) do
diff --git a/configure b/configure
index 3ca9bed..409bb60 100755
--- a/configure
+++ b/configure
@@ -722,6 +722,16 @@ else
     as_needed_ldflags=""
 fi
 
+printf "Checking for -Wl,--no-undefined... "
+if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
+then
+    printf "Yes.\n"
+    no_undefined_ldflags="-Wl,--no-undefined"
+else
+    printf "No (nothing to worry about).\n"
+    no_undefined_ldflags=""
+fi
+
 WARN_CXXFLAGS=""
 printf "Checking for available C++ compiler warning flags... "
 for flag in -Wall -Wextra -Wwrite-strings; do
@@ -926,6 +936,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}
 # Flags needed to have linker link only to necessary libraries
 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
 
+# Flags to have the linker flag undefined symbols in object files
+NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
+
 # Whether valgrind header files are available
 HAVE_VALGRIND = ${have_valgrind}
 
-- 
2.1.4

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

* [Patch v2 3/4] build/ruby: use notmuch configure script values for shared lib
  2015-03-06 21:57   ` integrate ruby into build and test v2 David Bremner
  2015-03-06 21:57     ` [Patch v2 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
  2015-03-06 21:57     ` [Patch v2 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
@ 2015-03-06 21:57     ` David Bremner
  2015-03-06 21:57     ` [Patch v2 4/4] test: add initial ruby tests David Bremner
  3 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-03-06 21:57 UTC (permalink / raw)
  To: notmuch

This is supposed to help build on systems like MacOS with different
conventions for naming shared libraries. We have already computed the
relevant names, so doing it again in ruby seems like a bad idea.
---
 bindings/Makefile.local  |  1 +
 bindings/ruby/extconf.rb | 13 +++----------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 210055f..4d86e59 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -7,6 +7,7 @@ ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
 	cd $(dir)/ruby && \
 		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
 		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 else
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6d5607e..ddaa684 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -14,19 +14,12 @@ if ENV['EXTRA_LDFLAGS']
   $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
 end
 
-def have_local_library(lib, path, func, headers = nil)
-  checking_for checking_message(func, lib) do
-    lib = File.join(path, lib)
-    if try_func(func, lib, headers)
-      $LOCAL_LIBS += lib
-    end
-  end
-end
-
-if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')
+if not ENV['LIBNOTMUCH']
   exit 1
 end
 
+$LOCAL_LIBS += ENV['LIBNOTMUCH']
+
 # Create Makefile
 dir_config('notmuch')
 create_makefile('notmuch')
-- 
2.1.4

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

* [Patch v2 4/4] test: add initial ruby tests
  2015-03-06 21:57   ` integrate ruby into build and test v2 David Bremner
                       ` (2 preceding siblings ...)
  2015-03-06 21:57     ` [Patch v2 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
@ 2015-03-06 21:57     ` David Bremner
  2015-06-01  7:08       ` Build ruby bindings: round 3 David Bremner
  3 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-03-06 21:57 UTC (permalink / raw)
  To: notmuch

This is pretty much a line by line translation of the existing python
tests, with two new tests for the count API.
---
 test/T395-ruby.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 test/test-lib.sh  |  5 ++++
 2 files changed, 91 insertions(+)
 create mode 100755 test/T395-ruby.sh

diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
new file mode 100755
index 0000000..6b89a5d
--- /dev/null
+++ b/test/T395-ruby.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+test_description="ruby bindings"
+. ./test-lib.sh
+
+if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
+    test_subtest_missing_external_prereq_["ruby development files"]=t
+fi
+
+add_email_corpus
+
+test_begin_subtest "compare thread ids"
+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"
+end
+EOF
+notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "compare message ids"
+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"
+end
+EOF
+notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "get non-existent file"
+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)
+EOF
+test_expect_equal "$(cat OUTPUT)" "true"
+
+test_begin_subtest "count messages"
+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"
+EOF
+notmuch count --output=messages tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "count messages"
+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"
+EOF
+notmuch count --output=threads tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_done
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 133fbe4..92c6d28 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1161,6 +1161,11 @@ test_python() {
 		| $cmd -
 }
 
+test_ruby() {
+    export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
+    MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
+}
+
 # Creates a script that counts how much time it is executed and calls
 # notmuch.  $notmuch_counter_command is set to the path to the
 # generated script.  Use notmuch_counter_value() function to get the
-- 
2.1.4

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

* Build ruby bindings: round 3
  2015-03-06 21:57     ` [Patch v2 4/4] test: add initial ruby tests David Bremner
@ 2015-06-01  7:08       ` David Bremner
  2015-06-01  7:08         ` [patch v3 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
                           ` (3 more replies)
  0 siblings, 4 replies; 42+ messages in thread
From: David Bremner @ 2015-06-01  7:08 UTC (permalink / raw)
  To: David Bremner, notmuch


I cleaned up a few typos, and rebased against master.

The main functional change was adding .RUBYARCHDIR.time to the list of
files to clean; leaving this timestamp in place broke the
debian-snapshot target, among other things.

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

* [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-01  7:08       ` Build ruby bindings: round 3 David Bremner
@ 2015-06-01  7:08         ` David Bremner
  2015-06-13  6:37           ` David Bremner
  2015-06-01  7:09         ` [patch v3 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-06-01  7:08 UTC (permalink / raw)
  To: David Bremner, notmuch

Because ruby generates a Makefile, we have to use recursive make.
Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
in the parent directory.
---
 Makefile.local          |  2 +-
 bindings/Makefile       |  7 +++++++
 bindings/Makefile.local | 19 +++++++++++++++++++
 bindings/ruby/README    |  8 ++++++++
 configure               | 18 ++++++++++++++++++
 debian/rules            |  1 -
 6 files changed, 53 insertions(+), 2 deletions(-)
 create mode 100644 bindings/Makefile
 create mode 100644 bindings/Makefile.local
 create mode 100644 bindings/ruby/README

diff --git a/Makefile.local b/Makefile.local
index 6d54742..61a9c4c 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -59,7 +59,7 @@ endif
 FINAL_LIBNOTMUCH_LDFLAGS = $(LDFLAGS) $(AS_NEEDED_LDFLAGS) $(CONFIGURE_LDFLAGS)
 
 .PHONY: all
-all: notmuch notmuch-shared build-man
+all: notmuch notmuch-shared build-man ruby-bindings
 ifeq ($(MAKECMDGOALS),)
 ifeq ($(shell cat .first-build-message 2>/dev/null),)
 	@NOTMUCH_FIRST_BUILD=1 $(MAKE) --no-print-directory all
diff --git a/bindings/Makefile b/bindings/Makefile
new file mode 100644
index 0000000..de492a7
--- /dev/null
+++ b/bindings/Makefile
@@ -0,0 +1,7 @@
+# See Makefile.local for the list of files to be compiled in this
+# directory.
+all:
+	$(MAKE) -C .. all
+
+.DEFAULT:
+	$(MAKE) -C .. $@
diff --git a/bindings/Makefile.local b/bindings/Makefile.local
new file mode 100644
index 0000000..e0b0bf0
--- /dev/null
+++ b/bindings/Makefile.local
@@ -0,0 +1,19 @@
+# -*- makefile -*-
+
+dir := bindings
+
+# force the shared library to be built
+ruby-bindings: lib/libnotmuch.so
+ifeq ($(HAVE_RUBY_DEV),1)
+	cd $(dir)/ruby && ruby extconf.rb --vendor
+	$(MAKE) -C $(dir)/ruby
+else
+	@echo Missing dependency, skipping ruby bindings
+endif
+
+CLEAN += $(patsubst %,$(dir)/ruby/%, \
+	.RUBYARCHDIR.time \
+	Makefile database.o directory.o filenames.o\
+	init.o message.o messages.o mkmf.log notmuch.so query.o \
+	status.o tags.o thread.o threads.o)
+
diff --git a/bindings/ruby/README b/bindings/ruby/README
new file mode 100644
index 0000000..fe4ff89
--- /dev/null
+++ b/bindings/ruby/README
@@ -0,0 +1,8 @@
+To build the the notmuch ruby extension, run the following commands
+from the *top level* notmuch source directory:
+
+% ./configure
+% make ruby-bindings
+
+The generic documentation about building notmuch also applies.
+
diff --git a/configure b/configure
index 2065fcd..5a862b1 100755
--- a/configure
+++ b/configure
@@ -21,6 +21,7 @@ srcdir=$(dirname "$0")
 
 subdirs="util compat lib parse-time-string completion doc emacs"
 subdirs="${subdirs} performance-test test test/test-databases"
+subdirs="${subdirs} bindings"
 
 # For a non-srcdir configure invocation (such as ../configure), create
 # the directory structure and copy Makefiles.
@@ -473,6 +474,15 @@ else
     have_doxygen=0
 fi
 
+printf "Checking for ruby development files... "
+if ruby -e "require 'mkmf'"> /dev/null 2>&1; then
+    printf "Yes.\n"
+    have_ruby_dev=1
+else
+    printf "No (skipping ruby bindings)\n"
+    have_ruby_dev=0
+fi
+
 printf "Checking if sphinx is available and supports nroff output... "
 if command -v sphinx-build > /dev/null && ${python} -m sphinx.writers.manpage > /dev/null 2>&1 ; then
     printf "Yes.\n"
@@ -886,6 +896,10 @@ HAVE_CANONICALIZE_FILE_NAME = ${have_canonicalize_file_name}
 # build its own version)
 HAVE_GETLINE = ${have_getline}
 
+# Are the ruby development files (and ruby) available? If not skip
+# building/testing ruby bindings.
+HAVE_RUBY_DEV = ${have_ruby_dev}
+
 # Whether the strcasestr function is available (if not, then notmuch will
 # build its own version)
 HAVE_STRCASESTR = ${have_strcasestr}
@@ -998,6 +1012,10 @@ NOTMUCH_HAVE_MAN=$((have_sphinx))
 
 # Name of python interpreter
 NOTMUCH_PYTHON=${python}
+
+# Are the ruby development files (and ruby) available? If not skip
+# building/testing ruby bindings.
+NOTMUCH_HAVE_RUBY_DEV=${have_ruby_dev}
 EOF
 
 # Finally, after everything configured, inform the user how to continue.
diff --git a/debian/rules b/debian/rules
index 56378ec..04f0062 100755
--- a/debian/rules
+++ b/debian/rules
@@ -19,7 +19,6 @@ override_dh_auto_build:
 	dh_auto_build -- V=1
 	dh_auto_build --sourcedirectory bindings/python
 	cd bindings/python && $(python3_all) setup.py build
-	cd bindings/ruby && ruby extconf.rb --vendor && make
 	$(MAKE) -C contrib/notmuch-mutt
 
 override_dh_auto_clean:
-- 
2.1.4

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

* [patch v3 2/4] build/ruby: make use of -Wl,--no-undefined configurable
  2015-06-01  7:08       ` Build ruby bindings: round 3 David Bremner
  2015-06-01  7:08         ` [patch v3 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
@ 2015-06-01  7:09         ` David Bremner
  2015-06-14  5:58           ` [PATCH] lib, ruby: " David Bremner
  2015-06-01  7:09         ` [patch v3 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
  2015-06-01  7:09         ` [patch v3 4/4] test: add initial ruby tests David Bremner
  3 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-06-01  7:09 UTC (permalink / raw)
  To: David Bremner, notmuch

In particular this is supposed to help build on systems (presumably
using a non-gnu ld) where this flag is not available.
---
 bindings/Makefile.local  |  4 +++-
 bindings/ruby/extconf.rb |  5 +++--
 configure                | 13 +++++++++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index e0b0bf0..2ad0b86 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -5,7 +5,9 @@ dir := bindings
 # force the shared library to be built
 ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
-	cd $(dir)/ruby && ruby extconf.rb --vendor
+	cd $(dir)/ruby && \
+		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 else
 	@echo Missing dependency, skipping ruby bindings
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6160db2..6d5607e 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')
 # includes
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
 
-# make sure there are no undefined symbols
-$LDFLAGS += ' -Wl,--no-undefined'
+if ENV['EXTRA_LDFLAGS']
+  $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
+end
 
 def have_local_library(lib, path, func, headers = nil)
   checking_for checking_message(func, lib) do
diff --git a/configure b/configure
index 5a862b1..e3b4902 100755
--- a/configure
+++ b/configure
@@ -750,6 +750,16 @@ else
     as_needed_ldflags=""
 fi
 
+printf "Checking for -Wl,--no-undefined... "
+if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
+then
+    printf "Yes.\n"
+    no_undefined_ldflags="-Wl,--no-undefined"
+else
+    printf "No (nothing to worry about).\n"
+    no_undefined_ldflags=""
+fi
+
 WARN_CXXFLAGS=""
 printf "Checking for available C++ compiler warning flags... "
 for flag in -Wall -Wextra -Wwrite-strings; do
@@ -954,6 +964,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}
 # Flags needed to have linker link only to necessary libraries
 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
 
+# Flags to have the linker flag undefined symbols in object files
+NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
+
 # Whether valgrind header files are available
 HAVE_VALGRIND = ${have_valgrind}
 
-- 
2.1.4

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

* [patch v3 3/4] build/ruby: use notmuch configure script values for shared lib
  2015-06-01  7:08       ` Build ruby bindings: round 3 David Bremner
  2015-06-01  7:08         ` [patch v3 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
  2015-06-01  7:09         ` [patch v3 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
@ 2015-06-01  7:09         ` David Bremner
  2015-06-14  6:26           ` [PATCH] " David Bremner
  2015-06-01  7:09         ` [patch v3 4/4] test: add initial ruby tests David Bremner
  3 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-06-01  7:09 UTC (permalink / raw)
  To: David Bremner, notmuch

This is supposed to help build on systems like MacOS with different
conventions for naming shared libraries. We have already computed the
relevant names, so doing it again in ruby seems like a bad idea.
---
 bindings/Makefile.local  |  1 +
 bindings/ruby/extconf.rb | 13 +++----------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 2ad0b86..8b1ff83 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -7,6 +7,7 @@ ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
 	cd $(dir)/ruby && \
 		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
 		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 else
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6d5607e..ddaa684 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -14,19 +14,12 @@ if ENV['EXTRA_LDFLAGS']
   $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
 end
 
-def have_local_library(lib, path, func, headers = nil)
-  checking_for checking_message(func, lib) do
-    lib = File.join(path, lib)
-    if try_func(func, lib, headers)
-      $LOCAL_LIBS += lib
-    end
-  end
-end
-
-if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')
+if not ENV['LIBNOTMUCH']
   exit 1
 end
 
+$LOCAL_LIBS += ENV['LIBNOTMUCH']
+
 # Create Makefile
 dir_config('notmuch')
 create_makefile('notmuch')
-- 
2.1.4

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

* [patch v3 4/4] test: add initial ruby tests
  2015-06-01  7:08       ` Build ruby bindings: round 3 David Bremner
                           ` (2 preceding siblings ...)
  2015-06-01  7:09         ` [patch v3 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
@ 2015-06-01  7:09         ` David Bremner
  3 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-06-01  7:09 UTC (permalink / raw)
  To: David Bremner, notmuch

This is pretty much a line by line translation of the existing python
tests, with two new tests for the count API.
---
 test/T395-ruby.sh | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 test/test-lib.sh  |  5 ++++
 2 files changed, 91 insertions(+)
 create mode 100755 test/T395-ruby.sh

diff --git a/test/T395-ruby.sh b/test/T395-ruby.sh
new file mode 100755
index 0000000..8b8e6d2
--- /dev/null
+++ b/test/T395-ruby.sh
@@ -0,0 +1,86 @@
+#!/usr/bin/env bash
+test_description="ruby bindings"
+. ./test-lib.sh
+
+if [ "${NOTMUCH_HAVE_RUBY_DEV}" = "0" ]; then
+    test_subtest_missing_external_prereq_["ruby development files"]=t
+fi
+
+add_email_corpus
+
+test_begin_subtest "compare thread ids"
+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"
+end
+EOF
+notmuch search --sort=oldest-first --output=threads tag:inbox | sed s/^thread:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "compare message ids"
+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"
+end
+EOF
+notmuch search --sort=oldest-first --output=messages tag:inbox | sed s/^id:// > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "get non-existent file"
+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)
+EOF
+test_expect_equal "$(cat OUTPUT)" "true"
+
+test_begin_subtest "count messages"
+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"
+EOF
+notmuch count --output=messages tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_begin_subtest "count threads"
+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"
+EOF
+notmuch count --output=threads tag:inbox > EXPECTED
+test_expect_equal_file OUTPUT EXPECTED
+
+test_done
diff --git a/test/test-lib.sh b/test/test-lib.sh
index 23085e7..3466e9c 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -1163,6 +1163,11 @@ test_python() {
 		| $cmd -
 }
 
+test_ruby() {
+    export LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib
+    MAIL_DIR=$MAIL_DIR ruby -I $TEST_DIRECTORY/../bindings/ruby> OUTPUT
+}
+
 test_C () {
     exec_file="test${test_count}"
     test_file="${exec_file}.c"
-- 
2.1.4

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-01  7:08         ` [patch v3 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
@ 2015-06-13  6:37           ` David Bremner
  2015-06-13 19:59             ` Jinwoo Lee
  2015-06-15  6:35             ` David Bremner
  0 siblings, 2 replies; 42+ messages in thread
From: David Bremner @ 2015-06-13  6:37 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> Because ruby generates a Makefile, we have to use recursive make.
> Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
> in the parent directory.

Pushed the first patch in the series. Let's see if anything breaks.

d

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13  6:37           ` David Bremner
@ 2015-06-13 19:59             ` Jinwoo Lee
  2015-06-13 20:46               ` Jinwoo Lee
  2015-06-15  6:35             ` David Bremner
  1 sibling, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-13 19:59 UTC (permalink / raw)
  To: David Bremner, notmuch

This breaks Mac OS X.  ruby-bindings depends on lib/libnotmuch.so but it
should be lib/libnotmuch.dylib on OS X.

That makes `make' and `make install' fail.

On Fri, Jun 12, 2015 at 11:37 PM, David Bremner <david@tethera.net> wrote:
> David Bremner <david@tethera.net> writes:
>
>> Because ruby generates a Makefile, we have to use recursive make.
>> Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
>> in the parent directory.
>
> Pushed the first patch in the series. Let's see if anything breaks.
>
> d
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13 19:59             ` Jinwoo Lee
@ 2015-06-13 20:46               ` Jinwoo Lee
  2015-06-13 20:51                 ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-13 20:46 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, Jun 13, 2015 at 12:59 PM, Jinwoo Lee <jinwoo68@gmail.com> wrote:
> This breaks Mac OS X.  ruby-bindings depends on lib/libnotmuch.so but it
> should be lib/libnotmuch.dylib on OS X.
>
> That makes `make' and `make install' fail.

Even after I update the dependency to lib/libnotmuch.dylib, building
ruby-bindings fails because I don't have the ruby development tools
installed on my machine.

I with configure has an option to skip the ruby-bindings build.

>
> On Fri, Jun 12, 2015 at 11:37 PM, David Bremner <david@tethera.net> wrote:
>> David Bremner <david@tethera.net> writes:
>>
>>> Because ruby generates a Makefile, we have to use recursive make.
>>> Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
>>> in the parent directory.
>>
>> Pushed the first patch in the series. Let's see if anything breaks.
>>
>> d
>> _______________________________________________
>> notmuch mailing list
>> notmuch@notmuchmail.org
>> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13 20:46               ` Jinwoo Lee
@ 2015-06-13 20:51                 ` Jinwoo Lee
  2015-06-13 21:11                   ` David Bremner
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-13 20:51 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, Jun 13, 2015 at 01:46 PM, Jinwoo Lee <jinwoo68@gmail.com> wrote:
> On Sat, Jun 13, 2015 at 12:59 PM, Jinwoo Lee <jinwoo68@gmail.com> wrote:
>> This breaks Mac OS X.  ruby-bindings depends on lib/libnotmuch.so but it
>> should be lib/libnotmuch.dylib on OS X.
>>
>> That makes `make' and `make install' fail.
>
> Even after I update the dependency to lib/libnotmuch.dylib, building
> ruby-bindings fails because I don't have the ruby development tools
> installed on my machine.
>
> I with configure has an option to skip the ruby-bindings build.

`configure' seems to try to detect whether the ruby development tools
are installed.  It thinks I have them but I don't actually, and that's
why my build fails.  When I manually set 'HAVE_RUBY_DEV = 0' in
Makefile.config, everything's fine.

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13 20:51                 ` Jinwoo Lee
@ 2015-06-13 21:11                   ` David Bremner
  2015-06-13 21:22                     ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-06-13 21:11 UTC (permalink / raw)
  To: Jinwoo Lee, notmuch

Jinwoo Lee <jinwoo68@gmail.com> writes:

>> I with configure has an option to skip the ruby-bindings build.
>
> `configure' seems to try to detect whether the ruby development tools
> are installed.  It thinks I have them but I don't actually, and that's
> why my build fails.  When I manually set 'HAVE_RUBY_DEV = 0' in
> Makefile.config, everything's fine.

Thanks for narrowing this down. Can you tell us the output of

% ruby -e "require 'mkmf'" ; echo $?

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13 21:11                   ` David Bremner
@ 2015-06-13 21:22                     ` Jinwoo Lee
  2015-06-13 21:24                       ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-13 21:22 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, Jun 13, 2015 at 02:11 PM, David Bremner <david@tethera.net> wrote:
> Jinwoo Lee <jinwoo68@gmail.com> writes:
>
>>> I with configure has an option to skip the ruby-bindings build.
>>
>> `configure' seems to try to detect whether the ruby development tools
>> are installed.  It thinks I have them but I don't actually, and that's
>> why my build fails.  When I manually set 'HAVE_RUBY_DEV = 0' in
>> Makefile.config, everything's fine.
>
> Thanks for narrowing this down. Can you tell us the output of
>
> % ruby -e "require 'mkmf'" ; echo $?

This command succeeds and returns 0.

When I change the dependency of ruby-bindings from libnotmuch.so to
libnotmuch.dylib and run `make', I get errors like below.

Looks like mkmf.rb (I have no idea what this is) is provided by OS X by
default, but actually running it fails.

...
[snip]
...
checking for notmuch_database_create in libnotmuch.so... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
	--with-opt-dir
	--without-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:513:in `block in try_link0'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/tmpdir.rb:88:in `mktmpdir'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:510:in `try_link0'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:720:in `try_func'
	from extconf.rb:19:in `block in have_local_library'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
	from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
	from extconf.rb:17:in `have_local_library'
	from extconf.rb:25:in `<main>'
make: *** [ruby-bindings] Error 1

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13 21:22                     ` Jinwoo Lee
@ 2015-06-13 21:24                       ` Jinwoo Lee
  2015-06-13 21:34                         ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-13 21:24 UTC (permalink / raw)
  To: David Bremner, notmuch

That error is from 'cd bindings/ruby && ruby extconf.rb --vendor' BTW.

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13 21:24                       ` Jinwoo Lee
@ 2015-06-13 21:34                         ` Jinwoo Lee
  2015-06-14  5:49                           ` David Bremner
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-13 21:34 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, Jun 13, 2015 at 02:24 PM, Jinwoo Lee <jinwoo68@gmail.com> wrote:
> That error is from 'cd bindings/ruby && ruby extconf.rb --vendor' BTW.

The contents of mkmf.log are below.  It shows a warning about
-L/usr/local/lib and I don't have the directory /usr/local/lib on my
machine.  I'm not sure if that's the cause of the error though.  I don't
write Ruby and know nothing about it.

"xcrun clang -o conftest -I../../lib -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib -Wl,--no-undefined   -arch x86_64 -arch i386   -lruby.2.0.0  -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L/usr/local/lib'
ld: unknown option: --no-undefined
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13 21:34                         ` Jinwoo Lee
@ 2015-06-14  5:49                           ` David Bremner
  0 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-06-14  5:49 UTC (permalink / raw)
  To: Jinwoo Lee, notmuch

Jinwoo Lee <jinwoo68@gmail.com> writes:


> ld: unknown option: --no-undefined
> clang: error: linker command failed with exit code 1 (use -v to see invocation)

I wonder if this the actual relevant error. Can you try with the next
two patches in the series?

    id:1433142542-2307-3-git-send-email-david@tethera.net
    id:1433142542-2307-4-git-send-email-david@tethera.net
    
This first alone may fix it, but it would be good to know if the next
one breaks anything on Mac OS.

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

* [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-01  7:09         ` [patch v3 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
@ 2015-06-14  5:58           ` David Bremner
  2015-06-14  6:20             ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-06-14  5:58 UTC (permalink / raw)
  To: David Bremner, notmuch

In particular this is supposed to help build on systems (presumably
using a non-gnu ld) where this flag is not available.
---
 bindings/Makefile.local  |  4 +++-
 bindings/ruby/extconf.rb |  5 +++--
 configure                | 13 +++++++++++++
 lib/Makefile.local       |  2 +-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index 16817f5..d236f01 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -5,7 +5,9 @@ dir := bindings
 # force the shared library to be built
 ruby-bindings: lib/libnotmuch.so
 ifeq ($(HAVE_RUBY_DEV),1)
-	cd $(dir)/ruby && ruby extconf.rb --vendor
+	cd $(dir)/ruby && \
+		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 else
 	@echo Missing dependency, skipping ruby bindings
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6160db2..6d5607e 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')
 # includes
 $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
 
-# make sure there are no undefined symbols
-$LDFLAGS += ' -Wl,--no-undefined'
+if ENV['EXTRA_LDFLAGS']
+  $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
+end
 
 def have_local_library(lib, path, func, headers = nil)
   checking_for checking_message(func, lib) do
diff --git a/configure b/configure
index 13a8dca..b967a4e 100755
--- a/configure
+++ b/configure
@@ -751,6 +751,16 @@ else
     as_needed_ldflags=""
 fi
 
+printf "Checking for -Wl,--no-undefined... "
+if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
+then
+    printf "Yes.\n"
+    no_undefined_ldflags="-Wl,--no-undefined"
+else
+    printf "No (nothing to worry about).\n"
+    no_undefined_ldflags=""
+fi
+
 WARN_CXXFLAGS=""
 printf "Checking for available C++ compiler warning flags... "
 for flag in -Wall -Wextra -Wwrite-strings; do
@@ -955,6 +965,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}
 # Flags needed to have linker link only to necessary libraries
 AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
 
+# Flags to have the linker flag undefined symbols in object files
+NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
+
 # Whether valgrind header files are available
 HAVE_VALGRIND = ${have_valgrind}
 
diff --git a/lib/Makefile.local b/lib/Makefile.local
index f9ecd50..b58b4e8 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -33,7 +33,7 @@ LIBRARY_SUFFIX = so
 LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
 SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
 LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
-LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined
+LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) $(NO_UNDEFINED_LDFLAGS)
 ifeq ($(PLATFORM),OPENBSD)
 LIBRARY_LINK_FLAG += -lc
 endif
-- 
2.1.4

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-14  5:58           ` [PATCH] lib, ruby: " David Bremner
@ 2015-06-14  6:20             ` Jinwoo Lee
  2015-06-14  6:53               ` David Bremner
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-14  6:20 UTC (permalink / raw)
  To: David Bremner, David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 1224 bytes --]

There are 2 problems.

1. The file, bindings/Makefile.local still has lib/libnotmuch.so as the
   dependency of ruby-bindings.

> make: *** No rule to make target `lib/libnotmuch.so', needed by
> `ruby-bindings'.  Stop.

2. After manually changing it to lib/libnotmuch.dylib, I still get an
   error like below:

> cd bindings/ruby && \
> 		EXTRA_LDFLAGS="" \
> 		ruby extconf.rb --vendor
> checking for notmuch_database_create in libnotmuch.so... no
> *** extconf.rb failed ***
> Could not create Makefile due to some reason, probably lack of
> necessary libraries and/or headers.  Check the mkmf.log file for more
> details.  You may need configuration options.

> Provided configuration options:
> 	--with-opt-dir
> 	--without-opt-dir
> 	--with-opt-include
> 	--without-opt-include=${opt-dir}/include
> 	--with-opt-lib
> 	--without-opt-lib=${opt-dir}/lib
> 	--with-make-prog
> 	--without-make-prog
> 	--srcdir=.
> 	--curdir
> 	--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
> make: *** [ruby-bindings] Error 1

I tried updating extconf.rb to change libnotmuch.so to libnotmuch.dylib
but that still emit a similar error.

And the attached is the log file, mkmf.log generated in bindings/ruby.


[-- Attachment #2: mkmf.log --]
[-- Type: text/plain, Size: 3733 bytes --]

have_local_library: checking for notmuch_database_create in libnotmuch.dylib... -------------------- no

"xcrun clang -o conftest -I../../lib -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib    -arch x86_64 -arch i386   -lruby.2.0.0  -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"xcrun clang -o conftest -I../../lib -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib    -arch x86_64 -arch i386   -lruby.2.0.0 ../../lib/libnotmuch.dylib -lpthread -ldl -lobjc "
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
Undefined symbols for architecture i386:
  "_notmuch_database_create", referenced from:
      _t in conftest-2cad94.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <notmuch.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { void ((*volatile p)()); p = (void ((*)()))notmuch_database_create; return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

"xcrun clang -o conftest -I../../lib -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/universal-darwin14 -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/backward -I/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT    -g -Os -pipe -DHAVE_GCC_SYNC_BUILTINS conftest.c  -L. -L/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib -L. -L/usr/local/lib    -arch x86_64 -arch i386   -lruby.2.0.0 ../../lib/libnotmuch.dylib -lpthread -ldl -lobjc "
conftest.c:7:39: error: too few arguments to function call, expected 2, have 0
int t(void) { notmuch_database_create(); return 0; }
              ~~~~~~~~~~~~~~~~~~~~~~~ ^
../../lib/notmuch.h:234:1: note: 'notmuch_database_create' declared here
notmuch_status_t
^
1 error generated.
checked program was:
/* begin */
 1: #include "ruby.h"
 2: 
 3: #include <notmuch.h>
 4: 
 5: /*top*/
 6: extern int t(void);
 7: int t(void) { notmuch_database_create(); return 0; }
 8: int main(int argc, char **argv)
 9: {
10:   if (argc > 1000000) {
11:     printf("%p", &t);
12:   }
13: 
14:   return 0;
15: }
/* end */

--------------------


[-- Attachment #3: Type: text/plain, Size: 3291 bytes --]


On Sat, Jun 13, 2015 at 10:58 PM, David Bremner <david@tethera.net> wrote:
> In particular this is supposed to help build on systems (presumably
> using a non-gnu ld) where this flag is not available.
> ---
>  bindings/Makefile.local  |  4 +++-
>  bindings/ruby/extconf.rb |  5 +++--
>  configure                | 13 +++++++++++++
>  lib/Makefile.local       |  2 +-
>  4 files changed, 20 insertions(+), 4 deletions(-)
>
> diff --git a/bindings/Makefile.local b/bindings/Makefile.local
> index 16817f5..d236f01 100644
> --- a/bindings/Makefile.local
> +++ b/bindings/Makefile.local
> @@ -5,7 +5,9 @@ dir := bindings
>  # force the shared library to be built
>  ruby-bindings: lib/libnotmuch.so
>  ifeq ($(HAVE_RUBY_DEV),1)
> -	cd $(dir)/ruby && ruby extconf.rb --vendor
> +	cd $(dir)/ruby && \
> +		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
> +		ruby extconf.rb --vendor
>  	$(MAKE) -C $(dir)/ruby
>  else
>  	@echo Missing dependency, skipping ruby bindings
> diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
> index 6160db2..6d5607e 100644
> --- a/bindings/ruby/extconf.rb
> +++ b/bindings/ruby/extconf.rb
> @@ -10,8 +10,9 @@ dir = File.join('..', '..', 'lib')
>  # includes
>  $INCFLAGS = "-I#{dir} #{$INCFLAGS}"
>  
> -# make sure there are no undefined symbols
> -$LDFLAGS += ' -Wl,--no-undefined'
> +if ENV['EXTRA_LDFLAGS']
> +  $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
> +end
>  
>  def have_local_library(lib, path, func, headers = nil)
>    checking_for checking_message(func, lib) do
> diff --git a/configure b/configure
> index 13a8dca..b967a4e 100755
> --- a/configure
> +++ b/configure
> @@ -751,6 +751,16 @@ else
>      as_needed_ldflags=""
>  fi
>  
> +printf "Checking for -Wl,--no-undefined... "
> +if ${CC} -Wl,--no-undefined -o minimal minimal.c >/dev/null 2>&1
> +then
> +    printf "Yes.\n"
> +    no_undefined_ldflags="-Wl,--no-undefined"
> +else
> +    printf "No (nothing to worry about).\n"
> +    no_undefined_ldflags=""
> +fi
> +
>  WARN_CXXFLAGS=""
>  printf "Checking for available C++ compiler warning flags... "
>  for flag in -Wall -Wextra -Wwrite-strings; do
> @@ -955,6 +965,9 @@ RPATH_LDFLAGS = ${rpath_ldflags}
>  # Flags needed to have linker link only to necessary libraries
>  AS_NEEDED_LDFLAGS = ${as_needed_ldflags}
>  
> +# Flags to have the linker flag undefined symbols in object files
> +NO_UNDEFINED_LDFLAGS = ${no_undefined_ldflags}
> +
>  # Whether valgrind header files are available
>  HAVE_VALGRIND = ${have_valgrind}
>  
> diff --git a/lib/Makefile.local b/lib/Makefile.local
> index f9ecd50..b58b4e8 100644
> --- a/lib/Makefile.local
> +++ b/lib/Makefile.local
> @@ -33,7 +33,7 @@ LIBRARY_SUFFIX = so
>  LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
>  SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
>  LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
> -LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) -Wl,--no-undefined
> +LIBRARY_LINK_FLAG = -shared -Wl,--version-script=notmuch.sym,-soname=$(SONAME) $(NO_UNDEFINED_LDFLAGS)
>  ifeq ($(PLATFORM),OPENBSD)
>  LIBRARY_LINK_FLAG += -lc
>  endif
> -- 
> 2.1.4
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* [PATCH] build/ruby: use notmuch configure script values for shared lib
  2015-06-01  7:09         ` [patch v3 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
@ 2015-06-14  6:26           ` David Bremner
  0 siblings, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-06-14  6:26 UTC (permalink / raw)
  To: David Bremner, notmuch

This is supposed to help build on systems like MacOS with different
conventions for naming shared libraries. We have already computed the
relevant names, so doing it again in ruby seems like a bad idea.
---
 bindings/Makefile.local  |  3 ++-
 bindings/ruby/extconf.rb | 13 +++----------
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/bindings/Makefile.local b/bindings/Makefile.local
index d236f01..4ecf839 100644
--- a/bindings/Makefile.local
+++ b/bindings/Makefile.local
@@ -3,10 +3,11 @@
 dir := bindings
 
 # force the shared library to be built
-ruby-bindings: lib/libnotmuch.so
+ruby-bindings: lib/$(LINKER_NAME)
 ifeq ($(HAVE_RUBY_DEV),1)
 	cd $(dir)/ruby && \
 		EXTRA_LDFLAGS="$(NO_UNDEFINED_LDFLAGS)" \
+		LIBNOTMUCH="../../lib/$(LINKER_NAME)" \
 		ruby extconf.rb --vendor
 	$(MAKE) -C $(dir)/ruby
 else
diff --git a/bindings/ruby/extconf.rb b/bindings/ruby/extconf.rb
index 6d5607e..ddaa684 100644
--- a/bindings/ruby/extconf.rb
+++ b/bindings/ruby/extconf.rb
@@ -14,19 +14,12 @@ if ENV['EXTRA_LDFLAGS']
   $LDFLAGS += " " + ENV['EXTRA_LDFLAGS']
 end
 
-def have_local_library(lib, path, func, headers = nil)
-  checking_for checking_message(func, lib) do
-    lib = File.join(path, lib)
-    if try_func(func, lib, headers)
-      $LOCAL_LIBS += lib
-    end
-  end
-end
-
-if not have_local_library('libnotmuch.so', dir, 'notmuch_database_create', 'notmuch.h')
+if not ENV['LIBNOTMUCH']
   exit 1
 end
 
+$LOCAL_LIBS += ENV['LIBNOTMUCH']
+
 # Create Makefile
 dir_config('notmuch')
 create_makefile('notmuch')
-- 
2.1.4

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-14  6:20             ` Jinwoo Lee
@ 2015-06-14  6:53               ` David Bremner
  2015-06-14 15:16                 ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-06-14  6:53 UTC (permalink / raw)
  To: Jinwoo Lee, notmuch

Jinwoo Lee <jinwoo68@gmail.com> writes:

> There are 2 problems.
>
> 1. The file, bindings/Makefile.local still has lib/libnotmuch.so as the
>    dependency of ruby-bindings.

this is fixed in

     id:1434263191-14171-1-git-send-email-david@tethera.net

an updated patch sent a few minutes ago.

>
>> cd bindings/ruby && \
>> 		EXTRA_LDFLAGS="" \
>> 		ruby extconf.rb --vendor
>> checking for notmuch_database_create in libnotmuch.so... no
>> *** extconf.rb failed ***

This should also be fixed by the same patch, since that test is
eliminated.

> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib

On the other hand, this suggests there is still something broken with
building the ruby extensions on mac. I think if noone has a better idea,
and the updated versions of the two patches I sent to the list this
morning don't help, I'll just add a "--without-ruby" option to the
config script. In the long run, we probably want such an option anyway.  

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-14  6:53               ` David Bremner
@ 2015-06-14 15:16                 ` Jinwoo Lee
  2015-06-14 18:34                   ` David Bremner
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-14 15:16 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sat, Jun 13, 2015 at 11:53 PM, David Bremner <david@tethera.net> wrote:
> Jinwoo Lee <jinwoo68@gmail.com> writes:
>
>> There are 2 problems.
>>
>> 1. The file, bindings/Makefile.local still has lib/libnotmuch.so as the
>>    dependency of ruby-bindings.
>
> this is fixed in
>
>      id:1434263191-14171-1-git-send-email-david@tethera.net
>
> an updated patch sent a few minutes ago.
>
>>
>>> cd bindings/ruby && \
>>> 		EXTRA_LDFLAGS="" \
>>> 		ruby extconf.rb --vendor
>>> checking for notmuch_database_create in libnotmuch.so... no
>>> *** extconf.rb failed ***
>
> This should also be fixed by the same patch, since that test is
> eliminated.
>
>> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
>
> On the other hand, this suggests there is still something broken with
> building the ruby extensions on mac. I think if noone has a better idea,
> and the updated versions of the two patches I sent to the list this
> morning don't help, I'll just add a "--without-ruby" option to the
> config script. In the long run, we probably want such an option anyway.  

When I apply those 2 patches from you, things seem to work.  I still get
warnings like below, but they don't seem severe.  I'm not sure if the
ruby binding actually works though.

ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib

Thanks, David, for the quick fix!

-jinwoo

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-14 15:16                 ` Jinwoo Lee
@ 2015-06-14 18:34                   ` David Bremner
  2015-06-15  3:56                     ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: David Bremner @ 2015-06-14 18:34 UTC (permalink / raw)
  To: Jinwoo Lee, notmuch

Jinwoo Lee <jinwoo68@gmail.com> writes:

> When I apply those 2 patches from you, things seem to work.  I still get
> warnings like below, but they don't seem severe.  I'm not sure if the
> ruby binding actually works though.
>
> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
>

That one is a bit worrying, but I don't know enough about OS X to know
for sure. If you have time/interest, can you try running the tests in

    id:1433142542-2307-5-git-send-email-david@tethera.net

Just apply the patch and make tests. That should indicate if the
bindings are basically working.

d

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-14 18:34                   ` David Bremner
@ 2015-06-15  3:56                     ` Jinwoo Lee
  2015-06-15  9:20                       ` Tomi Ollila
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-15  3:56 UTC (permalink / raw)
  To: David Bremner, notmuch

On Sun, Jun 14, 2015 at 11:34 AM, David Bremner <david@tethera.net> wrote:
> Jinwoo Lee <jinwoo68@gmail.com> writes:
>
>> When I apply those 2 patches from you, things seem to work.  I still get
>> warnings like below, but they don't seem severe.  I'm not sure if the
>> ruby binding actually works though.
>>
>> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
>>
>
> That one is a bit worrying, but I don't know enough about OS X to know
> for sure. If you have time/interest, can you try running the tests in
>
>     id:1433142542-2307-5-git-send-email-david@tethera.net
>
> Just apply the patch and make tests. That should indicate if the
> bindings are basically working.

Do you mean `make test', not `make tests'?

`make test' errors saying that the bash version must be >= 4.0.  Bash on
my mac is 3.2.57, which is the default bash installed on Yosemite.

    Error: The notmuch test suite requires a bash version >= 4.0
    due to use of associative arrays within the test suite.
    Please try again with a newer bash (or help us fix the
    test suite to be more portable). Thanks.

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

* Re: [patch v3 1/4] build: integrate building ruby bindings into notmuch build process
  2015-06-13  6:37           ` David Bremner
  2015-06-13 19:59             ` Jinwoo Lee
@ 2015-06-15  6:35             ` David Bremner
  1 sibling, 0 replies; 42+ messages in thread
From: David Bremner @ 2015-06-15  6:35 UTC (permalink / raw)
  To: notmuch

David Bremner <david@tethera.net> writes:

> David Bremner <david@tethera.net> writes:
>
>> Because ruby generates a Makefile, we have to use recursive make.
>> Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
>> in the parent directory.
>
> Pushed the first patch in the series. Let's see if anything breaks.
>

It turned out the answer was "Mac", so I pushed the next two patches as
well. I threw in the actual tests, since that was the point of this
effort.

d

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-15  3:56                     ` Jinwoo Lee
@ 2015-06-15  9:20                       ` Tomi Ollila
  2015-06-15 21:49                         ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: Tomi Ollila @ 2015-06-15  9:20 UTC (permalink / raw)
  To: Jinwoo Lee, David Bremner, notmuch

On Mon, Jun 15 2015, Jinwoo Lee <jinwoo68@gmail.com> wrote:

> On Sun, Jun 14, 2015 at 11:34 AM, David Bremner <david@tethera.net> wrote:
>> Jinwoo Lee <jinwoo68@gmail.com> writes:
>>
>>> When I apply those 2 patches from you, things seem to work.  I still get
>>> warnings like below, but they don't seem severe.  I'm not sure if the
>>> ruby binding actually works though.
>>>
>>> ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
>>>
>>
>> That one is a bit worrying, but I don't know enough about OS X to know
>> for sure. If you have time/interest, can you try running the tests in
>>
>>     id:1433142542-2307-5-git-send-email-david@tethera.net
>>
>> Just apply the patch and make tests. That should indicate if the
>> bindings are basically working.
>
> Do you mean `make test', not `make tests'?
>
> `make test' errors saying that the bash version must be >= 4.0.  Bash on
> my mac is 3.2.57, which is the default bash installed on Yosemite.

That probably will not change; IIRC bash 3.2.57 is released under GPLv2
and bash >= 4 GPLv3. You just need to install separate bash (brew, ports,
wherever) in order to run these tests in OS X.

>
>     Error: The notmuch test suite requires a bash version >= 4.0
>     due to use of associative arrays within the test suite.
>     Please try again with a newer bash (or help us fix the
>     test suite to be more portable). Thanks.
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-15  9:20                       ` Tomi Ollila
@ 2015-06-15 21:49                         ` Jinwoo Lee
  2015-06-16 18:20                           ` Tomi Ollila
  0 siblings, 1 reply; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-15 21:49 UTC (permalink / raw)
  To: Tomi Ollila, David Bremner, notmuch

> That probably will not change; IIRC bash 3.2.57 is released under GPLv2
> and bash >= 4 GPLv3. You just need to install separate bash (brew, ports,
> wherever) in order to run these tests in OS X.

I installed bash from MacPorts and ran `make test' again, but the result
is not so good.  The error message is just "make: *** [test] Error 9",
and I can't tell what exactly has failed.

Here's the log:

$ make test
cd bindings/ruby && \
		EXTRA_LDFLAGS="" \
		LIBNOTMUCH="../../lib/libnotmuch.dylib" \
		ruby extconf.rb --vendor
creating Makefile
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C bindings/ruby
linking shared-object notmuch.bundle
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
Use "/Applications/Xcode.app/Contents/Developer/usr/bin/make V=1" to see the verbose compile lines.
CC  -g -O2 test/arg-test.o
CC test/arg-test
CC  -g -O2 test/hex-xcode.o
CC test/hex-xcode
CC  -g -O2 test/random-corpus.o
CC  -g -O2 test/database-test.o
CXX test/random-corpus
CC  -g -O2 test/parse-time.o
CC test/parse-time
CC  -g -O2 test/smtp-dummy.o
CC test/smtp-dummy
CXX  -g -O2 test/symbol-test.o
test/symbol-test.cc:7:14: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char** argv) {
             ^
1 warning generated.
CXX test/symbol-test
CXX  -g -O2 test/make-db-version.o
CXX test/make-db-version
INFO: using 2 minute timeout for tests

T000-basic: Testing the test framework itself.
make: *** [test] Error 9

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-15 21:49                         ` Jinwoo Lee
@ 2015-06-16 18:20                           ` Tomi Ollila
  2015-06-16 23:43                             ` Jinwoo Lee
  0 siblings, 1 reply; 42+ messages in thread
From: Tomi Ollila @ 2015-06-16 18:20 UTC (permalink / raw)
  To: Jinwoo Lee, notmuch

On Tue, Jun 16 2015, Jinwoo Lee <jinwoo68@gmail.com> wrote:

>> That probably will not change; IIRC bash 3.2.57 is released under GPLv2
>> and bash >= 4 GPLv3. You just need to install separate bash (brew, ports,
>> wherever) in order to run these tests in OS X.
>
> I installed bash from MacPorts and ran `make test' again, but the result
> is not so good.  The error message is just "make: *** [test] Error 9",
> and I can't tell what exactly has failed.

edit file test/T000-basic.sh and add line

set -x

after the initial comments, and just before line

test_description='the test framework itself.'

then rerun the test; I'd suggest script -c 'make test'
but that may not work on OS X -- anyway we're interested
the last lines so that is not necessary here.

>
> Here's the log:
>
// stuff deleted
>
> T000-basic: Testing the test framework itself.
> make: *** [test] Error 9

At least we know it reached line 212 in test/test-lib.sh...

Tomi

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-16 18:20                           ` Tomi Ollila
@ 2015-06-16 23:43                             ` Jinwoo Lee
  2015-06-17  0:15                               ` Jinwoo Lee
  2015-06-17  6:23                               ` David Bremner
  0 siblings, 2 replies; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-16 23:43 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

Turns out my previous error was because I was running tests within Emacs
eshell, and run_emacs failed.

I tried again in a terminal and it still failed but for a different
reason.  I don't have readelf on my Mac.

$ make test
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C .. test
cd bindings/ruby && \
		EXTRA_LDFLAGS="" \
		LIBNOTMUCH="../../lib/libnotmuch.dylib" \
		ruby extconf.rb --vendor
creating Makefile
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C bindings/ruby
linking shared-object notmuch.bundle
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
INFO: using 2 minute timeout for tests

T000-basic: Testing the test framework itself.
./test-lib-common.sh: line 43: /Users/jinwoo/Box: No such file or directory
 PASS   success is reported like this
 PASS   test runs if prerequisite is satisfied
 PASS   tests clean up after themselves
 PASS   tests clean up even after a failure
 PASS   failure to clean up causes the test to fail
 PASS   Ensure that test output is suppressed unless the test fails
 PASS   Ensure that -v does not suppress test output
 PASS   test that mail store was created
 PASS   mail store should be empty
 PASS   NOTMUCH_CONFIG is set and points to an existing file
 FAIL   PATH is set to build directory
	--- T000-basic.11.expected	2015-06-16 23:40:30.000000000 +0000
	+++ T000-basic.11.output	2015-06-16 23:40:30.000000000 +0000
	@@ -1 +1 @@
	-/Users/jinwoo/Box Sync/personal/project/notmuch
	+
usage: dirname path
 FAIL   notmuch is compiled with debugging symbols
	--- T000-basic.12.expected	2015-06-16 23:40:30.000000000 +0000
	+++ T000-basic.12.output	2015-06-16 23:40:30.000000000 +0000
	@@ -1 +1 @@
	-1
	+0
./T000-basic.sh: line 95: readelf: command not found
./test-lib.sh: line 1062: $test_results_path: ambiguous redirect
./test-lib.sh: line 1063: $test_results_path: ambiguous redirect
./test-lib.sh: line 1064: $test_results_path: ambiguous redirect
./test-lib.sh: line 1065: $test_results_path: ambiguous redirect
./test-lib.sh: line 1066: $test_results_path: ambiguous redirect
./test-lib.sh: line 1067: $test_results_path: ambiguous redirect
make[1]: *** [test] Error 1
make: *** [test] Error 2

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-16 23:43                             ` Jinwoo Lee
@ 2015-06-17  0:15                               ` Jinwoo Lee
  2015-06-17  6:23                               ` David Bremner
  1 sibling, 0 replies; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-17  0:15 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

On Tue, Jun 16, 2015 at 04:43 PM, Jinwoo Lee <jinwoo68@gmail.com> wrote:
> Turns out my previous error was because I was running tests within Emacs
> eshell, and run_emacs failed.
>
> I tried again in a terminal and it still failed but for a different
> reason.  I don't have readelf on my Mac.

Looks like otool should be used on Mac.  But I have no idea how readelf
is used here and how it should be translated to otool.

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-16 23:43                             ` Jinwoo Lee
  2015-06-17  0:15                               ` Jinwoo Lee
@ 2015-06-17  6:23                               ` David Bremner
  2015-06-17  6:39                                 ` Jinwoo Lee
  2015-06-17 11:16                                 ` Tomi Ollila
  1 sibling, 2 replies; 42+ messages in thread
From: David Bremner @ 2015-06-17  6:23 UTC (permalink / raw)
  To: Jinwoo Lee, Tomi Ollila, notmuch

Jinwoo Lee <jinwoo68@gmail.com> writes:
>  FAIL   PATH is set to build directory
> 	--- T000-basic.11.expected	2015-06-16 23:40:30.000000000 +0000
> 	+++ T000-basic.11.output	2015-06-16 23:40:30.000000000 +0000
> 	@@ -1 +1 @@
> 	-/Users/jinwoo/Box Sync/personal/project/notmuch
> 	+
> usage: dirname path

This failure is because of spaces in your pathname. It might be simpler
to run in a different directory rather than fix all the problems this
causes in the test suite.

>  FAIL   notmuch is compiled with debugging symbols
> 	--- T000-basic.12.expected	2015-06-16 23:40:30.000000000 +0000
> 	+++ T000-basic.12.output	2015-06-16 23:40:30.000000000 +0000
> 	@@ -1 +1 @@
> 	-1
> 	+0
> ./T000-basic.sh: line 95: readelf: command not found

This test, as it says, is testing if notmuch was compiled with debugging
symbols.  Rather than yet another special case for mac, I'd be curious
if there is a portable test for this (perhaps using nm?). In any case,
this one test failing should not be fatal.

> ./test-lib.sh: line 1062: $test_results_path: ambiguous redirect
> ./test-lib.sh: line 1063: $test_results_path: ambiguous redirect
> ./test-lib.sh: line 1064: $test_results_path: ambiguous redirect
> ./test-lib.sh: line 1065: $test_results_path: ambiguous redirect
> ./test-lib.sh: line 1066: $test_results_path: ambiguous redirect
> ./test-lib.sh: line 1067: $test_results_path: ambiguous redirect

At a guess, this again has to do with spaces in the pathname. Maybe this
is fixable with more quoting, but it's really independent of mac vs
gnu/linux. In this instance it looks like quoting "test_results_path"
would help.

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-17  6:23                               ` David Bremner
@ 2015-06-17  6:39                                 ` Jinwoo Lee
  2015-06-17 11:16                                 ` Tomi Ollila
  1 sibling, 0 replies; 42+ messages in thread
From: Jinwoo Lee @ 2015-06-17  6:39 UTC (permalink / raw)
  To: David Bremner, Tomi Ollila, notmuch

[-- Attachment #1: Type: text/plain, Size: 494 bytes --]

On Tue, Jun 16, 2015 at 11:23 PM, David Bremner <david@tethera.net> wrote:
> At a guess, this again has to do with spaces in the pathname. Maybe this
> is fixable with more quoting, but it's really independent of mac vs
> gnu/linux. In this instance it looks like quoting "test_results_path"
> would help.

Ah, I thought the readelf error was a fatal one.  I re-ran `make test'
from a new directory that doesn't have spaces in its name.  It gave
different errors and I'm attaching the output.


[-- Attachment #2: Notmuch test log --]
[-- Type: text/plain, Size: 16761 bytes --]

/Applications/Xcode.app/Contents/Developer/usr/bin/make -C .. test
cd bindings/ruby && \
		EXTRA_LDFLAGS="" \
		LIBNOTMUCH="../../lib/libnotmuch.dylib" \
		ruby extconf.rb --vendor
creating Makefile
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C bindings/ruby
linking shared-object notmuch.bundle
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: directory not found for option '-L/usr/local/lib'
ld: warning: ignoring file ../../lib/libnotmuch.dylib, file was built for x86_64 which is not the architecture being linked (i386): ../../lib/libnotmuch.dylib
Use "/Applications/Xcode.app/Contents/Developer/usr/bin/make V=1" to see the verbose compile lines.
CC  -g -O2 test/arg-test.o
CC test/arg-test
CC  -g -O2 test/hex-xcode.o
CC test/hex-xcode
CC  -g -O2 test/random-corpus.o
CC  -g -O2 test/database-test.o
CXX test/random-corpus
CC  -g -O2 test/parse-time.o
CC test/parse-time
CC  -g -O2 test/smtp-dummy.o
CC test/smtp-dummy
CXX  -g -O2 test/symbol-test.o
test/symbol-test.cc:7:14: warning: unused parameter 'argc' [-Wunused-parameter]
int main(int argc, char** argv) {
             ^
1 warning generated.
CXX test/symbol-test
CXX  -g -O2 test/make-db-version.o
CXX test/make-db-version
INFO: using 2 minute timeout for tests

T000-basic: Testing the test framework itself.
 PASS   success is reported like this
 PASS   test runs if prerequisite is satisfied
 PASS   tests clean up after themselves
 PASS   tests clean up even after a failure
 PASS   failure to clean up causes the test to fail
 PASS   Ensure that test output is suppressed unless the test fails
 PASS   Ensure that -v does not suppress test output
 PASS   test that mail store was created
 PASS   mail store should be empty
 PASS   NOTMUCH_CONFIG is set and points to an existing file
 PASS   PATH is set to build directory
 FAIL   notmuch is compiled with debugging symbols
	--- T000-basic.12.expected	2015-06-17 06:35:04.000000000 +0000
	+++ T000-basic.12.output	2015-06-17 06:35:04.000000000 +0000
	@@ -1 +1 @@
	-1
	+0
./T000-basic.sh: line 95: readelf: command not found

T010-help-test: Testing online help
 PASS   notmuch --help
 PASS   notmuch help
 PASS   notmuch --version
 FAIL   notmuch --help tag (man pages not available)
	test_must_fail notmuch --help tag >/dev/null
 PASS   notmuch help tag (man pages not available)

T020-compact: Testing "notmuch compact"
 PASS   Running compact
 PASS   Compact preserves database
 PASS   Restoring Backup
 PASS   Checking restored backup

T030-config: Testing "notmuch config"
 PASS   Get string value
 PASS   Get list value
 PASS   Set string value
 PASS   Set string value again
 PASS   Set list value
 PASS   Set list value again
 PASS   Remove key
 PASS   Remove non-existent key
 PASS   List all items
 PASS   Top level --config=FILE option
 PASS   Top level --config=FILE option changed the right file
 PASS   Read config file through a symlink
 PASS   Write config file through a symlink
 PASS   Writing config file through symlink follows symlink

T040-setup: Testing "notmuch setup"
 PASS   Notmuch new without a config suggests notmuch setup
 PASS   Create a new config interactively

T050-new: Testing "notmuch new" in several variations
 PASS   No new messages
 PASS   Single new message
 PASS   Multiple new messages
 PASS   No new messages (non-empty DB)
 PASS   New directories
 PASS   Alternate inode order
 PASS   Message moved in
 PASS   Renamed message
 PASS   Deleted message
 PASS   Renamed directory
 PASS   Deleted directory
 PASS   New directory (at end of list)
 PASS   Deleted directory (end of list)
 PASS   New symlink to directory
 PASS   New symlink to a file
 PASS   Broken symlink aborts
 PASS   New two-level directory
 PASS   Deleted two-level directory
 PASS   Support single-message mbox (deprecated)
 PASS   Skip and report non-mail files
 PASS   Ignore files and directories specified in new.ignore
 PASS   Ignore files and directories specified in new.ignore (multiple occurrences)
 PASS   Don't stop for ignored broken symlinks
 PASS   Quiet: No new mail.
 PASS   Quiet: new, removed and renamed messages.
 PASS   Empty tags in new.tags are forbidden
 PASS   Tags starting with '-' in new.tags are forbidden
 PASS   Invalid tags set exit code
 PASS   Xapian exception: read only files

T060-count: Testing "notmuch count" for messages and threads
 PASS   message count is the default for notmuch count
 PASS   message count with --output=messages
 PASS   thread count with --output=threads
 PASS   thread count is the default for notmuch search
 PASS   files count
 PASS   files count for a duplicate message-id
 PASS   count with no matching messages
 PASS   count with no matching threads
 PASS   message count is the default for batch count
 PASS   batch message count
 PASS   batch thread count
 PASS   batch message count with input file

T070-insert: Testing "notmuch insert"
 missing prerequisites: gdb(1)
 SKIP   all tests in T070-insert

T080-search: Testing "notmuch search" in several variations
 PASS   Search body
 PASS   Search by from:
 PASS   Search by to:
 PASS   Search by subject:
 PASS   Search by subject (utf-8):
 PASS   Search by id:
 PASS   Search by tag:
 PASS   Search by thread:
 PASS   Search body (phrase)
 PASS   Search by from: (address)
 PASS   Search by from: (name)
 PASS   Search by from: (name and address)
 PASS   Search by from: without prefix (name and address)
 PASS   Search by to: (address)
 PASS   Search by to: (name)
 PASS   Search by to: (name and adress)
 PASS   Search by to: without prefix (name and adress)
 PASS   Search by subject: (phrase)
 PASS   Search for all messages ("*")
 PASS   Search body (utf-8):
 PASS   headers do not have adjacent term positions
 PASS   parts have non-overlapping term positions
 PASS   parts do not have adjacent term positions

T090-search-output: Testing various settings for "notmuch search --output="
 PASS   --output=threads
 PASS   --output=threads --format=json
 PASS   --output=messages
 PASS   --output=messages --duplicate=1
 PASS   --output=messages --duplicate=2
 PASS   --output=messages --duplicate=3
 PASS   --output=messages --format=json
 PASS   --output=messages --format=json --duplicate=1
 PASS   --output=messages --format=json --duplicate=2
 PASS   --output=messages --format=json --duplicate=3
 PASS   --output=files
 PASS   --output=files --duplicate=1
 PASS   --output=files --format=json
 PASS   --output=files --format=json --duplicate=2
 PASS   --output=tags
 PASS   --output=tags --format=json
 PASS   sanitize output for quoted-printable line-breaks in author and subject
 PASS   search for non-existent message prints nothing
 PASS   search --format=json for non-existent message prints proper empty json

T095-address: Testing "notmuch address" in several variants
 PASS   --output=sender
 PASS   without --output
 PASS   --output=sender --format=json
 PASS   --output=recipients
 PASS   --output=sender --output=recipients
 PASS   --output=sender --output=count
 PASS   --output=count --format=json

T100-search-by-folder: Testing "notmuch search" by folder: and path: (with variations)
 PASS   Single-world folder: specification (multiple results)
 PASS   Top level folder
 PASS   Two-word path to narrow results to one
 PASS   Folder search with --output=files
 PASS   After removing duplicate instance of matching path
 PASS   Folder search with --output=files part #2
 PASS   After removing duplicate instance of matching path part #2
 PASS   After rename, old path returns nothing
 PASS   After rename, new path returns result
 PASS   folder: search
 PASS   top level folder: search
 PASS   path: search
 PASS   top level path: search
 PASS   recursive path: search

T110-search-position-overlap-bug: Testing that notmuch does not overlap term positions
 PASS   Search for a@b.c matches
 PASS   Search for x@y.z matches
 PASS   Search for a@y.c must not match

T120-search-insufficient-from-quoting: Testing messages with unquoted . in name
 PASS   Search by first name
 PASS   Search by last name:
 PASS   Search by address:
 PASS   Search for all messages:

T130-search-limiting: Testing "notmuch search" --offset and --limit parameters
 PASS   messages: limit does the right thing
 PASS   messages: concatenation of limited searches
 PASS   messages: limit larger than result set
 PASS   messages: limit = 0
 PASS   messages: offset does the right thing
 PASS   messages: offset = 0
 PASS   messages: negative offset
 PASS   messages: negative offset
 PASS   messages: negative offset combined with limit
 PASS   messages: negative offset combined with equal limit
 PASS   messages: negative offset combined with large limit
 PASS   messages: negative offset larger then results
 PASS   threads: limit does the right thing
 PASS   threads: concatenation of limited searches
 PASS   threads: limit larger than result set
 PASS   threads: limit = 0
 PASS   threads: offset does the right thing
 PASS   threads: offset = 0
 PASS   threads: negative offset
 PASS   threads: negative offset
 PASS   threads: negative offset combined with limit
 PASS   threads: negative offset combined with equal limit
 PASS   threads: negative offset combined with large limit
 PASS   threads: negative offset larger then results

T140-excludes: Testing "notmuch search, count and show" with excludes in several variations
 PASS   Search, exclude "deleted" messages from search
 PASS   Search, exclude "deleted" messages from message search
 PASS   Search, exclude "deleted" messages from message search --exclude=false
 PASS   Search, exclude "deleted" messages from message search (non-existent exclude-tag)
 PASS   Search, exclude "deleted" messages from search, overridden
 PASS   Search, exclude "deleted" messages from threads
 PASS   Search, don't exclude "deleted" messages when --exclude=flag specified
 PASS   Search, don't exclude "deleted" messages from search if not configured
 PASS   Search, default exclusion (thread summary)
 PASS   Search, default exclusion (messages)
 PASS   Search, exclude=true (thread summary)
 PASS   Search, exclude=true (messages)
 PASS   Search, exclude=false (thread summary)
 PASS   Search, exclude=false (messages)
 PASS   Search, exclude=flag (thread summary)
 PASS   Search, exclude=flag (messages)
 PASS   Search, exclude=all (thread summary)
 PASS   Search, exclude=all (messages)
 PASS   Search, default exclusion: tag in query (thread summary)
 PASS   Search, default exclusion: tag in query (messages)
 PASS   Search, exclude=true: tag in query (thread summary)
 PASS   Search, exclude=true: tag in query (messages)
 PASS   Search, exclude=false: tag in query (thread summary)
 PASS   Search, exclude=false: tag in query (messages)
 PASS   Search, exclude=flag: tag in query (thread summary)
 PASS   Search, exclude=flag: tag in query (messages)
 PASS   Search, exclude=all: tag in query (thread summary)
 PASS   Search, exclude=all: tag in query (messages)
 PASS   Count, default exclusion (messages)
 PASS   Count, default exclusion (threads)
 PASS   Count, exclude=true (messages)
 PASS   Count, exclude=true (threads)
 PASS   Count, exclude=false (messages)
 PASS   Count, exclude=false (threads)
 PASS   Count, default exclusion: tag in query (messages)
 PASS   Count, default exclusion: tag in query (threads)
 PASS   Count, exclude=true: tag in query (messages)
 PASS   Count, exclude=true: tag in query (threads)
 PASS   Count, exclude=false: tag in query (messages)
 PASS   Count, exclude=false: tag in query (threads)
 PASS   Show, default exclusion
 PASS   Show, default exclusion (entire-thread)
 PASS   Show, exclude=true
 PASS   Show, exclude=true (entire-thread)
 PASS   Show, exclude=false
 PASS   Show, exclude=false (entire-thread)

T150-tagging: Testing "notmuch tag"
 PASS   Adding tags
 PASS   Removing tags
 PASS   No tag operations
 PASS   No query
 PASS   Redundant tagging
 PASS   Remove all
 PASS   Remove all with a no-op
 PASS   Special characters in tags
 PASS   Tagging order
 PASS   --batch
 PASS   --input
 PASS   --batch --input
 PASS   --batch, blank lines and comments
 PASS   --batch: checking error messages
 PASS   --batch: tags with quotes
 PASS   --batch: tags with punctuation and space
 PASS   --batch: unicode tags
 PASS   --batch: only space and % needs to be encoded.
 PASS   --batch: unicode message-ids
 PASS   Empty tag names
 PASS   Tag name beginning with -
 PASS   Xapian exception: read only files

T160-json: Testing --format=json output
 PASS   Show message: json
 PASS   Show message: json --body=true
 PASS   Show message: json --body=false
 PASS   Search message: json
 PASS   Show message: json, utf-8
 missing prerequisites: dtach(1)
 SKIP   Show message: json, inline attachment filename
 PASS   Search message: json, utf-8
 PASS   Format version: too low
 PASS   Format version: too high

T170-sexp: Testing --format=sexp output
 PASS   Show message: sexp
 PASS   Show message: sexp --body=true
 PASS   Show message: sexp --body=false
 PASS   Search message: sexp
 PASS   Show message: sexp, utf-8
 missing prerequisites: dtach(1)
 SKIP   Show message: sexp, inline attachment filename
 FAIL   Search message: sexp, utf-8
	--- T170-sexp.7.expected	2015-06-17 06:35:18.000000000 +0000
	+++ T170-sexp.7.output	2015-06-17 06:35:18.000000000 +0000
	@@ -1 +1 @@
	-((:thread "0000000000000005" :timestamp 946728000 :date_relative "2000-01-01" :matched 1 :total 1 :authors "Notmuch Test Suite" :subject "sexp-search-utf8-body-sübjéct" :query ("id:msg-004@notmuch-test-suite" nil) :tags ("inbox" "unread")))
	+((:thread "0000000000000004" :timestamp 946728000 :date_relative "2000-01-01" :matched 1 :total 1 :authors "Notmuch Test Suite" :subject "sexp-search-utf8-body-sübjéct" :query ("id:msg-004@notmuch-test-suite" nil) :tags ("inbox" "unread")))

T180-text: Testing --format=text output
 PASS   Show message: text
 PASS   Search message: text
 PASS   Show message: text, utf-8
 PASS   Search message: text, utf-8
 PASS   Search message tags: text0
 PASS   Compare text vs. text0 for threads
 PASS   Compare text vs. text0 for messages
 PASS   Compare text vs. text0 for files
 PASS   Compare text vs. text0 for tags

T190-multipart: Testing output of multipart message
 PASS   --format=text --part=0, full message
 PASS   --format=text --part=1, message body
 PASS   --format=text --part=2, multipart/mixed
 PASS   --format=text --part=3, rfc822 part
 PASS   --format=text --part=4, rfc822's multipart
 PASS   --format=text --part=5, rfc822's html part
 PASS   --format=text --part=6, rfc822's text part
 PASS   --format=text --part=7, inline attachement
 PASS   --format=text --part=8, plain text part
 PASS   --format=text --part=9, pgp signature (unverified)
 PASS   --format=text --part=8, no part, expect error
 PASS   --format=json --part=0, full message
 PASS   --format=json --part=1, message body
 PASS   --format=json --part=2, multipart/mixed
 PASS   --format=json --part=3, rfc822 part
 PASS   --format=json --part=4, rfc822's multipart/alternative
 PASS   --format=json --part=5, rfc822's html part
 PASS   --format=json --part=6, rfc822's text part
 PASS   --format=json --part=7, inline attachment
 PASS   --format=json --part=8, plain text part
 PASS   --format=json --part=9, pgp signature (unverified)
 PASS   --format=json --part=10, no part, expect error
 PASS   --format=raw
 PASS   --format=raw --part=0, full message
 PASS   --format=raw --part=1, message body
 PASS   --format=raw --part=2, multipart/mixed
 PASS   --format=raw --part=3, rfc822 part
 PASS   --format=raw --part=4, rfc822's multipart
 PASS   --format=raw --part=5, rfc822's html part
 PASS   --format=raw --part=6, rfc822's text part
 PASS   --format=raw --part=7, inline attachment
 PASS   --format=raw --part=8, plain text part
 PASS   --format=raw --part=9, pgp signature (unverified)
 PASS   --format=raw --part=10, no part, expect error
 PASS   --format=mbox
 PASS   --format=mbox --part=1, incompatible, expect error
 PASS   'notmuch reply' to a multipart message
 PASS   'notmuch reply' to a multipart message with json format
 PASS   'notmuch show --part' does not corrupt a part with CRLF pair
 PASS   html parts excluded by default
Timeout: aborting command ``./T190-multipart.sh'' with signal 9
test/notmuch-test: line 36: 32948 Killed: 9               $TEST_TIMEOUT_CMD ./$test "$@"
make[1]: *** [test] Error 137
make: *** [test] Error 2

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

* Re: [PATCH] lib, ruby: make use of -Wl,--no-undefined configurable
  2015-06-17  6:23                               ` David Bremner
  2015-06-17  6:39                                 ` Jinwoo Lee
@ 2015-06-17 11:16                                 ` Tomi Ollila
  1 sibling, 0 replies; 42+ messages in thread
From: Tomi Ollila @ 2015-06-17 11:16 UTC (permalink / raw)
  To: Jinwoo Lee, notmuch

On Wed, Jun 17 2015, David Bremner <david@tethera.net> wrote:

> Jinwoo Lee <jinwoo68@gmail.com> writes:
>>  FAIL   PATH is set to build directory
>> 	--- T000-basic.11.expected	2015-06-16 23:40:30.000000000 +0000
>> 	+++ T000-basic.11.output	2015-06-16 23:40:30.000000000 +0000
>> 	@@ -1 +1 @@
>> 	-/Users/jinwoo/Box Sync/personal/project/notmuch
>> 	+
>> usage: dirname path
>
> This failure is because of spaces in your pathname. It might be simpler
> to run in a different directory rather than fix all the problems this
> causes in the test suite.

Yes.. space in pathname also causes that 'ambiquous redirect'. 

Please use a directory which absolute path does not contain spaces (nor
tabs nor newline ;/) -- it would be quite a big project to make test
suite work with whitespace in filename and still something might broke
so it is not worth an effort.

Probably not all tests will succeed anyway, but if you get relevant
tests to work then that should be good enough...

Tomi

>
>>  FAIL   notmuch is compiled with debugging symbols
>> 	--- T000-basic.12.expected	2015-06-16 23:40:30.000000000 +0000
>> 	+++ T000-basic.12.output	2015-06-16 23:40:30.000000000 +0000
>> 	@@ -1 +1 @@
>> 	-1
>> 	+0
>> ./T000-basic.sh: line 95: readelf: command not found
>
> This test, as it says, is testing if notmuch was compiled with debugging
> symbols.  Rather than yet another special case for mac, I'd be curious
> if there is a portable test for this (perhaps using nm?). In any case,
> this one test failing should not be fatal.

yes, there is just one (1) test in the whole suite (last one in T000-basic)
that uses readelf. 

>
>> ./test-lib.sh: line 1062: $test_results_path: ambiguous redirect
>> ./test-lib.sh: line 1063: $test_results_path: ambiguous redirect
>> ./test-lib.sh: line 1064: $test_results_path: ambiguous redirect
>> ./test-lib.sh: line 1065: $test_results_path: ambiguous redirect
>> ./test-lib.sh: line 1066: $test_results_path: ambiguous redirect
>> ./test-lib.sh: line 1067: $test_results_path: ambiguous redirect
>
> At a guess, this again has to do with spaces in the pathname. Maybe this
> is fixable with more quoting, but it's really independent of mac vs
> gnu/linux. In this instance it looks like quoting "test_results_path"
> would help.

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

end of thread, other threads:[~2015-06-17 11:16 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-01 12:16 Build and test ruby bindings David Bremner
2015-01-01 12:16 ` [PATCH 1/5] build: integrate building ruby bindings into notmuch build process David Bremner
2015-01-01 12:16 ` [PATCH 2/5] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-01-01 12:16 ` [PATCH 3/5] bindings/ruby: gitignore *.o David Bremner
2015-01-01 15:53   ` David Bremner
2015-01-01 12:16 ` [PATCH 4/5] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-01-01 12:16 ` [PATCH 5/5] test: add initial ruby tests David Bremner
2015-03-06 21:57   ` integrate ruby into build and test v2 David Bremner
2015-03-06 21:57     ` [Patch v2 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
2015-03-06 21:57     ` [Patch v2 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-03-06 21:57     ` [Patch v2 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-03-06 21:57     ` [Patch v2 4/4] test: add initial ruby tests David Bremner
2015-06-01  7:08       ` Build ruby bindings: round 3 David Bremner
2015-06-01  7:08         ` [patch v3 1/4] build: integrate building ruby bindings into notmuch build process David Bremner
2015-06-13  6:37           ` David Bremner
2015-06-13 19:59             ` Jinwoo Lee
2015-06-13 20:46               ` Jinwoo Lee
2015-06-13 20:51                 ` Jinwoo Lee
2015-06-13 21:11                   ` David Bremner
2015-06-13 21:22                     ` Jinwoo Lee
2015-06-13 21:24                       ` Jinwoo Lee
2015-06-13 21:34                         ` Jinwoo Lee
2015-06-14  5:49                           ` David Bremner
2015-06-15  6:35             ` David Bremner
2015-06-01  7:09         ` [patch v3 2/4] build/ruby: make use of -Wl,--no-undefined configurable David Bremner
2015-06-14  5:58           ` [PATCH] lib, ruby: " David Bremner
2015-06-14  6:20             ` Jinwoo Lee
2015-06-14  6:53               ` David Bremner
2015-06-14 15:16                 ` Jinwoo Lee
2015-06-14 18:34                   ` David Bremner
2015-06-15  3:56                     ` Jinwoo Lee
2015-06-15  9:20                       ` Tomi Ollila
2015-06-15 21:49                         ` Jinwoo Lee
2015-06-16 18:20                           ` Tomi Ollila
2015-06-16 23:43                             ` Jinwoo Lee
2015-06-17  0:15                               ` Jinwoo Lee
2015-06-17  6:23                               ` David Bremner
2015-06-17  6:39                                 ` Jinwoo Lee
2015-06-17 11:16                                 ` Tomi Ollila
2015-06-01  7:09         ` [patch v3 3/4] build/ruby: use notmuch configure script values for shared lib David Bremner
2015-06-14  6:26           ` [PATCH] " David Bremner
2015-06-01  7:09         ` [patch v3 4/4] test: add initial ruby tests 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).