unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] test/symbol-hiding: rename to test/libnotmuch-abi, prepare to add more subtests
@ 2011-06-29 11:56 david
  2011-06-29 11:56 ` [PATCH 2/2] test/libnotmuch-abi: compare exported symbols, available symbols, and linker script david
  0 siblings, 1 reply; 2+ messages in thread
From: david @ 2011-06-29 11:56 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

Test descriptions changed to accomodate more subtests.
The generic 'run_test' is renamed 'run_exception_test',
symbol-test(.cc) is renamed exception-test(.cc).
---

I'm not sure if it would be better to start a new test script rather
than this fuss about renaming, but "symbol-test.cc" is probably to
generic as a name anyway. Arguably exception-test.cc is pretty generic
too.

 test/basic             |    2 +-
 test/exception-test.cc |   17 +++++++++++++++++
 test/libnotmuch-abi    |   26 ++++++++++++++++++++++++++
 test/notmuch-test      |    2 +-
 test/symbol-hiding     |   26 --------------------------
 test/symbol-test.cc    |   17 -----------------
 6 files changed, 45 insertions(+), 45 deletions(-)
 create mode 100644 test/exception-test.cc
 create mode 100755 test/libnotmuch-abi
 delete mode 100755 test/symbol-hiding
 delete mode 100644 test/symbol-test.cc

diff --git a/test/basic b/test/basic
index 33bf711..9b8542f 100755
--- a/test/basic
+++ b/test/basic
@@ -56,7 +56,7 @@ tests_in_suite=$(for i in $TESTS; do echo $i; done | sort)
 available=$(ls -1 $TEST_DIRECTORY/ | \
     sed -r -e "/^(aggregate-results.sh|Makefile|Makefile.local|notmuch-test)/d" \
 	   -e "/^(README|test-lib.sh|test-lib.el|test-results|tmp.*|valgrind|corpus*)/d" \
-	   -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|symbol-test.cc)/d" \
+	   -e "/^(emacs.expected-output|smtp-dummy|smtp-dummy.c|test-verbose|exception-test.cc)/d" \
 	   -e "/^(test.expected-output|.*~)/d" \
 	   -e "/^(gnupg-secret-key.asc)/d" \
 	   -e "/^(gnupg-secret-key.NOTE)/d" \
diff --git a/test/exception-test.cc b/test/exception-test.cc
new file mode 100644
index 0000000..1de06ea
--- /dev/null
+++ b/test/exception-test.cc
@@ -0,0 +1,17 @@
+#include <stdio.h>
+#include <xapian.h>
+#include <notmuch.h>
+main (int argc, char **argv){
+
+    notmuch_database_t *notmuch
+      = notmuch_database_open ("fakedb",
+				     NOTMUCH_DATABASE_MODE_READ_ONLY);
+
+  try{
+    (void)new Xapian::WritableDatabase ("./nonexistant",					Xapian::DB_OPEN);
+  } catch (const Xapian::Error &error) {
+    printf("caught %s\n",error.get_msg().c_str());
+    return 0;
+  }
+  return 1;
+}
diff --git a/test/libnotmuch-abi b/test/libnotmuch-abi
new file mode 100755
index 0000000..a7467b8
--- /dev/null
+++ b/test/libnotmuch-abi
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2011 David Bremner
+#
+
+test_description='libnotmuch symbol export and hiding'
+
+# This subtest tests whether hiding Xapian::Error symbols in libnotmuch
+# also hides them for other users of libxapian. This is motivated by
+# the discussion in http://gcc.gnu.org/wiki/Visibility'
+
+. ./test-lib.sh
+
+run_exception_test(){
+    result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib ./exception-test 2>&1)
+}
+
+output="A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian'
+caught No chert database found at path \`./nonexistant'"
+
+g++ -o exception-test -I$TEST_DIRECTORY/../lib $TEST_DIRECTORY/exception-test.cc -L$TEST_DIRECTORY/../lib -lnotmuch -lxapian
+mkdir -p fakedb/.notmuch
+test_expect_success 'running exception test' run_exception_test
+test_begin_subtest 'checking output'
+test_expect_equal "$result" "$output" 
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index fe85c6a..c7296fa 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -40,7 +40,7 @@ TESTS="
   emacs-large-search-buffer
   maildir-sync
   crypto
-  symbol-hiding
+  libnotmuch-abi
 "
 TESTS=${NOTMUCH_TESTS:=$TESTS}
 
diff --git a/test/symbol-hiding b/test/symbol-hiding
deleted file mode 100755
index d0b31ae..0000000
--- a/test/symbol-hiding
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-#
-# Copyright (c) 2011 David Bremner
-#
-
-# This test tests whether hiding Xapian::Error symbols in libnotmuch
-# also hides them for other users of libxapian. This is motivated by
-# the discussion in http://gcc.gnu.org/wiki/Visibility'
-
-test_description='exception symbol hiding'
-
-. ./test-lib.sh
-
-run_test(){
-    result=$(LD_LIBRARY_PATH=$TEST_DIRECTORY/../lib ./symbol-test 2>&1)
-}
-
-output="A Xapian exception occurred opening database: Couldn't stat 'fakedb/.notmuch/xapian'
-caught No chert database found at path \`./nonexistant'"
-
-g++ -o symbol-test -I$TEST_DIRECTORY/../lib $TEST_DIRECTORY/symbol-test.cc -L$TEST_DIRECTORY/../lib -lnotmuch -lxapian
-mkdir -p fakedb/.notmuch
-test_expect_success 'running test' run_test
-test_begin_subtest 'checking output'
-test_expect_equal "$result" "$output" 
-test_done
diff --git a/test/symbol-test.cc b/test/symbol-test.cc
deleted file mode 100644
index 1de06ea..0000000
--- a/test/symbol-test.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-#include <stdio.h>
-#include <xapian.h>
-#include <notmuch.h>
-main (int argc, char **argv){
-
-    notmuch_database_t *notmuch
-      = notmuch_database_open ("fakedb",
-				     NOTMUCH_DATABASE_MODE_READ_ONLY);
-
-  try{
-    (void)new Xapian::WritableDatabase ("./nonexistant",					Xapian::DB_OPEN);
-  } catch (const Xapian::Error &error) {
-    printf("caught %s\n",error.get_msg().c_str());
-    return 0;
-  }
-  return 1;
-}
-- 
1.7.5.4

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

* [PATCH 2/2] test/libnotmuch-abi: compare exported symbols, available symbols, and linker script.
  2011-06-29 11:56 [PATCH 1/2] test/symbol-hiding: rename to test/libnotmuch-abi, prepare to add more subtests david
@ 2011-06-29 11:56 ` david
  0 siblings, 0 replies; 2+ messages in thread
From: david @ 2011-06-29 11:56 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

This uses objdump and awk to grab the available "notmuch_" symbols
from the object files and all exported symbols from libnotmuch.so. The
symbols from the linker script are grabbed using sed.  All three of
these sets of symbols should be equal.
---
 test/libnotmuch-abi |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/test/libnotmuch-abi b/test/libnotmuch-abi
index a7467b8..0e6192b 100755
--- a/test/libnotmuch-abi
+++ b/test/libnotmuch-abi
@@ -23,4 +23,14 @@ mkdir -p fakedb/.notmuch
 test_expect_success 'running exception test' run_exception_test
 test_begin_subtest 'checking output'
 test_expect_equal "$result" "$output" 
+
+objdump -t $TEST_DIRECTORY/../lib/*.o | awk '$4 == ".text" && $6 ~ "^notmuch" {print $6}' | sort | uniq >  all-symbols.txt
+
+test_begin_subtest 'checking linker script'
+sed -n 's/^\s*\(notmuch_.*\);/\1/p' $TEST_DIRECTORY/../notmuch.sym | sort> script-symbols.txt
+test_expect_equal_file all-symbols.txt script-symbols.txt
+
+test_begin_subtest 'comparing exported symbols'
+objdump -T $TEST_DIRECTORY/../lib/libnotmuch.so | awk '$4 == ".text" {print $7}' | sort | uniq >  lib-symbols.txt
+test_expect_equal_file all-symbols.txt lib-symbols.txt
 test_done
-- 
1.7.5.4

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

end of thread, other threads:[~2011-06-29 11:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-29 11:56 [PATCH 1/2] test/symbol-hiding: rename to test/libnotmuch-abi, prepare to add more subtests david
2011-06-29 11:56 ` [PATCH 2/2] test/libnotmuch-abi: compare exported symbols, available symbols, and linker script david

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).